Merge pull request 'by Robin at 20240313; alter msg for permanent block' (#175) from feat-IRONFANS-66-Robin into test

Reviewed-on: http://121.41.31.146:3000/wishpal_ironfan/service/pulls/175
This commit is contained in:
chenhao 2024-03-13 16:32:42 +08:00
commit 4711e9e2e4
3 changed files with 27 additions and 10 deletions

View File

@ -67,9 +67,10 @@ var ErrCodeMsgMap = map[ErrCode]string{
ErrCodeVasAlipayUniTransferFail: "支付宝提现失败", ErrCodeVasAlipayUniTransferFail: "支付宝提现失败",
ErrCodeVasOverTodayWithdrawCnt: "今日提现次数到达上限", ErrCodeVasOverTodayWithdrawCnt: "今日提现次数到达上限",
ErrCodeMomentSrvFail: "动态服务错误", ErrCodeMomentSrvFail: "动态服务错误",
ErrCodeMomentNotExist: "动态不存在", ErrCodeMomentNotExist: "动态不存在",
ErrCodMomentBlockedFromCreatingMoment: "该用户的动态创建功能已被封禁至%v", ErrCodMomentBlockedFromCreatingMoment: "功能封禁中,截止时间:%v",
ErrCodMomentBlockedFromCreatingMomentPermanently: "该功能已被永久封禁",
ErrCodeFootPrintSrvFail: "足迹服务错误", ErrCodeFootPrintSrvFail: "足迹服务错误",
ErrCodeFootPrintNotExist: "足迹不存在", ErrCodeFootPrintNotExist: "足迹不存在",
@ -255,10 +256,11 @@ const (
ErrCodeVasOverTodayWithdrawCnt ErrCode = -7022 // 今天提现次数到达上限 ErrCodeVasOverTodayWithdrawCnt ErrCode = -7022 // 今天提现次数到达上限
// Moment: 8xxx // Moment: 8xxx
ErrCodeMomentSrvOk ErrCode = ErrCodeOk ErrCodeMomentSrvOk ErrCode = ErrCodeOk
ErrCodeMomentSrvFail ErrCode = -8001 // 动态服务错误 ErrCodeMomentSrvFail ErrCode = -8001 // 动态服务错误
ErrCodeMomentNotExist ErrCode = -8002 // 动态不存在 ErrCodeMomentNotExist ErrCode = -8002 // 动态不存在
ErrCodMomentBlockedFromCreatingMoment ErrCode = -8003 // 动态创建已被封禁 ErrCodMomentBlockedFromCreatingMoment ErrCode = -8003 // 动态创建已被封禁
ErrCodMomentBlockedFromCreatingMomentPermanently ErrCode = -8004 // 动态创建已被永久封禁
// FootPrint: 9xxx // FootPrint: 9xxx
ErrCodeFootPrintSrvOk ErrCode = ErrCodeOk ErrCodeFootPrintSrvOk ErrCode = ErrCodeOk

View File

@ -1687,9 +1687,15 @@ func (s *Service) ApiCreateMoment(ctx *gin.Context, req *momentproto.ApiCreateRe
var accountpunishment *dbstruct.AccountPunishment var accountpunishment *dbstruct.AccountPunishment
if ec, accountpunishment = s.ApiCreateMomentBusinessValidate(ctx, req); ec != errcode.ErrCodeMomentSrvOk { if ec, accountpunishment = s.ApiCreateMomentBusinessValidate(ctx, req); ec != errcode.ErrCodeMomentSrvOk {
if ec == errcode.ErrCodeAccountPunishmentExist { if ec == errcode.ErrCodeAccountPunishmentExist {
ec = errcode.ErrCodMomentBlockedFromCreatingMoment if accountpunishment.IsPermanent() {
acctPunEndTime = accountpunishment.GetEndTimeFormatString() ec = errcode.ErrCodMomentBlockedFromCreatingMomentPermanently
return return
} else {
ec = errcode.ErrCodMomentBlockedFromCreatingMoment
acctPunEndTime = accountpunishment.GetEndTimeFormatString()
return
}
} }
return return
} }

View File

@ -5,6 +5,8 @@ import (
"time" "time"
) )
const PermanentDuration int64 = 3155760000
type AccountPunishment struct { type AccountPunishment struct {
Id *int64 `json:"id" bson:"_id"` // 账号处罚表id Id *int64 `json:"id" bson:"_id"` // 账号处罚表id
Mid *int64 `json:"mid" bson:"mid"` // 用户表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秒") 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
}