Merge pull request 'by Robin at 20240427' (#362) from feat-IRONFANS-70 into main

Reviewed-on: http://121.41.31.146:3000/wishpal_ironfan/service/pulls/362
This commit is contained in:
chenhao 2024-04-27 08:21:01 +08:00
commit 1ef6478056
3 changed files with 26 additions and 9 deletions

View File

@ -50,7 +50,7 @@ const (
MaxDailyMomentCreateTimesKey = "max_daily_moment_create_times"
DefaultMomentTextKey = "default_moment_text"
MaxDailyZoneMomentCreateTimesKey = "max_daily_zone_moment_create_times"
ZoneKey = "zone"
ReferentialZoneMomentKey = "referential_zone_moment"
)
// del_flag

View File

@ -170,9 +170,10 @@ var ErrCodeMsgMap = map[ErrCode]string{
ErrCodeAccountCancellationSrvFail: "账户注销服务错误",
ErrCodeAccountCancellationNotExist: "账户注销不存在",
ErrCodeZoneSrvFail: "空间服务错误",
ErrCodeZoneNotExist: "空间不存在",
ErrCodeUnlockedZone: "访客未解锁该空间",
ErrCodeZoneSrvFail: "空间服务错误",
ErrCodeZoneNotExist: "空间不存在",
ErrCodeUnlockedZone: "访客未解锁该空间",
ErrCodeZoneDuplicateKey: "空间重复创建",
ErrCodeZoneMomentSrvFail: "私密圈动态服务错误",
ErrCodeZoneMomentNotExist: "私密圈动态不存在",
@ -442,10 +443,11 @@ const (
ErrCodeAccountPunishmentStreamerOnly ErrCode = -32007 // 该账号处罚仅能对主播进行
// Zone: 33xxx
ErrCodeZoneSrvOk ErrCode = ErrCodeOk
ErrCodeZoneSrvFail ErrCode = -33001 // 空间服务错误
ErrCodeZoneNotExist ErrCode = -33002 // 空间不存在
ErrCodeUnlockedZone ErrCode = -33003 // 未解锁的空间
ErrCodeZoneSrvOk ErrCode = ErrCodeOk
ErrCodeZoneSrvFail ErrCode = -33001 // 空间服务错误
ErrCodeZoneNotExist ErrCode = -33002 // 空间不存在
ErrCodeUnlockedZone ErrCode = -33003 // 未解锁的空间
ErrCodeZoneDuplicateKey ErrCode = -33004 // 空间已存在
// ZoneMoment: 34xxx
ErrCodeZoneMomentSrvOk ErrCode = ErrCodeOk

View File

@ -2121,6 +2121,21 @@ func (s *Service) ApiGetAccountCancellationListByMid(ctx *gin.Context, req *acco
func (s *Service) ApiCreateZone(ctx *gin.Context, req *zoneproto.ApiCreateReq) (ec errcode.ErrCode) {
ec = errcode.ErrCodeZoneSrvOk
// 查询是否有空间(为避免之后重建索引,在这里控制唯一性)
list, err := _DefaultZone.OpListByMid(ctx, &zoneproto.OpListByMidReq{
Uid: goproto.Int64(req.BaseRequest.Mid),
})
if err != nil {
logger.Error("OpListByMid fail, req: %v, err: %v", util.ToJson(req), err)
ec = errcode.ErrCodeZoneSrvFail
return
}
if len(list) > 0 {
logger.Error("Zone of this mid exists, req: %v, err: %v", util.ToJson(req), err)
ec = errcode.ErrCodeZoneDuplicateKey
return
}
req.Zone.Mid = goproto.Int64(req.GetBaseRequest().Mid)
req.Zone.ZoneMomentCount = goproto.Int64(0)
req.Zone.ImageCount = goproto.Int64(0)
@ -2156,7 +2171,7 @@ func (s *Service) ApiCreateZone(ctx *gin.Context, req *zoneproto.ApiCreateReq) (
// 创建默认动态
cfg := apollostruct.ReferentialZoneMoment{}
err = apollo.GetJson(consts.ZoneKey, &cfg, apollo.ApolloOpts().SetNamespace("referential_zone_moment"))
err = apollo.GetJson(consts.ReferentialZoneMomentKey, &cfg, apollo.ApolloOpts().SetNamespace("zone"))
if err != nil {
logger.Error("Apollo read failed : %v", err)
return errcode.ErrCodeApolloReadFail