70 lines
2.2 KiB
Go
70 lines
2.2 KiB
Go
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)
|
|
ReplyErrorMsg(ctx, "server error")
|
|
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
|
|
}
|
|
|
|
//填充媒体切片
|
|
if zoneThirdPartner != nil && zoneThirdPartner.Account != nil && zoneThirdPartner.Account.Avatar != nil {
|
|
mediafiller.FillEntity(ctx, zoneThirdPartner.Account.Avatar)
|
|
}
|
|
|
|
data := &zone_third_partner_proto.ApiListData{
|
|
ZoneThirdPartner: zoneThirdPartner,
|
|
}
|
|
ReplyOk(ctx, data)
|
|
}
|