diff --git a/api/proto/zone_collaborator/proto/zone_collaborator_api.go b/api/proto/zone_collaborator/proto/zone_collaborator_api.go index 0ba21ff9..eb6905ee 100644 --- a/api/proto/zone_collaborator/proto/zone_collaborator_api.go +++ b/api/proto/zone_collaborator/proto/zone_collaborator_api.go @@ -2,6 +2,7 @@ package proto import ( "service/api/base" + zone_third_partner_proto "service/api/proto/zone_third_partner/proto" "service/dbstruct" ) @@ -57,10 +58,10 @@ type ApiListReq struct { } type ApiListData struct { - List []*ZoneCollaboratorApiVO `json:"list"` - ZoneThirdPartner *dbstruct.ZoneThirdPartner `json:"zone_third_partner"` - Offset int `json:"offset"` - More int `json:"more"` + List []*ZoneCollaboratorApiVO `json:"list"` + ZoneThirdPartnerVO *zone_third_partner_proto.ZoneThirdPartnerApiVO `json:"zone_third_partner"` + Offset int `json:"offset"` + More int `json:"more"` } type ApiListResp struct { diff --git a/app/mix/controller/zone_collaborator_api.go b/app/mix/controller/zone_collaborator_api.go index c67f2b68..db01d079 100644 --- a/app/mix/controller/zone_collaborator_api.go +++ b/app/mix/controller/zone_collaborator_api.go @@ -17,7 +17,7 @@ func ApiCreateZoneCollaborator(ctx *gin.Context) { ec := service.DefaultService.ApiCreateZoneCollaborator(ctx, req) if ec != errcode.ErrCodeZoneCollaboratorSrvOk { logger.Error("ApiCreateZoneCollaborator fail, req: %v, ec: %v", util.ToJson(req), ec) - ReplyErrorMsg(ctx, "server error") + ReplyErrCodeMsg(ctx, ec) return } @@ -56,7 +56,7 @@ func ApiGetZoneCollaboratorList(ctx *gin.Context) { req.Limit = consts.DefaultPageSize } - list, zoneThirdPartner, ec := service.DefaultService.ApiGetZoneCollaboratorList(ctx, req) + list, ztpVO, ec := service.DefaultService.ApiGetZoneCollaboratorList(ctx, req) if ec != errcode.ErrCodeZoneCollaboratorSrvOk { logger.Error("ApiGetZoneCollaboratorList fail, req: %v, ec: %v", util.ToJson(req), ec) ReplyErrCodeMsg(ctx, ec) @@ -71,9 +71,9 @@ func ApiGetZoneCollaboratorList(ctx *gin.Context) { mediafiller.FillList(ctx, mediaFillableList) data := &zone_collaborator_proto.ApiListData{ - List: list, - ZoneThirdPartner: zoneThirdPartner, - Offset: req.Offset + len(list), + List: list, + ZoneThirdPartnerVO: ztpVO, + Offset: req.Offset + len(list), } if len(list) >= req.Limit { data.More = 1 diff --git a/app/mix/service/apiservice.go b/app/mix/service/apiservice.go index f12e76b3..21925810 100644 --- a/app/mix/service/apiservice.go +++ b/app/mix/service/apiservice.go @@ -3034,7 +3034,7 @@ func (s *Service) ApiDeleteZoneCollaborator(ctx *gin.Context, id int64) (ec errc return } -func (s *Service) ApiGetZoneCollaboratorList(ctx *gin.Context, req *zone_collaborator_proto.ApiListReq) (volist []*zone_collaborator_proto.ZoneCollaboratorApiVO, zoneThirdPartner *dbstruct.ZoneThirdPartner, ec errcode.ErrCode) { +func (s *Service) ApiGetZoneCollaboratorList(ctx *gin.Context, req *zone_collaborator_proto.ApiListReq) (volist []*zone_collaborator_proto.ZoneCollaboratorApiVO, ztpVO *zone_third_partner_proto.ZoneThirdPartnerApiVO, ec errcode.ErrCode) { ec = errcode.ErrCodeZoneCollaboratorSrvOk // 查询协作者表 @@ -3080,12 +3080,36 @@ func (s *Service) ApiGetZoneCollaboratorList(ctx *gin.Context, req *zone_collabo } // 查询代运营信息 - zoneThirdPartner, err = _DefaultZoneThirdPartner.GetZoneThirdPartnerByZid(ctx, util.DerefInt64(req.Zid)) + zoneThirdPartner, err := _DefaultZoneThirdPartner.GetZoneThirdPartnerByZid(ctx, util.DerefInt64(req.Zid)) if err != nil { logger.Error("_DefaultZoneThirdPartner GetZoneThirdPartnerByZid fail, req: %v, err: %v", util.ToJson(req), err) ec = errcode.ErrCodeZoneThirdPartnerSrvFail return } + if zoneThirdPartner == nil { + logger.Error("No zone third partner was found, req: %v", util.ToJson(req)) + ec = errcode.ErrCodeZoneThirdPartnerNotExist + return + } + + account, 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 account == nil { + logger.Error("No account entity was found, req: %v", util.ToJson(req)) + ec = errcode.ErrCodeAccountNotExist + return + } + + ztpVO = &zone_third_partner_proto.ZoneThirdPartnerApiVO{ + ZoneThirdPartner: zoneThirdPartner, + Account: account, + } return }