diff --git a/api/proto/zone_third_partner/proto/zone_third_partner_op.go b/api/proto/zone_third_partner/proto/zone_third_partner_op.go index 9469a773..736e6020 100644 --- a/api/proto/zone_third_partner/proto/zone_third_partner_op.go +++ b/api/proto/zone_third_partner/proto/zone_third_partner_op.go @@ -61,18 +61,3 @@ type OpListResp struct { base.BaseResponse Data *OpListData `json:"data"` } - -// op 更新 -type OpSetIsHidedReq struct { - base.BaseRequest - Zid *int64 `json:"zid"` - IsHided *int64 `json:"is_hided"` -} - -type OpSetIsHidedData struct { -} - -type OpSetIsHidedResp struct { - base.BaseResponse - Data *OpSetIsHidedData `json:"data"` -} diff --git a/app/mix/controller/zone_third_partner_op.go b/app/mix/controller/zone_third_partner_op.go index fbda455f..7947b0b8 100644 --- a/app/mix/controller/zone_third_partner_op.go +++ b/app/mix/controller/zone_third_partner_op.go @@ -67,15 +67,3 @@ func OpGetZoneThirdPartnerList(ctx *gin.Context) { } ReplyOk(ctx, data) } - -func OpSetIsHidedZoneThirdPartner(ctx *gin.Context) { - req := ctx.MustGet("client_req").(*zone_third_partnerproto.OpSetIsHidedReq) - ec := service.DefaultService.OpSetIsHidedZoneThirdPartner(ctx, req) - if ec != errcode.ErrCodeZoneThirdPartnerSrvOk { - logger.Error("OpSetIsHidedZoneThirdPartner fail, req: %v, ec: %v", util.ToJson(req), ec) - ReplyErrCodeMsg(ctx, ec) - return - } - - ReplyOk(ctx, nil) -} diff --git a/app/mix/dao/mongo.go b/app/mix/dao/mongo.go index 69dee067..0e763716 100644 --- a/app/mix/dao/mongo.go +++ b/app/mix/dao/mongo.go @@ -4743,21 +4743,6 @@ func (m *Mongo) GetZoneThirdPartnerById(ctx *gin.Context, id int64) (*dbstruct.Z return &one, err } -func (m *Mongo) SetIsHidedForZoneThirdPartner(ctx *gin.Context, req *zone_third_partner_proto.OpSetIsHidedReq) error { - col := m.getColZoneThirdPartner() - up := qmgo.M{ - "$set": qmgo.M{ - "is_hided": util.DerefInt64(req.IsHided), - "ut": time.Now().Unix(), - }, - } - filter := qmgo.M{ - "zid": util.DerefInt64(req.Zid), - } - err := col.UpdateOne(ctx, filter, up) - return err -} - func (m *Mongo) CreateZoneThirdPartnerHis(ctx *gin.Context, zone_third_partner *dbstruct.ZoneThirdPartner) error { col := m.getColZoneThirdPartnerHis() _, err := col.InsertOne(ctx, zone_third_partner) diff --git a/app/mix/service/apiservice.go b/app/mix/service/apiservice.go index 006e2454..f1179735 100644 --- a/app/mix/service/apiservice.go +++ b/app/mix/service/apiservice.go @@ -2116,6 +2116,7 @@ func (s *Service) ApiCreateZone(ctx *gin.Context, req *zoneproto.ApiCreateReq) ( req.Zone.ZoneMomentCount = goproto.Int64(0) req.Zone.ImageCount = goproto.Int64(0) req.Zone.VideoCount = goproto.Int64(0) + req.Zone.IsZoneThirdPartnerHided = goproto.Int64(consts.IsHided_No) err, zid := _DefaultZone.OpCreate(ctx, &zoneproto.OpCreateReq{ Zone: req.Zone, }) @@ -3036,6 +3037,29 @@ func (s *Service) ApiCreateZoneThirdPartner(ctx *gin.Context, req *zone_third_pa func (s *Service) ApiGetZoneThirdPartnerList(ctx *gin.Context, req *zone_third_partner_proto.ApiListReq) (vo *zone_third_partner_proto.ZoneThirdPartnerApiVO, ec errcode.ErrCode) { ec = errcode.ErrCodeZoneThirdPartnerSrvOk + + zone, err := _DefaultZone.GetById(ctx, util.DerefInt64(req.Zid)) + if err != nil { + logger.Error("_DefaultZone GetById fail, req: %v, err: %v", util.ToJson(req), err) + ec = errcode.ErrCodeZoneSrvFail + return + } + if zone == nil { + vo = nil + return + } + + if zone.GetIsZoneThirdPartnerHided() == consts.IsHided_Yes { + vo = &zone_third_partner_proto.ZoneThirdPartnerApiVO{ + ZoneThirdPartner: &dbstruct.ZoneThirdPartner{ + Zid: req.Zid, + ThirdPartnerMid: nil, + SharingRatio: nil, + }, + } + return + } + zoneThirdPartner, err := _DefaultZoneThirdPartner.OpList(ctx, &zone_third_partner_proto.OpListReq{ BaseRequest: req.BaseRequest, Zid: req.Zid, @@ -3049,14 +3073,6 @@ func (s *Service) ApiGetZoneThirdPartnerList(ctx *gin.Context, req *zone_third_p vo = nil return } - if zoneThirdPartner.GetIsHided() == consts.IsHided_Yes { - zoneThirdPartner.ThirdPartnerMid = nil - zoneThirdPartner.SharingRatio = nil - vo = &zone_third_partner_proto.ZoneThirdPartnerApiVO{ - ZoneThirdPartner: zoneThirdPartner, - } - return - } acct, err := _DefaultAccount.OpListByMid(ctx, &accountproto.OpListByMidReq{ Mid: zoneThirdPartner.ThirdPartnerMid, diff --git a/app/mix/service/logic/zone_third_partner.go b/app/mix/service/logic/zone_third_partner.go index 4bcad3d1..dd04baa1 100644 --- a/app/mix/service/logic/zone_third_partner.go +++ b/app/mix/service/logic/zone_third_partner.go @@ -31,7 +31,6 @@ func (p *ZoneThirdPartner) OpCreate(ctx *gin.Context, req *zone_third_partner_pr req.ZoneThirdPartner.Ct = goproto.Int64(time.Now().Unix()) req.ZoneThirdPartner.Ut = goproto.Int64(time.Now().Unix()) req.ZoneThirdPartner.DelFlag = goproto.Int64(consts.Exist) - req.ZoneThirdPartner.IsHided = goproto.Int64(consts.IsHided_No) err := p.store.CreateZoneThirdPartner(ctx, req.ZoneThirdPartner) if err != nil { logger.Error("CreateZoneThirdPartner fail, err: %v", err) @@ -139,12 +138,3 @@ func (p *ZoneThirdPartner) GetZoneThirdPartnerMapByZids(ctx *gin.Context, zids [ return mp, nil } - -func (p *ZoneThirdPartner) OpSetIsHided(ctx *gin.Context, req *zone_third_partner_proto.OpSetIsHidedReq) error { - err := p.store.SetIsHidedForZoneThirdPartner(ctx, req) - if err != nil { - logger.Error("SetIsHidedZoneThirdPartner fail, err: %v", err) - return err - } - return nil -} diff --git a/app/mix/service/service.go b/app/mix/service/service.go index 403e1dbd..a078fb68 100644 --- a/app/mix/service/service.go +++ b/app/mix/service/service.go @@ -3215,6 +3215,7 @@ func (s *Service) OpGetAccountCancellationList(ctx *gin.Context, req *account_ca // Zone func (s *Service) OpCreateZone(ctx *gin.Context, req *zoneproto.OpCreateReq) (ec errcode.ErrCode) { ec = errcode.ErrCodeZoneSrvOk + req.Zone.IsZoneThirdPartnerHided = goproto.Int64(consts.IsHided_No) err, _ := _DefaultZone.OpCreate(ctx, req) if err != nil { logger.Error("OpCreate fail, req: %v, err: %v", util.ToJson(req), err) @@ -3889,22 +3890,6 @@ func (s *Service) OpGetZoneThirdPartnerList(ctx *gin.Context, req *zone_third_pa return } -func (s *Service) OpSetIsHidedZoneThirdPartner(ctx *gin.Context, req *zone_third_partner_proto.OpSetIsHidedReq) (ec errcode.ErrCode) { - ec = errcode.ErrCodeZoneThirdPartnerSrvOk - err := _DefaultZoneThirdPartner.OpSetIsHided(ctx, req) - if err == qmgo.ErrNoSuchDocuments { - ec = errcode.ErrCodeZoneThirdPartnerNotExist - err = nil - return - } - if err != nil { - logger.Error("OpSetIsHided fail, req: %v, err: %v", util.ToJson(req), err) - ec = errcode.ErrCodeZoneThirdPartnerSrvFail - return - } - return -} - // ZoneCollaborator func (s *Service) OpCreateZoneCollaborator(ctx *gin.Context, req *zone_collaborator_proto.OpCreateReq) (ec errcode.ErrCode) { ec = errcode.ErrCodeZoneCollaboratorSrvOk diff --git a/dbstruct/zone.go b/dbstruct/zone.go index bcd64ca7..1b89ec0e 100644 --- a/dbstruct/zone.go +++ b/dbstruct/zone.go @@ -1,16 +1,17 @@ package dbstruct type Zone struct { - Id *int64 `json:"id" bson:"_id"` // 空间表id - Mid *int64 `json:"mid" bson:"mid"` // 用户表id - Profile *string `json:"profile" bson:"profile"` // 空间简介 - LastZoneMomentCt *int64 `json:"last_zone_moment_ct" bson:"last_zone_moment_ct"` // 最后空间动态创建时间 - ZoneMomentCount *int64 `json:"zone_moment_count" bson:"zone_moment_count"` // 空间内动态总数 - ImageCount *int64 `json:"image_count" bson:"image_count"` // 空间内图片总数 - VideoCount *int64 `json:"video_count" bson:"video_count"` // 空间内视频总数 - Ct *int64 `json:"ct" bson:"ct"` // 创建时间 - Ut *int64 `json:"ut" bson:"ut"` // 更新时间 - DelFlag *int64 `json:"del_flag" bson:"del_flag"` // 删除标记 + Id *int64 `json:"id" bson:"_id"` // 空间表id + Mid *int64 `json:"mid" bson:"mid"` // 用户表id + Profile *string `json:"profile" bson:"profile"` // 空间简介 + LastZoneMomentCt *int64 `json:"last_zone_moment_ct" bson:"last_zone_moment_ct"` // 最后空间动态创建时间 + ZoneMomentCount *int64 `json:"zone_moment_count" bson:"zone_moment_count"` // 空间内动态总数 + ImageCount *int64 `json:"image_count" bson:"image_count"` // 空间内图片总数 + VideoCount *int64 `json:"video_count" bson:"video_count"` // 空间内视频总数 + IsZoneThirdPartnerHided *int64 `json:"is_zone_third_partner_hided" bson:"is_zone_third_partner_hided"` // 是否隐藏空间代运营 + Ct *int64 `json:"ct" bson:"ct"` // 创建时间 + Ut *int64 `json:"ut" bson:"ut"` // 更新时间 + DelFlag *int64 `json:"del_flag" bson:"del_flag"` // 删除标记 } func (p *Zone) GetId() int64 { @@ -33,3 +34,10 @@ func (p *Zone) GetLastZoneMomentCt() int64 { } return 0 } + +func (p *Zone) GetIsZoneThirdPartnerHided() int64 { + if p != nil && p.IsZoneThirdPartnerHided != nil { + return *p.IsZoneThirdPartnerHided + } + return 0 +} diff --git a/dbstruct/zone_third_partner.go b/dbstruct/zone_third_partner.go index ce3467ca..3e5cebcb 100644 --- a/dbstruct/zone_third_partner.go +++ b/dbstruct/zone_third_partner.go @@ -5,7 +5,6 @@ type ZoneThirdPartner struct { Zid *int64 `json:"zid" bson:"zid"` // 空间id ThirdPartnerMid *int64 `json:"third_partner_mid" bson:"third_partner_mid"` // 代运营用户id SharingRatio *float64 `json:"sharing_ratio" bson:"sharing_ratio"` // 分成比例 - IsHided *int64 `json:"is_hided" bson:"is_hided"` // 是否隐藏 Ct *int64 `json:"ct" bson:"ct"` // 创建时间 Ut *int64 `json:"ut" bson:"ut"` // 更新时间 DelFlag *int64 `json:"del_flag" bson:"del_flag"` // 删除标记 @@ -32,10 +31,3 @@ func (p *ZoneThirdPartner) GetSharingRatio() float64 { } return 0 } - -func (p *ZoneThirdPartner) GetIsHided() int64 { - if p != nil && p.IsHided != nil { - return *p.IsHided - } - return 0 -}