57 lines
3.1 KiB
Go
57 lines
3.1 KiB
Go
package model
|
||
|
||
import "database/sql"
|
||
|
||
// StreetSnap 街拍主表(对应 db_dev.street_snaps)。
|
||
//
|
||
// 字段对齐 db_dev 约定:INT UNSIGNED 主键、int unsigned 时间戳、is_deleted 软删、varchar(255)。
|
||
// 与 brand_runways 双表同构,但**无 brand_id**(街拍不关联品牌,模块自治)。
|
||
type StreetSnap struct {
|
||
ID uint32 `gorm:"primaryKey;column:id" json:"id"`
|
||
Title string `gorm:"column:title" json:"title"` // 英文标题(既有源,改动前唯一标题列)
|
||
TitleCn string `gorm:"column:title_cn" json:"title_cn"` // 中文标题:后台人工翻译;为空时前端/接口回落英文
|
||
Year uint16 `gorm:"column:year" json:"year"`
|
||
City string `gorm:"column:city" json:"city"` // 地区/城市(从 title 第一段 \t 解析回填),'' 表示未归类
|
||
Cover string `gorm:"column:cover" json:"cover"`
|
||
ImageCount uint16 `gorm:"column:image_count" json:"image_count"`
|
||
IsDeleted uint8 `gorm:"column:is_deleted" json:"is_deleted"`
|
||
CreatedAt uint32 `gorm:"column:created_at" json:"created_at"`
|
||
|
||
// 审核态与溯源(单表发布模型;列由 db/migrations/2026-09-22-01-single-table-publish.sql 添加)。
|
||
Status string `gorm:"column:status;size:16;not null;default:'pending'" json:"status"`
|
||
JobID uint32 `gorm:"column:job_id;not null;default:0" json:"job_id"`
|
||
Reviewer string `gorm:"column:reviewer;size:64;not null;default:''" json:"reviewer"`
|
||
|
||
UpdatedAt uint32 `gorm:"column:updated_at" json:"updated_at"`
|
||
}
|
||
|
||
// TableName 指定主表名。
|
||
func (StreetSnap) TableName() string { return "street_snaps" }
|
||
|
||
// StreetSnapImage 街拍图片表(对应 db_dev.street_snap_images)。
|
||
//
|
||
// 仿 brand_runway_images,但把 runway_id 改名为 snap_id,去掉 brand_id(街拍无品牌关联)。
|
||
type StreetSnapImage struct {
|
||
ID uint32 `gorm:"primaryKey;column:id" json:"id"`
|
||
SnapID uint32 `gorm:"column:snap_id" json:"snap_id"`
|
||
Image string `gorm:"column:image" json:"image"`
|
||
Name string `gorm:"column:name" json:"name"`
|
||
SortOrder uint32 `gorm:"column:sort_order" json:"sort_order"`
|
||
IsDeleted uint8 `gorm:"column:is_deleted" json:"is_deleted"`
|
||
CreatedAt uint32 `gorm:"column:created_at" json:"created_at"`
|
||
UpdatedAt uint32 `gorm:"column:updated_at" json:"updated_at"`
|
||
|
||
// 去重字段:见 BrandRunwayImage 注释。phash 为 vector(64) 二进制向量(NULL=无法解码)。
|
||
Phash sql.NullString `gorm:"column:phash;type:vector(64)" json:"phash"`
|
||
IsDuplicate uint8 `gorm:"column:is_duplicate;not null;default:0" json:"is_duplicate"`
|
||
DupOf string `gorm:"column:dup_of;type:varchar(32);not null;default:''" json:"dup_of"`
|
||
|
||
// 主副图分组(列由 db/migrations/2026-09-21-01-street-main-detail.sql 添加):
|
||
// is_detail=0 为主图(parent_image_id=0);=1 为副图,parent_image_id 指向同专辑内主图的行 id。
|
||
IsDetail uint8 `gorm:"column:is_detail;not null;default:0" json:"is_detail"`
|
||
ParentImageID uint32 `gorm:"column:parent_image_id;not null;default:0" json:"parent_image_id"`
|
||
}
|
||
|
||
// TableName 指定图片明细表名。
|
||
func (StreetSnapImage) TableName() string { return "street_snap_images" }
|