33 lines
1.2 KiB
Go
33 lines
1.2 KiB
Go
package model
|
|
|
|
import (
|
|
"time"
|
|
|
|
"gorm.io/gorm"
|
|
)
|
|
|
|
// SmokeShare 存储用户主动创建的分享令牌,用于只读查看统计与记录。
|
|
type SmokeShare struct {
|
|
ID uint `gorm:"primaryKey;comment:主键" json:"id"`
|
|
CreatedAt time.Time `gorm:"comment:创建时间" json:"created_at"`
|
|
UpdatedAt time.Time `gorm:"comment:更新时间" json:"updated_at"`
|
|
DeletedAt gorm.DeletedAt `gorm:"index;comment:删除时间" json:"-"`
|
|
|
|
UID int `gorm:"index;comment:分享发起用户ID" json:"-"`
|
|
|
|
ShareToken string `gorm:"column:share_token;size:64;uniqueIndex;comment:分享令牌" json:"share_token"`
|
|
ExpireAt time.Time `gorm:"column:expire_at;index;comment:过期时间" json:"expire_at"`
|
|
RevokedAt *time.Time `gorm:"column:revoked_at;comment:撤销时间" json:"revoked_at,omitempty"`
|
|
|
|
LastViewedAt *time.Time `gorm:"column:last_viewed_at;comment:最近查看时间" json:"last_viewed_at,omitempty"`
|
|
ViewCount int64 `gorm:"column:view_count;default:0;comment:查看次数" json:"view_count"`
|
|
}
|
|
|
|
func (SmokeShare) TableName() string {
|
|
return "fa_smoke_share"
|
|
}
|
|
|
|
func (SmokeShare) TableComment() string {
|
|
return "戒烟分享链接"
|
|
}
|