Merge pull request 'by Robin at 20240422' (#312) from dev-feat-IRONFANS-70-Robin into feat-IRONFANS-70

Reviewed-on: http://121.41.31.146:3000/wishpal_ironfan/service/pulls/312
This commit is contained in:
chenhao 2024-04-22 18:20:36 +08:00
commit 796e09af2f
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"
)
@ -58,7 +59,7 @@ type ApiListReq struct {
type ApiListData struct {
List []*ZoneCollaboratorApiVO `json:"list"`
ZoneThirdPartner *dbstruct.ZoneThirdPartner `json:"zone_third_partner"`
ZoneThirdPartnerVO *zone_third_partner_proto.ZoneThirdPartnerApiVO `json:"zone_third_partner"`
Offset int `json:"offset"`
More int `json:"more"`
}

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)
@ -72,7 +72,7 @@ func ApiGetZoneCollaboratorList(ctx *gin.Context) {
data := &zone_collaborator_proto.ApiListData{
List: list,
ZoneThirdPartner: zoneThirdPartner,
ZoneThirdPartnerVO: ztpVO,
Offset: req.Offset + len(list),
}
if len(list) >= req.Limit {

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
}