service/dbstruct/accountpunishment.go

42 lines
1.2 KiB
Go

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"` // 处罚结果
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) 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) IsPermanent() bool {
if p == nil || p.Duration == nil {
return false
}
return util.DerefInt64(p.Duration) == PermanentDuration
}