service/app/mix/controller/zone_third_partner_api.go

70 lines
2.1 KiB
Go
Raw Normal View History

2024-04-08 20:05:13 +08:00
package controller
import (
"service/api/errcode"
zone_third_partner_proto "service/api/proto/zone_third_partner/proto"
"service/app/mix/service"
"service/bizcommon/util"
"service/library/logger"
"service/library/mediafiller"
"github.com/gin-gonic/gin"
)
func ApiCreateZoneThirdPartner(ctx *gin.Context) {
req := ctx.MustGet("client_req").(*zone_third_partner_proto.ApiCreateReq)
ec := service.DefaultService.ApiCreateZoneThirdPartner(ctx, req)
if ec != errcode.ErrCodeZoneThirdPartnerSrvOk {
logger.Error("ApiCreateZoneThirdPartner fail, req: %v, ec: %v", util.ToJson(req), ec)
2024-04-12 23:05:46 +08:00
ReplyErrCodeMsg(ctx, ec)
2024-04-08 20:05:13 +08:00
return
}
ReplyOk(ctx, nil)
}
// func ApiUpdateZoneThirdPartner(ctx *gin.Context) {
// req := ctx.MustGet("client_req").(*zone_third_partner_proto.ApiUpdateReq)
// ec := service.DefaultService.ApiUpdateZoneThirdPartner(ctx, req)
// if ec != errcode.ErrCodeZoneThirdPartnerSrvOk {
// logger.Error("ApiUpdateZoneThirdPartner fail, req: %v, ec: %v", util.ToJson(req), ec)
// ReplyErrCodeMsg(ctx, ec)
// return
// }
// ReplyOk(ctx, nil)
// }
// func ApiDeleteZoneThirdPartner(ctx *gin.Context) {
// req := ctx.MustGet("client_req").(*zone_third_partner_proto.ApiDeleteReq)
// ec := service.DefaultService.ApiDeleteZoneThirdPartner(ctx, req.Id)
// if ec != errcode.ErrCodeZoneThirdPartnerSrvOk {
// logger.Error("ApiDeleteZoneThirdPartner fail, req: %v, ec: %v", util.ToJson(req), ec)
// ReplyErrCodeMsg(ctx, ec)
// return
// }
// ReplyOk(ctx, nil)
// }
func ApiGetZoneThirdPartnerList(ctx *gin.Context) {
req := ctx.MustGet("client_req").(*zone_third_partner_proto.ApiListReq)
zoneThirdPartner, ec := service.DefaultService.ApiGetZoneThirdPartnerList(ctx, req)
if ec != errcode.ErrCodeZoneThirdPartnerSrvOk {
logger.Error("ApiGetZoneThirdPartnerList fail, req: %v, ec: %v", util.ToJson(req), ec)
ReplyErrCodeMsg(ctx, ec)
return
}
//填充媒体切片
2024-04-11 14:40:18 +08:00
if zoneThirdPartner != nil && zoneThirdPartner.Account != nil && zoneThirdPartner.Account.Avatar != nil {
2024-04-11 14:37:45 +08:00
mediafiller.FillEntity(ctx, zoneThirdPartner.Account.Avatar)
}
2024-04-08 20:05:13 +08:00
data := &zone_third_partner_proto.ApiListData{
ZoneThirdPartner: zoneThirdPartner,
}
ReplyOk(ctx, data)
}