From 3d0dbb6ca242458f5f6e08865bbfb3c38c08c827 Mon Sep 17 00:00:00 2001 From: Leufolium Date: Wed, 13 Mar 2024 16:31:51 +0800 Subject: [PATCH] by Robin at 20240313; alter msg for permanent block --- api/errcode/errcode.go | 16 +++++++++------- app/mix/service/apiservice.go | 12 +++++++++--- dbstruct/accountpunishment.go | 9 +++++++++ 3 files changed, 27 insertions(+), 10 deletions(-) diff --git a/api/errcode/errcode.go b/api/errcode/errcode.go index 428a6908..86e405b9 100644 --- a/api/errcode/errcode.go +++ b/api/errcode/errcode.go @@ -63,9 +63,10 @@ var ErrCodeMsgMap = map[ErrCode]string{ ErrCodeVasAlipayUniTransferFail: "支付宝提现失败", ErrCodeVasOverTodayWithdrawCnt: "今日提现次数到达上限", - ErrCodeMomentSrvFail: "动态服务错误", - ErrCodeMomentNotExist: "动态不存在", - ErrCodMomentBlockedFromCreatingMoment: "该用户的动态创建功能已被封禁至%v", + ErrCodeMomentSrvFail: "动态服务错误", + ErrCodeMomentNotExist: "动态不存在", + ErrCodMomentBlockedFromCreatingMoment: "功能封禁中,截止时间:%v", + ErrCodMomentBlockedFromCreatingMomentPermanently: "该功能已被永久封禁", ErrCodeFootPrintSrvFail: "足迹服务错误", ErrCodeFootPrintNotExist: "足迹不存在", @@ -241,10 +242,11 @@ const ( ErrCodeVasOverTodayWithdrawCnt ErrCode = -7022 // 今天提现次数到达上限 // Moment: 8xxx - ErrCodeMomentSrvOk ErrCode = ErrCodeOk - ErrCodeMomentSrvFail ErrCode = -8001 // 动态服务错误 - ErrCodeMomentNotExist ErrCode = -8002 // 动态不存在 - ErrCodMomentBlockedFromCreatingMoment ErrCode = -8003 // 动态创建已被封禁 + ErrCodeMomentSrvOk ErrCode = ErrCodeOk + ErrCodeMomentSrvFail ErrCode = -8001 // 动态服务错误 + ErrCodeMomentNotExist ErrCode = -8002 // 动态不存在 + ErrCodMomentBlockedFromCreatingMoment ErrCode = -8003 // 动态创建已被封禁 + ErrCodMomentBlockedFromCreatingMomentPermanently ErrCode = -8004 // 动态创建已被永久封禁 // FootPrint: 9xxx ErrCodeFootPrintSrvOk ErrCode = ErrCodeOk diff --git a/app/mix/service/apiservice.go b/app/mix/service/apiservice.go index b9f66af3..01e88544 100644 --- a/app/mix/service/apiservice.go +++ b/app/mix/service/apiservice.go @@ -1581,9 +1581,15 @@ func (s *Service) ApiCreateMoment(ctx *gin.Context, req *momentproto.ApiCreateRe var accountpunishment *dbstruct.AccountPunishment if ec, accountpunishment = s.ApiCreateMomentBusinessValidate(ctx, req); ec != errcode.ErrCodeMomentSrvOk { if ec == errcode.ErrCodeAccountPunishmentExist { - ec = errcode.ErrCodMomentBlockedFromCreatingMoment - acctPunEndTime = accountpunishment.GetEndTimeFormatString() - return + if accountpunishment.IsPermanent() { + ec = errcode.ErrCodMomentBlockedFromCreatingMomentPermanently + return + } else { + ec = errcode.ErrCodMomentBlockedFromCreatingMoment + acctPunEndTime = accountpunishment.GetEndTimeFormatString() + return + } + } return } diff --git a/dbstruct/accountpunishment.go b/dbstruct/accountpunishment.go index d00030e6..03e15930 100644 --- a/dbstruct/accountpunishment.go +++ b/dbstruct/accountpunishment.go @@ -5,6 +5,8 @@ import ( "time" ) +const PermanentDuration int64 = 3155760000 + type AccountPunishment struct { Id *int64 `json:"id" bson:"_id"` // 账号处罚表id Mid *int64 `json:"mid" bson:"mid"` // 用户表id @@ -23,3 +25,10 @@ func (p *AccountPunishment) GetEndTimeFormatString() string { } return time.Unix(util.DerefInt64(p.EndTime), 0).Local().Format("2006年1月2日 15时04分05秒") } + +func (p *AccountPunishment) IsPermanent() bool { + if p == nil || p.Duration == nil { + return false + } + return util.DerefInt64(p.Duration) == PermanentDuration +}