From 7ab72de288a0b4b6f6144fb4501fca26efcec18c Mon Sep 17 00:00:00 2001 From: Leufolium Date: Mon, 11 Nov 2024 13:41:58 +0800 Subject: [PATCH] 1 --- api/proto/zonemoment/proto/zonemoment_api.go | 14 ----- app/mix/dao/mongo.go | 17 ------ app/mix/service/apiservice.go | 57 -------------------- app/mix/service/logic/vas.go | 2 +- app/mix/service/logic/zonemoment.go | 9 ---- 5 files changed, 1 insertion(+), 98 deletions(-) diff --git a/api/proto/zonemoment/proto/zonemoment_api.go b/api/proto/zonemoment/proto/zonemoment_api.go index 65ff33ff..7d8006a6 100644 --- a/api/proto/zonemoment/proto/zonemoment_api.go +++ b/api/proto/zonemoment/proto/zonemoment_api.go @@ -163,17 +163,3 @@ type ApiListStatisticsByCreaterMidResp struct { base.BaseResponse Data *ApiListStatisticsByCreaterMidData `json:"data"` } - -// op ids查询 -type ApiListByIdsReq struct { - base.BaseRequest - Ids []int64 `json:"ids"` -} - -type ApiListByIdsData struct { -} - -type ApiListByIdsResp struct { - base.BaseResponse - Data *ApiListByIdsData `json:"data"` -} diff --git a/app/mix/dao/mongo.go b/app/mix/dao/mongo.go index 27bad547..30eb7a88 100644 --- a/app/mix/dao/mongo.go +++ b/app/mix/dao/mongo.go @@ -5139,23 +5139,6 @@ func (m *Mongo) GetZidsByZoneMomentIds(ctx *gin.Context, zonemomentIds []int64) return zids, err } -func (m *Mongo) GetZoneMomentListByIds(ctx *gin.Context, ids []int64) ([]*dbstruct.ZoneMoment, error) { - list := make([]*dbstruct.ZoneMoment, 0) - col := m.getColZoneMoment() - query := qmgo.M{ - "_id": qmgo.M{ - "$in": ids, - }, - "del_flag": 0, - } - err := col.Find(ctx, query).All(&list) - if err == qmgo.ErrNoSuchDocuments { - err = nil - return make([]*dbstruct.ZoneMoment, 0), err - } - return list, err -} - func (m *Mongo) HeadZoneMomentByIds(ctx *gin.Context, ids []int64, opType int64) error { col := m.getColZoneMoment() query := qmgo.M{ diff --git a/app/mix/service/apiservice.go b/app/mix/service/apiservice.go index cabbdac9..a8c46479 100644 --- a/app/mix/service/apiservice.go +++ b/app/mix/service/apiservice.go @@ -3433,63 +3433,6 @@ func (s *Service) ApiGetZoneMomentListByZid(ctx *gin.Context, req *zonemomentpro return } -func (s *Service) ApiGetZoneMomentListByIds(ctx *gin.Context, req *zonemomentproto.ApiListByIdsReq) (volist []*zonemomentproto.ApiZoneMomentVO, ec errcode.ErrCode) { - ec = errcode.ErrCodeZoneMomentSrvOk - - // 1.查询该用户解锁的空间 - zidZuMap, err := _DefaultVas.GetZoneUnlockMapByMid(ctx, req.BaseRequest.Mid) - if err != nil { - logger.Error("GetZoneUnlockMapByMid fail, req: %v, err: %v", util.ToJson(req), err) - ec = errcode.ErrCodeZoneSrvFail - return - } - - // 2.查询访客创建的空间 - zoneMap, err := _DefaultZone.GetZoneMapByMids(ctx, []int64{req.BaseRequest.Mid}) - if err != nil { - logger.Error("_DefaultZone GetZoneMapByMids fail, req: %v, err: %v", util.ToJson(req), err) - ec = errcode.ErrCodeZoneSrvFail - return - } - zones := zoneMap[req.BaseRequest.Mid] - zoneZidMap := make(map[int64]*dbstruct.Zone, 0) - for _, zone := range zones { - zoneZidMap[zone.GetId()] = zone - } - - // 3.通过ids查询得到这一轮动态基底 - list, err := _DefaultZoneMoment.GetByIds(ctx, req.Ids) - if err != nil { - logger.Error("ApiGetZoneMomentListByIds fail, req: %v, err: %v", util.ToJson(req), err) - ec = errcode.ErrCodeZoneMomentSrvFail - return - } - - // 4.依次验证访问人是否有资格访问该条动态 - if !IsZoneVIP(req.BaseRequest.Mid) { // 空间vip放行 - for _, zonemoment := range list { - if zoneZidMap[zonemoment.GetZid()] != nil { // 空间创建人放行 - continue - } - if zidZuMap[zonemoment.GetZid()] == nil { // 未解锁该空间则不允许该轮查询 - logger.Error("Visitor has not unlocked this zone, req: %v, err: %v", util.ToJson(req), err) - ec = errcode.ErrCodeUnlockedZone - return - } - } - } - - // 5.初始化返回的volist,获取mids,并将动态基底填充进去 - volist, err = s.utilFillZoneMomentsWithApiVOInfo(ctx, list, req.BaseRequest.Mid, zidZuMap) - if err != nil { - logger.Error("utilFillZoneMomentsWithApiVOInfo fail, req: %v, err: %v", util.ToJson(req), err) - ec = errcode.ErrCodeZoneMomentSrvFail - return - } - - return -} - func (s *Service) ApiGetZoneMomentListByCreaterMid(ctx *gin.Context, req *zonemomentproto.ApiListByCreaterMidReq) (volist []*zonemomentproto.ApiZoneMomentVO, ec errcode.ErrCode) { ec = errcode.ErrCodeZoneMomentSrvOk diff --git a/app/mix/service/logic/vas.go b/app/mix/service/logic/vas.go index 2fefa5ae..becabf4e 100644 --- a/app/mix/service/logic/vas.go +++ b/app/mix/service/logic/vas.go @@ -1735,7 +1735,7 @@ func (v *Vas) PayCallback(ctx *gin.Context, p *vasproto.PayCallbackParamIn) erro logger.Error("UnlockMembership fail, order: %v, err: %v", util.ToJson(order), err) return err } - v.notifBuilderHandler.Handle(ctx, consts.SysNotifTemp_MembershipPurchased) + v.notifBuilderHandler.Handle(ctx)(consts.SysNotifTemp_MembershipPurchased)() case product.Id == dbstruct.ProductIdH5ZoneMoment: err = v.UnlockZoneMoment(ctx, tx, order) if err != nil { diff --git a/app/mix/service/logic/zonemoment.go b/app/mix/service/logic/zonemoment.go index 0f4a3d40..9810ef7c 100644 --- a/app/mix/service/logic/zonemoment.go +++ b/app/mix/service/logic/zonemoment.go @@ -198,12 +198,3 @@ func (p *ZoneMoment) GetZoneMomentStatInfoList(ctx *gin.Context, st, et int64) ( return list, nil } - -func (p *ZoneMoment) GetByIds(ctx *gin.Context, ids []int64) ([]*dbstruct.ZoneMoment, error) { - list, err := p.store.GetZoneMomentListByIds(ctx, ids) - if err != nil { - logger.Error("GetZoneMomentListByIds fail, err: %v", err) - return nil, err - } - return list, err -}