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" "service/library/mediafiller" "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) ec := service.DefaultService.OpDeleteZoneThirdPartner(ctx, util.DerefInt64(req.Zid)) 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 } //填充媒体切片 if zoneThirdPartner != nil && zoneThirdPartner.Account != nil && zoneThirdPartner.Account.Avatar != nil { mediafiller.FillEntity(ctx, zoneThirdPartner.Account.Avatar) } data := &zone_third_partnerproto.OpListData{ ZoneThirdPartner: zoneThirdPartner, } ReplyOk(ctx, data) }