service/dbstruct/accountpunishment.go

71 lines
1.8 KiB
Go
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

package dbstruct
import (
"service/bizcommon/util"
"time"
)
const PermanentDuration int64 = 3155760000
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"` // 处罚结果
Nid *int64 `json:"nid" bson:"nid"` // 通知表id用于控制推送
Ct *int64 `json:"ct" bson:"ct"` // 创建时间
Ut *int64 `json:"ut" bson:"ut"` // 更新时间
DelFlag *int64 `json:"del_flag" bson:"del_flag"` // 删除标记
}
func (p *AccountPunishment) GetMid() int64 {
if p == nil || p.Mid == nil {
return 0
}
return *p.Mid
}
func (p *AccountPunishment) GetEndTime() int64 {
if p == nil || p.EndTime == nil {
return 0
}
return *p.EndTime
}
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")
}
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
}
func (p *AccountPunishment) GetType() int64 {
if p == nil || p.Type == nil {
return 0
}
return *p.Type
}
func (p *AccountPunishment) GetNid() int64 {
if p == nil || p.Nid == nil {
return 0
}
return *p.Nid
}