by Robin at 20240313; alter msg for permanent block
This commit is contained in:
parent
81916b58bb
commit
3d0dbb6ca2
|
@ -65,7 +65,8 @@ var ErrCodeMsgMap = map[ErrCode]string{
|
||||||
|
|
||||||
ErrCodeMomentSrvFail: "动态服务错误",
|
ErrCodeMomentSrvFail: "动态服务错误",
|
||||||
ErrCodeMomentNotExist: "动态不存在",
|
ErrCodeMomentNotExist: "动态不存在",
|
||||||
ErrCodMomentBlockedFromCreatingMoment: "该用户的动态创建功能已被封禁至%v",
|
ErrCodMomentBlockedFromCreatingMoment: "功能封禁中,截止时间:%v",
|
||||||
|
ErrCodMomentBlockedFromCreatingMomentPermanently: "该功能已被永久封禁",
|
||||||
|
|
||||||
ErrCodeFootPrintSrvFail: "足迹服务错误",
|
ErrCodeFootPrintSrvFail: "足迹服务错误",
|
||||||
ErrCodeFootPrintNotExist: "足迹不存在",
|
ErrCodeFootPrintNotExist: "足迹不存在",
|
||||||
|
@ -245,6 +246,7 @@ const (
|
||||||
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
|
||||||
|
|
|
@ -1581,10 +1581,16 @@ 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 {
|
||||||
|
if accountpunishment.IsPermanent() {
|
||||||
|
ec = errcode.ErrCodMomentBlockedFromCreatingMomentPermanently
|
||||||
|
return
|
||||||
|
} else {
|
||||||
ec = errcode.ErrCodMomentBlockedFromCreatingMoment
|
ec = errcode.ErrCodMomentBlockedFromCreatingMoment
|
||||||
acctPunEndTime = accountpunishment.GetEndTimeFormatString()
|
acctPunEndTime = accountpunishment.GetEndTimeFormatString()
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue