2024-04-08 20:05:13 +08:00
|
|
|
package controller
|
|
|
|
|
|
|
|
import (
|
|
|
|
"service/api/errcode"
|
|
|
|
zone_third_partnerproto "service/api/proto/zone_third_partner/proto"
|
|
|
|
"service/app/mix/service"
|
|
|
|
"service/bizcommon/util"
|
|
|
|
"service/library/logger"
|
2024-05-07 16:59:10 +08:00
|
|
|
"service/library/mediafiller"
|
2024-04-08 20:05:13 +08:00
|
|
|
|
|
|
|
"github.com/gin-gonic/gin"
|
|
|
|
)
|
|
|
|
|
|
|
|
func OpCreateZoneThirdPartner(ctx *gin.Context) {
|
|
|
|
req := ctx.MustGet("client_req").(*zone_third_partnerproto.OpCreateReq)
|
|
|
|
ec := service.DefaultService.OpCreateZoneThirdPartner(ctx, req)
|
|
|
|
if ec != errcode.ErrCodeZoneThirdPartnerSrvOk {
|
|
|
|
logger.Error("OpCreateZoneThirdPartner fail, req: %v, ec: %v", util.ToJson(req), ec)
|
|
|
|
ReplyErrorMsg(ctx, "server error")
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
|
|
|
ReplyOk(ctx, nil)
|
|
|
|
}
|
|
|
|
|
|
|
|
func OpUpdateZoneThirdPartner(ctx *gin.Context) {
|
|
|
|
req := ctx.MustGet("client_req").(*zone_third_partnerproto.OpUpdateReq)
|
|
|
|
ec := service.DefaultService.OpUpdateZoneThirdPartner(ctx, req)
|
|
|
|
if ec != errcode.ErrCodeZoneThirdPartnerSrvOk {
|
|
|
|
logger.Error("OpUpdateZoneThirdPartner fail, req: %v, ec: %v", util.ToJson(req), ec)
|
|
|
|
ReplyErrCodeMsg(ctx, ec)
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
|
|
|
ReplyOk(ctx, nil)
|
|
|
|
}
|
|
|
|
|
|
|
|
func OpDeleteZoneThirdPartner(ctx *gin.Context) {
|
|
|
|
req := ctx.MustGet("client_req").(*zone_third_partnerproto.OpDeleteReq)
|
2024-05-21 23:06:30 +08:00
|
|
|
ec := service.DefaultService.OpDeleteZoneThirdPartner(ctx, util.DerefInt64(req.Zid))
|
2024-04-08 20:05:13 +08:00
|
|
|
if ec != errcode.ErrCodeZoneThirdPartnerSrvOk {
|
|
|
|
logger.Error("OpDeleteZoneThirdPartner fail, req: %v, ec: %v", util.ToJson(req), ec)
|
|
|
|
ReplyErrCodeMsg(ctx, ec)
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
|
|
|
ReplyOk(ctx, nil)
|
|
|
|
}
|
|
|
|
|
|
|
|
func OpGetZoneThirdPartnerList(ctx *gin.Context) {
|
|
|
|
req := ctx.MustGet("client_req").(*zone_third_partnerproto.OpListReq)
|
|
|
|
|
|
|
|
zoneThirdPartner, ec := service.DefaultService.OpGetZoneThirdPartnerList(ctx, req)
|
|
|
|
if ec != errcode.ErrCodeZoneThirdPartnerSrvOk {
|
|
|
|
logger.Error("OpGetZoneThirdPartnerList fail, req: %v, ec: %v", util.ToJson(req), ec)
|
|
|
|
ReplyErrCodeMsg(ctx, ec)
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
2024-05-07 16:59:10 +08:00
|
|
|
//填充媒体切片
|
|
|
|
if zoneThirdPartner != nil && zoneThirdPartner.Account != nil && zoneThirdPartner.Account.Avatar != nil {
|
|
|
|
mediafiller.FillEntity(ctx, zoneThirdPartner.Account.Avatar)
|
|
|
|
}
|
|
|
|
|
2024-04-08 20:05:13 +08:00
|
|
|
data := &zone_third_partnerproto.OpListData{
|
|
|
|
ZoneThirdPartner: zoneThirdPartner,
|
|
|
|
}
|
|
|
|
ReplyOk(ctx, data)
|
|
|
|
}
|