39 lines
1.2 KiB
Go
39 lines
1.2 KiB
Go
package model
|
|
|
|
import "time"
|
|
|
|
// UserVisit 用户浏览记录数据模型
|
|
type UserVisit struct {
|
|
Model
|
|
UID uint64 `gorm:"column:uid;type:int;default:0;comment:用户uuid" json:"-"`
|
|
Kind UserVisitKind `gorm:"column:kind;type:tinyint(3);default:0;comment:收藏数据类型" json:"kind"`
|
|
ObjectID uint64 `gorm:"column:object_id;type:int(11);default:0;comment:收藏对象ID" json:"-"`
|
|
Count int `gorm:"column:count;type:int(8);default:0;comment:浏览次数" json:"count"`
|
|
Date time.Time `gorm:"column:date;type:datetime;not null;comment:最后浏览时间" json:"date"`
|
|
ModelDeleted
|
|
ModelAt
|
|
}
|
|
|
|
type UserVisitKind int
|
|
|
|
const (
|
|
// UserVisitKindForLaboratory 实验室
|
|
UserVisitKindForLaboratory UserVisitKind = iota + 1
|
|
// UserVisitKindForExpert 专家
|
|
UserVisitKindForExpert
|
|
// UserVisitKindForCompany 公司
|
|
UserVisitKindForCompany
|
|
// UserVisitKindForTechnologyAchievement 技术成果
|
|
UserVisitKindForTechnologyAchievement
|
|
// UserVisitKindForTechnologyProduct 技术产品
|
|
UserVisitKindForTechnologyProduct
|
|
)
|
|
|
|
func (m *UserVisit) TableName() string {
|
|
return "user_visit"
|
|
}
|
|
|
|
func NewUserVisit() *UserVisit {
|
|
return &UserVisit{}
|
|
}
|