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 dec0c20b..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 @@ -54,7 +54,7 @@ type OpListReq struct { } type OpListData struct { - ZoneThirdPartner *dbstruct.ZoneThirdPartner `json:"zone_third_partner"` + ZoneThirdPartner *ZoneThirdPartnerOpVO `json:"zone_third_partner"` } type OpListResp struct { 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 280caffa..8064b4e6 100644 --- a/app/mix/controller/init.go +++ b/app/mix/controller/init.go @@ -513,6 +513,13 @@ 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()) + opZoneThirdPartnerGroup.POST("create", middleware.JSONParamValidator(zone_third_partner_proto.OpCreateReq{}), middleware.JwtAuthenticator(), OpCreateZoneThirdPartner) + opZoneThirdPartnerGroup.POST("update", middleware.JSONParamValidator(zone_third_partner_proto.OpUpdateReq{}), middleware.JwtAuthenticator(), OpUpdateZoneThirdPartner) + opZoneThirdPartnerGroup.POST("delete", middleware.JSONParamValidator(zone_third_partner_proto.OpDeleteReq{}), middleware.JwtAuthenticator(), OpDeleteZoneThirdPartner) + opZoneThirdPartnerGroup.POST("list", middleware.JSONParamValidator(zone_third_partner_proto.OpListReq{}), 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/service/service.go b/app/mix/service/service.go index bcbd0826..44fed35c 100644 --- a/app/mix/service/service.go +++ b/app/mix/service/service.go @@ -3835,7 +3835,7 @@ func (s *Service) OpDeleteZoneThirdPartner(ctx *gin.Context, zid int64) (ec errc 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 { @@ -3843,6 +3843,32 @@ 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 }