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:
commit
4711e9e2e4
|
@ -69,7 +69,8 @@ var ErrCodeMsgMap = map[ErrCode]string{
|
|||
|
||||
ErrCodeMomentSrvFail: "动态服务错误",
|
||||
ErrCodeMomentNotExist: "动态不存在",
|
||||
ErrCodMomentBlockedFromCreatingMoment: "该用户的动态创建功能已被封禁至%v",
|
||||
ErrCodMomentBlockedFromCreatingMoment: "功能封禁中,截止时间:%v",
|
||||
ErrCodMomentBlockedFromCreatingMomentPermanently: "该功能已被永久封禁",
|
||||
|
||||
ErrCodeFootPrintSrvFail: "足迹服务错误",
|
||||
ErrCodeFootPrintNotExist: "足迹不存在",
|
||||
|
@ -259,6 +260,7 @@ const (
|
|||
ErrCodeMomentSrvFail ErrCode = -8001 // 动态服务错误
|
||||
ErrCodeMomentNotExist ErrCode = -8002 // 动态不存在
|
||||
ErrCodMomentBlockedFromCreatingMoment ErrCode = -8003 // 动态创建已被封禁
|
||||
ErrCodMomentBlockedFromCreatingMomentPermanently ErrCode = -8004 // 动态创建已被永久封禁
|
||||
|
||||
// FootPrint: 9xxx
|
||||
ErrCodeFootPrintSrvOk ErrCode = ErrCodeOk
|
||||
|
|
|
@ -1687,10 +1687,16 @@ 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 {
|
||||
if accountpunishment.IsPermanent() {
|
||||
ec = errcode.ErrCodMomentBlockedFromCreatingMomentPermanently
|
||||
return
|
||||
} else {
|
||||
ec = errcode.ErrCodMomentBlockedFromCreatingMoment
|
||||
acctPunEndTime = accountpunishment.GetEndTimeFormatString()
|
||||
return
|
||||
}
|
||||
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue