From 099230a6ba35802df2d2248028246294b55f2dee Mon Sep 17 00:00:00 2001 From: Leufolium Date: Tue, 7 May 2024 16:33:55 +0800 Subject: [PATCH 1/8] by Robin at 20240507; is_hided for third partner --- app/mix/service/apiservice.go | 8 ++++++++ dbstruct/zone_third_partner.go | 8 ++++++++ 2 files changed, 16 insertions(+) diff --git a/app/mix/service/apiservice.go b/app/mix/service/apiservice.go index a42f6011..ecf18e41 100644 --- a/app/mix/service/apiservice.go +++ b/app/mix/service/apiservice.go @@ -3119,6 +3119,14 @@ func (s *Service) ApiGetZoneThirdPartnerList(ctx *gin.Context, req *zone_third_p vo = nil return } + if zoneThirdPartner.GetIsHided() == 1 { + 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/dbstruct/zone_third_partner.go b/dbstruct/zone_third_partner.go index 3e5cebcb..ce3467ca 100644 --- a/dbstruct/zone_third_partner.go +++ b/dbstruct/zone_third_partner.go @@ -5,6 +5,7 @@ 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"` // 删除标记 @@ -31,3 +32,10 @@ func (p *ZoneThirdPartner) GetSharingRatio() float64 { } return 0 } + +func (p *ZoneThirdPartner) GetIsHided() int64 { + if p != nil && p.IsHided != nil { + return *p.IsHided + } + return 0 +} -- 2.41.0 From 7b385f395d3ccae13c785a2a4f3bdf772aed1ae9 Mon Sep 17 00:00:00 2001 From: Leufolium Date: Tue, 7 May 2024 16:59:10 +0800 Subject: [PATCH 2/8] by Robin at 20240507; set is_hided for zone third partner --- .../proto/zone_third_partner_op.go | 17 ++++++- .../proto/zone_third_partner_vo_op.go | 11 +++++ app/mix/controller/init.go | 5 +++ app/mix/controller/zone_third_partner_op.go | 18 ++++++++ app/mix/dao/mongo.go | 15 +++++++ app/mix/service/logic/zone_third_partner.go | 9 ++++ app/mix/service/service.go | 44 ++++++++++++++++++- 7 files changed, 117 insertions(+), 2 deletions(-) create mode 100644 api/proto/zone_third_partner/proto/zone_third_partner_vo_op.go 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 3ac35472..1fd1e763 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 @@ -54,10 +54,25 @@ type OpListReq struct { } type OpListData struct { - ZoneThirdPartner *dbstruct.ZoneThirdPartner `json:"zone_third_partner"` + ZoneThirdPartner *ZoneThirdPartnerOpVO `json:"zone_third_partner"` } 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/api/proto/zone_third_partner/proto/zone_third_partner_vo_op.go b/api/proto/zone_third_partner/proto/zone_third_partner_vo_op.go new file mode 100644 index 00000000..15fdfc91 --- /dev/null +++ b/api/proto/zone_third_partner/proto/zone_third_partner_vo_op.go @@ -0,0 +1,11 @@ +package proto + +import ( + accountproto "service/api/proto/account/proto" + "service/dbstruct" +) + +type ZoneThirdPartnerOpVO struct { + *dbstruct.ZoneThirdPartner + Account *accountproto.OpListOthersVO `json:"third_partner_account"` +} diff --git a/app/mix/controller/init.go b/app/mix/controller/init.go index d8e69e82..a6afaa6d 100644 --- a/app/mix/controller/init.go +++ b/app/mix/controller/init.go @@ -515,6 +515,11 @@ func Init(r *gin.Engine) { opZoneMomentGroup.POST("head", middleware.JSONParamValidator(zonemomentproto.OpHeadReq{}), middleware.JwtAuthenticator(), OpHeadZoneMoment) opZoneMomentGroup.POST("set_private", middleware.JSONParamValidator(zonemomentproto.OpSetPrivateReq{}), middleware.JwtAuthenticator(), OpSetPrivateZoneMoment) + // 空间代运营表 + opZoneThirdPartnerGroup := r.Group("/op/zone_third_partner", PrepareOp()) + apiZoneThirdPartnerGroup.POST("set_is_hided", middleware.JSONParamValidator(zone_third_partner_proto.OpSetIsHidedReq{}), middleware.JwtAuthenticator(), OpSetIsHidedZoneThirdPartner) + opZoneThirdPartnerGroup.POST("list", middleware.JSONParamValidator(zone_third_partner_proto.ApiListReq{}), middleware.JwtAuthenticator(), OpGetZoneThirdPartnerList) + // 视频审核callback extVideoModerationGroup := r.Group("/ext/video_moderation") extVideoModerationGroup.POST("callback", middleware.FORMParamValidator(video_moderation_proto.ExtVideoModerationReq{}), VideoModerationCallback) diff --git a/app/mix/controller/zone_third_partner_op.go b/app/mix/controller/zone_third_partner_op.go index 01fb8f3c..ffdb6c13 100644 --- a/app/mix/controller/zone_third_partner_op.go +++ b/app/mix/controller/zone_third_partner_op.go @@ -6,6 +6,7 @@ import ( "service/app/mix/service" "service/bizcommon/util" "service/library/logger" + "service/library/mediafiller" "github.com/gin-gonic/gin" ) @@ -56,8 +57,25 @@ func OpGetZoneThirdPartnerList(ctx *gin.Context) { return } + //填充媒体切片 + if zoneThirdPartner != nil && zoneThirdPartner.Account != nil && zoneThirdPartner.Account.Avatar != nil { + mediafiller.FillEntity(ctx, zoneThirdPartner.Account.Avatar) + } + data := &zone_third_partnerproto.OpListData{ ZoneThirdPartner: zoneThirdPartner, } 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 607dae7c..c16183f5 100644 --- a/app/mix/dao/mongo.go +++ b/app/mix/dao/mongo.go @@ -4795,6 +4795,21 @@ 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/logic/zone_third_partner.go b/app/mix/service/logic/zone_third_partner.go index 1e425364..64072f13 100644 --- a/app/mix/service/logic/zone_third_partner.go +++ b/app/mix/service/logic/zone_third_partner.go @@ -137,3 +137,12 @@ 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 6d974ba4..68ec43b2 100644 --- a/app/mix/service/service.go +++ b/app/mix/service/service.go @@ -3803,7 +3803,7 @@ func (s *Service) OpDeleteZoneThirdPartner(ctx *gin.Context, id int64) (ec errco return } -func (s *Service) OpGetZoneThirdPartnerList(ctx *gin.Context, req *zone_third_partner_proto.OpListReq) (zoneThirdPartner *dbstruct.ZoneThirdPartner, ec errcode.ErrCode) { +func (s *Service) OpGetZoneThirdPartnerList(ctx *gin.Context, req *zone_third_partner_proto.OpListReq) (vo *zone_third_partner_proto.ZoneThirdPartnerOpVO, ec errcode.ErrCode) { ec = errcode.ErrCodeZoneThirdPartnerSrvOk zoneThirdPartner, err := _DefaultZoneThirdPartner.OpList(ctx, req) if err != nil { @@ -3811,6 +3811,48 @@ func (s *Service) OpGetZoneThirdPartnerList(ctx *gin.Context, req *zone_third_pa ec = errcode.ErrCodeZoneThirdPartnerSrvFail return } + if zoneThirdPartner == nil { + vo = nil + return + } + + acct, err := _DefaultAccount.OpListByMid(ctx, &accountproto.OpListByMidReq{ + Mid: zoneThirdPartner.ThirdPartnerMid, + }) + if err != nil { + logger.Error("_DefaultAccount OpListByMid fail, req: %v, err: %v", util.ToJson(req), err) + ec = errcode.ErrCodeAccountSrvFail + return + } + if acct == nil { + logger.Error("No account entity was found, req: %v", util.ToJson(req)) + ec = errcode.ErrCodeAccountNotExist + return + } + acctVO := &accountproto.OpListOthersVO{} + acctVO.CopyAccount(acct) + + vo = &zone_third_partner_proto.ZoneThirdPartnerOpVO{ + ZoneThirdPartner: zoneThirdPartner, + Account: acctVO, + } + + 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 } -- 2.41.0 From 1a2646976047d6df288c67fcbadc701d232862f8 Mon Sep 17 00:00:00 2001 From: Leufolium Date: Wed, 8 May 2024 20:49:11 +0800 Subject: [PATCH 3/8] by Robin at 20240508 --- app/mix/service/apiservice.go | 2 ++ app/mix/service/service.go | 1 + 2 files changed, 3 insertions(+) diff --git a/app/mix/service/apiservice.go b/app/mix/service/apiservice.go index ecf18e41..860fdffb 100644 --- a/app/mix/service/apiservice.go +++ b/app/mix/service/apiservice.go @@ -3148,6 +3148,7 @@ func (s *Service) ApiGetZoneThirdPartnerList(ctx *gin.Context, req *zone_third_p ZoneThirdPartner: zoneThirdPartner, Account: acctVO, } + vo.ZoneThirdPartner.IsHided = goproto.Int64(vo.ZoneThirdPartner.GetIsHided()) return } @@ -3293,6 +3294,7 @@ func (s *Service) ApiGetZoneCollaboratorList(ctx *gin.Context, req *zone_collabo ZoneThirdPartner: zoneThirdPartner, Account: acctVO, } + ztpVO.ZoneThirdPartner.IsHided = goproto.Int64(ztpVO.ZoneThirdPartner.GetIsHided()) return } diff --git a/app/mix/service/service.go b/app/mix/service/service.go index 68ec43b2..2e9ed387 100644 --- a/app/mix/service/service.go +++ b/app/mix/service/service.go @@ -3836,6 +3836,7 @@ func (s *Service) OpGetZoneThirdPartnerList(ctx *gin.Context, req *zone_third_pa ZoneThirdPartner: zoneThirdPartner, Account: acctVO, } + vo.ZoneThirdPartner.IsHided = goproto.Int64(vo.ZoneThirdPartner.GetIsHided()) return } -- 2.41.0 From 4dc685088313f019f93c4382775f192ea9efe6b0 Mon Sep 17 00:00:00 2001 From: Leufolium Date: Wed, 8 May 2024 22:53:24 +0800 Subject: [PATCH 4/8] by Robin at 20240508 --- app/mix/service/apiservice.go | 2 -- app/mix/service/logic/zone_third_partner.go | 1 + app/mix/service/service.go | 1 - 3 files changed, 1 insertion(+), 3 deletions(-) diff --git a/app/mix/service/apiservice.go b/app/mix/service/apiservice.go index 860fdffb..ecf18e41 100644 --- a/app/mix/service/apiservice.go +++ b/app/mix/service/apiservice.go @@ -3148,7 +3148,6 @@ func (s *Service) ApiGetZoneThirdPartnerList(ctx *gin.Context, req *zone_third_p ZoneThirdPartner: zoneThirdPartner, Account: acctVO, } - vo.ZoneThirdPartner.IsHided = goproto.Int64(vo.ZoneThirdPartner.GetIsHided()) return } @@ -3294,7 +3293,6 @@ func (s *Service) ApiGetZoneCollaboratorList(ctx *gin.Context, req *zone_collabo ZoneThirdPartner: zoneThirdPartner, Account: acctVO, } - ztpVO.ZoneThirdPartner.IsHided = goproto.Int64(ztpVO.ZoneThirdPartner.GetIsHided()) return } diff --git a/app/mix/service/logic/zone_third_partner.go b/app/mix/service/logic/zone_third_partner.go index 64072f13..52a1a769 100644 --- a/app/mix/service/logic/zone_third_partner.go +++ b/app/mix/service/logic/zone_third_partner.go @@ -31,6 +31,7 @@ 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(0) err := p.store.CreateZoneThirdPartner(ctx, req.ZoneThirdPartner) if err != nil { logger.Error("CreateZoneThirdPartner fail, err: %v", err) diff --git a/app/mix/service/service.go b/app/mix/service/service.go index 2e9ed387..68ec43b2 100644 --- a/app/mix/service/service.go +++ b/app/mix/service/service.go @@ -3836,7 +3836,6 @@ func (s *Service) OpGetZoneThirdPartnerList(ctx *gin.Context, req *zone_third_pa ZoneThirdPartner: zoneThirdPartner, Account: acctVO, } - vo.ZoneThirdPartner.IsHided = goproto.Int64(vo.ZoneThirdPartner.GetIsHided()) return } -- 2.41.0 From cb773295f4dd4af6ba17de738a68bbf316bf1907 Mon Sep 17 00:00:00 2001 From: Leufolium Date: Wed, 8 May 2024 22:54:05 +0800 Subject: [PATCH 5/8] t --- app/mix/service/logic/zone_third_partner.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/mix/service/logic/zone_third_partner.go b/app/mix/service/logic/zone_third_partner.go index 52a1a769..fd1dbdee 100644 --- a/app/mix/service/logic/zone_third_partner.go +++ b/app/mix/service/logic/zone_third_partner.go @@ -31,7 +31,7 @@ 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(0) + //req.ZoneThirdPartner.IsHided = goproto.Int64(0) err := p.store.CreateZoneThirdPartner(ctx, req.ZoneThirdPartner) if err != nil { logger.Error("CreateZoneThirdPartner fail, err: %v", err) -- 2.41.0 From 0614fd84e20c16dece7941ff71ae35c81d1d8073 Mon Sep 17 00:00:00 2001 From: Leufolium Date: Wed, 8 May 2024 22:55:15 +0800 Subject: [PATCH 6/8] by Robin at 20240508 --- api/consts/status.go | 6 ++++++ app/mix/service/apiservice.go | 2 +- app/mix/service/logic/zone_third_partner.go | 2 +- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/api/consts/status.go b/api/consts/status.go index 6e780f28..775fa89c 100644 --- a/api/consts/status.go +++ b/api/consts/status.go @@ -232,6 +232,12 @@ const ( IsHeaded_Yes = 1 //是 ) +// 是否隐藏 +const ( + IsHided_No = 0 //否 + IsHided_Yes = 1 //是 +) + // 从未更新的时间跨度 const ( DaysElapsedSinceTheLastZonesUpdate_Never = -1 diff --git a/app/mix/service/apiservice.go b/app/mix/service/apiservice.go index ecf18e41..7733b19a 100644 --- a/app/mix/service/apiservice.go +++ b/app/mix/service/apiservice.go @@ -3119,7 +3119,7 @@ func (s *Service) ApiGetZoneThirdPartnerList(ctx *gin.Context, req *zone_third_p vo = nil return } - if zoneThirdPartner.GetIsHided() == 1 { + if zoneThirdPartner.GetIsHided() == consts.IsHided_Yes { zoneThirdPartner.ThirdPartnerMid = nil zoneThirdPartner.SharingRatio = nil vo = &zone_third_partner_proto.ZoneThirdPartnerApiVO{ diff --git a/app/mix/service/logic/zone_third_partner.go b/app/mix/service/logic/zone_third_partner.go index fd1dbdee..27df2cca 100644 --- a/app/mix/service/logic/zone_third_partner.go +++ b/app/mix/service/logic/zone_third_partner.go @@ -31,7 +31,7 @@ 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(0) + 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) -- 2.41.0 From 77efdcc607682dac309ddd022f1e5e34eab0a1e1 Mon Sep 17 00:00:00 2001 From: Leufolium Date: Fri, 10 May 2024 22:35:27 +0800 Subject: [PATCH 7/8] by Robin at 20240510 --- app/mix/controller/init.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/mix/controller/init.go b/app/mix/controller/init.go index a6afaa6d..4b673027 100644 --- a/app/mix/controller/init.go +++ b/app/mix/controller/init.go @@ -517,7 +517,7 @@ func Init(r *gin.Engine) { // 空间代运营表 opZoneThirdPartnerGroup := r.Group("/op/zone_third_partner", PrepareOp()) - apiZoneThirdPartnerGroup.POST("set_is_hided", middleware.JSONParamValidator(zone_third_partner_proto.OpSetIsHidedReq{}), middleware.JwtAuthenticator(), OpSetIsHidedZoneThirdPartner) + opZoneThirdPartnerGroup.POST("set_is_hided", middleware.JSONParamValidator(zone_third_partner_proto.OpSetIsHidedReq{}), middleware.JwtAuthenticator(), OpSetIsHidedZoneThirdPartner) opZoneThirdPartnerGroup.POST("list", middleware.JSONParamValidator(zone_third_partner_proto.ApiListReq{}), middleware.JwtAuthenticator(), OpGetZoneThirdPartnerList) // 视频审核callback -- 2.41.0 From f7f6535cc0bec752f555dfea87c4e6d976f03cca Mon Sep 17 00:00:00 2001 From: Leufolium Date: Sat, 11 May 2024 18:22:17 +0800 Subject: [PATCH 8/8] by Robin at 20240511 --- .../zone_third_partner/proto/not_null_def_op.go | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 api/proto/zone_third_partner/proto/not_null_def_op.go diff --git a/api/proto/zone_third_partner/proto/not_null_def_op.go b/api/proto/zone_third_partner/proto/not_null_def_op.go new file mode 100644 index 00000000..50cb14f4 --- /dev/null +++ b/api/proto/zone_third_partner/proto/not_null_def_op.go @@ -0,0 +1,13 @@ +package proto + +import ( + "service/library/validator" +) + +func (p *OpSetIsHidedReq) ProvideNotNullValue() (params []*validator.JsonParam) { + params = make([]*validator.JsonParam, 0) + + params = append(params, validator.NewInt64PtrParam("请填写空间id!", p.Zid)) + params = append(params, validator.NewInt64PtrParam("请填写是否隐藏!", p.IsHided)) + return +} -- 2.41.0