Merge pull request 'feat-IRONFANS-192-Robin' (#685) from feat-IRONFANS-192-Robin into main
Reviewed-on: http://121.41.31.146:3000/wishpal_ironfan/service/pulls/685
This commit is contained in:
commit
f0fe54bc0e
|
@ -1402,13 +1402,18 @@ func (s *Service) OpHeadZoneMomentBusinessValidate(ctx *gin.Context, req *zonemo
|
||||||
func (s *Service) OpUpdateZoneThirdPartnerBusinessValidate(ctx *gin.Context, req *zone_third_partner_proto.OpUpdateReq) (ec errcode.ErrCode) {
|
func (s *Service) OpUpdateZoneThirdPartnerBusinessValidate(ctx *gin.Context, req *zone_third_partner_proto.OpUpdateReq) (ec errcode.ErrCode) {
|
||||||
ec = errcode.ErrCodeZoneThirdPartnerSrvOk
|
ec = errcode.ErrCodeZoneThirdPartnerSrvOk
|
||||||
// 1.业务校验
|
// 1.业务校验
|
||||||
result := businessvalidator.NewAuthBusinessValidator(ctx, req).
|
validator := businessvalidator.NewAuthBusinessValidator(ctx, req).
|
||||||
EnsureZoneThirdPartnerSharingRatioIsNotTooLarge(req.ZoneThirdPartner.GetSharingRatio()).
|
EnsureZoneThirdPartnerIsNotZoneCreater(_DefaultZone.GetById, req.ZoneThirdPartner.GetZid(), req.ZoneThirdPartner.GetThirdPartnerMid()).
|
||||||
EnsureZoneThirdPartnerSharingRatioIsEnough(func(ctx *gin.Context, zid int64) ([]*dbstruct.ZoneCollaborator, error) {
|
EnsureZoneThirdPartnerSharingRatioIsNotTooLarge(req.ZoneThirdPartner.GetSharingRatio())
|
||||||
|
// 若不更新代运营,则确保代运营分成比例足够
|
||||||
|
if req.ZoneThirdPartner.ThirdPartnerMid == nil {
|
||||||
|
validator.EnsureZoneThirdPartnerSharingRatioIsEnough(func(ctx *gin.Context, zid int64) ([]*dbstruct.ZoneCollaborator, error) {
|
||||||
return _DefaultZoneCollaborator.OpList(ctx, &zone_collaborator_proto.OpListReq{
|
return _DefaultZoneCollaborator.OpList(ctx, &zone_collaborator_proto.OpListReq{
|
||||||
Zid: goproto.Int64(zid),
|
Zid: goproto.Int64(zid),
|
||||||
})
|
})
|
||||||
}, req.ZoneThirdPartner.GetZid(), req.ZoneThirdPartner.GetSharingRatio()).
|
}, req.ZoneThirdPartner.GetZid(), req.ZoneThirdPartner.GetSharingRatio())
|
||||||
|
}
|
||||||
|
result := validator.
|
||||||
Validate().
|
Validate().
|
||||||
Collect()
|
Collect()
|
||||||
if ec = result[0].(errcode.ErrCode); ec != errcode.ErrCodeOk {
|
if ec = result[0].(errcode.ErrCode); ec != errcode.ErrCodeOk {
|
||||||
|
|
|
@ -4442,6 +4442,28 @@ func (s *Service) OpUpdateZoneThirdPartner(ctx *gin.Context, req *zone_third_par
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
zid := req.ZoneThirdPartner.GetZid()
|
||||||
|
// 如果更新代运营,则移除协作者团队
|
||||||
|
if req.ZoneThirdPartner.ThirdPartnerMid != nil {
|
||||||
|
zclist, err := _DefaultZoneCollaborator.OpList(ctx, &zone_collaborator_proto.OpListReq{
|
||||||
|
Zid: goproto.Int64(zid),
|
||||||
|
})
|
||||||
|
if err != nil {
|
||||||
|
logger.Error("OpList fail, id: %v, err: %v", zid, err)
|
||||||
|
ec = errcode.ErrCodeZoneCollaboratorSrvFail
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
for _, zc := range zclist {
|
||||||
|
err := _DefaultZoneCollaborator.OpDelete(ctx, zc.GetId())
|
||||||
|
if err != nil {
|
||||||
|
logger.Error("OpDelete fail, id: %v, err: %v", zid, err)
|
||||||
|
ec = errcode.ErrCodeZoneCollaboratorSrvFail
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
err := _DefaultZoneThirdPartner.OpUpdateByZid(ctx, req)
|
err := _DefaultZoneThirdPartner.OpUpdateByZid(ctx, req)
|
||||||
if err == qmgo.ErrNoSuchDocuments {
|
if err == qmgo.ErrNoSuchDocuments {
|
||||||
ec = errcode.ErrCodeZoneThirdPartnerNotExist
|
ec = errcode.ErrCodeZoneThirdPartnerNotExist
|
||||||
|
@ -4454,6 +4476,14 @@ func (s *Service) OpUpdateZoneThirdPartner(ctx *gin.Context, req *zone_third_par
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 若更新代运营,则新代运营加入空间
|
||||||
|
if req.ZoneThirdPartner.ThirdPartnerMid != nil {
|
||||||
|
_err := _DefaultVas.ZoneFreeJoinThirdPartner(ctx, req.ZoneThirdPartner.GetThirdPartnerMid(), req.ZoneThirdPartner.GetZid())
|
||||||
|
if _err != nil {
|
||||||
|
logger.Error("ZoneFreeJoinThirdPartner fail, mid: %v, zid: %v, err: %v", req.ZoneThirdPartner.GetThirdPartnerMid(), req.ZoneThirdPartner.GetZid(), _err)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue