service/dbstruct/accountpunishment.go

71 lines
1.8 KiB
Go
Raw Normal View History

2024-03-12 12:06:45 +08:00
package dbstruct
import (
"service/bizcommon/util"
"time"
)
const PermanentDuration int64 = 3155760000
2024-03-12 12:06:45 +08:00
type AccountPunishment struct {
Id *int64 `json:"id" bson:"_id"` // 账号处罚表id
Mid *int64 `json:"mid" bson:"mid"` // 用户表id
Type *int64 `json:"type" bson:"type"` // 处罚类型
Duration *int64 `json:"duration" bson:"duration"` // 处罚时长
EndTime *int64 `json:"end_time" bson:"end_time"` // 处罚结束时间
Status *int64 `json:"status" bson:"status"` // 处罚结果
2024-11-07 17:05:13 +08:00
Nid *int64 `json:"nid" bson:"nid"` // 通知表id用于控制推送
2024-03-12 12:06:45 +08:00
Ct *int64 `json:"ct" bson:"ct"` // 创建时间
Ut *int64 `json:"ut" bson:"ut"` // 更新时间
DelFlag *int64 `json:"del_flag" bson:"del_flag"` // 删除标记
}
2024-06-21 19:51:55 +08:00
func (p *AccountPunishment) GetMid() int64 {
if p == nil || p.Mid == nil {
return 0
}
return *p.Mid
}
2024-11-05 11:44:33 +08:00
func (p *AccountPunishment) GetEndTime() int64 {
if p == nil || p.EndTime == nil {
return 0
}
return *p.EndTime
}
2024-03-12 12:06:45 +08:00
func (p *AccountPunishment) GetEndTimeFormatString() string {
if p == nil || p.EndTime == nil {
return ""
}
return time.Unix(util.DerefInt64(p.EndTime), 0).Local().Format("1/2 15:04")
2024-03-12 12:06:45 +08:00
}
2024-11-04 18:26:51 +08:00
func (p *AccountPunishment) GetEndTimeFormatAsChinese() string {
if p == nil || p.EndTime == nil {
return ""
}
return time.Unix(util.DerefInt64(p.EndTime), 0).Local().Format("2006年1月2日 15时04分")
}
func (p *AccountPunishment) IsPermanent() bool {
if p == nil || p.Duration == nil {
return false
}
return util.DerefInt64(p.Duration) == PermanentDuration
}
2024-11-04 18:26:51 +08:00
func (p *AccountPunishment) GetType() int64 {
if p == nil || p.Type == nil {
return 0
}
return *p.Type
}
2024-11-07 17:05:13 +08:00
func (p *AccountPunishment) GetNid() int64 {
if p == nil || p.Nid == nil {
return 0
}
return *p.Nid
}