by Robin at 20240521

This commit is contained in:
Leufolium 2024-05-21 18:26:30 +08:00
parent cee2242bc8
commit 169a34247f
4 changed files with 46 additions and 2 deletions

View File

@ -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 {

View File

@ -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"`
}

View File

@ -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)

View File

@ -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
}