update
This commit is contained in:
19
internal/model/history.go
Normal file
19
internal/model/history.go
Normal file
@ -0,0 +1,19 @@
|
||||
package model
|
||||
|
||||
// History 用户浏览历史(服务端持久化,按用户隔离,跨设备一致)。
|
||||
//
|
||||
// 2026-09-02 收敛为「文章级」记录:点开某篇走秀/街拍详情(/item/xxx)时记一条,
|
||||
// 进入列表页不再记。仅存三要素:user_id + target_uid + viewed_at。
|
||||
// target_uid 为带类型前缀的对外编码串(runway r=xxx / street s=xxx,见 hashid.EncodeTyped),
|
||||
// 前缀本身携带类型,无需 kind / target_type 列;title/cover/brand 快照也已移除,
|
||||
// 账户页展示时按 target_uid 回查公开详情接口(保持表最简、数据新鲜)。
|
||||
// 唯一键 (user_id, target_uid) 保证同一篇文章反复打开只刷新 viewed_at、不新增行。
|
||||
type History struct {
|
||||
ID uint32 `gorm:"primaryKey;column:id" json:"id"`
|
||||
ViewedAt uint32 `gorm:"column:viewed_at" json:"viewed_at"`
|
||||
UserID uint32 `gorm:"column:user_id;not null" json:"user_id"`
|
||||
TargetUID string `gorm:"column:target_uid;size:64;not null;uniqueIndex:uniq_user_target" json:"target_uid"`
|
||||
}
|
||||
|
||||
// TableName 指定表名。
|
||||
func (History) TableName() string { return "histories" }
|
||||
Reference in New Issue
Block a user