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

Reviewed-on: http://121.41.31.146:3000/wishpal_ironfan/service/pulls/314
This commit is contained in:
chenhao 2024-04-22 18:34:06 +08:00
commit d074023584
2 changed files with 14 additions and 0 deletions

View File

@ -192,11 +192,13 @@ var ErrCodeMsgMap = map[ErrCode]string{
ErrCodeZoneThirdPartnerSrvFail: "空间代运营表服务错误",
ErrCodeZoneThirdPartnerNotExist: "空间代运营表不存在",
ErrCodeZoneThirdPartnerWrongThirdPartner: "空间代运营不能设置成自己",
ErrCodeZoneThirdPartnerDuplicateKey: "空间代运营已设置,请勿重复设置代运营!",
ErrCodeZoneCollaboratorSrvFail: "空间协作者表服务错误",
ErrCodeZoneCollaboratorNotExist: "空间协作者表不存在",
ErrCodeZoneCollaboratorCreateIsZTPOnlyOperation: "空间协作者表创建操作只有空间代运营可操作",
ErrCodeZoneCollaboratorWrongCollaborator: "空间协作者不能设置成自己或者主播",
ErrCodeZoneCollaboratorDuplicateKey: "用户已是该空间协作者!",
ErrCodeZoneMomentCreateTimesSrvFail: "空间动态创建频次表服务错误",
ErrCodeZoneMomentCreateTimesNotExist: "空间动态创建频次表不存在",
@ -468,6 +470,7 @@ const (
ErrCodeZoneThirdPartnerSrvFail ErrCode = -37001 // 空间代运营表服务错误
ErrCodeZoneThirdPartnerNotExist ErrCode = -37002 // 空间代运营表不存在
ErrCodeZoneThirdPartnerWrongThirdPartner ErrCode = -37003 // 空间代运营不能设置成自己
ErrCodeZoneThirdPartnerDuplicateKey ErrCode = -37004 // 空间代运营重复创建
// ZoneCollaborator: 38xxx
ErrCodeZoneCollaboratorSrvOk ErrCode = ErrCodeOk
@ -475,6 +478,7 @@ const (
ErrCodeZoneCollaboratorNotExist ErrCode = -38002 // 空间协作者表不存在
ErrCodeZoneCollaboratorCreateIsZTPOnlyOperation ErrCode = -38003 // 空间协作者表创建操作只有空间代运营可操作
ErrCodeZoneCollaboratorWrongCollaborator ErrCode = -38004 // 空间协作者不能设置成自己或者主播
ErrCodeZoneCollaboratorDuplicateKey ErrCode = -38005 // 空间协作者重复创建
// MomentCreateTimes: 39xxx
ErrCodeZoneMomentCreateTimesSrvOk ErrCode = ErrCodeOk

View File

@ -2947,6 +2947,11 @@ func (s *Service) ApiCreateZoneThirdPartner(ctx *gin.Context, req *zone_third_pa
BaseRequest: req.BaseRequest,
ZoneThirdPartner: req.ZoneThirdPartner,
})
if mongo.IsDuplicateKeyError(err) {
logger.Error("ApiCreate duplicate key found, req: %v, err: %v", util.ToJson(req), err)
ec = errcode.ErrCodeZoneThirdPartnerDuplicateKey
return
}
if err != nil {
logger.Error("OpCreate fail, req: %v, err: %v", util.ToJson(req), err)
ec = errcode.ErrCodeZoneThirdPartnerSrvFail
@ -3042,6 +3047,11 @@ func (s *Service) ApiCreateZoneCollaborator(ctx *gin.Context, req *zone_collabor
BaseRequest: req.BaseRequest,
ZoneCollaborator: req.ZoneCollaborator,
})
if mongo.IsDuplicateKeyError(err) {
logger.Error("ApiCreate duplicate key found, req: %v, err: %v", util.ToJson(req), err)
ec = errcode.ErrCodeZoneCollaboratorDuplicateKey
return
}
if err != nil {
logger.Error("OpCreate fail, req: %v, err: %v", util.ToJson(req), err)
ec = errcode.ErrCodeZoneCollaboratorSrvFail