Merge pull request 'feat-IRONFANS-70' (#313) from feat-IRONFANS-70 into test

Reviewed-on: http://121.41.31.146:3000/wishpal_ironfan/service/pulls/313
This commit is contained in:
chenhao 2024-04-22 18:20:47 +08:00
commit 3a3448e873
3 changed files with 36 additions and 11 deletions

View File

@ -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 {

View File

@ -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

View File

@ -3086,7 +3086,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
// 查询协作者表
@ -3132,12 +3132,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
}