This commit is contained in:
toom1996
2026-08-26 10:45:21 +08:00
parent 3cf1368e68
commit 30c9f21da4
48 changed files with 3442 additions and 0 deletions

21
internal/model/brand.go Normal file
View File

@ -0,0 +1,21 @@
package model
// Brand 品牌表。
//
// 注意:时间戳字段为 int unsigned 存储的 Unix 秒,不是 MySQL datetime,
// 迁移时保持原样,避免与既有数据不兼容。
type Brand struct {
ID uint32 `gorm:"primaryKey;column:id" json:"id"`
CreatedAt uint32 `gorm:"column:created_at" json:"created_at"`
UpdatedAt uint32 `gorm:"column:updated_at" json:"updated_at"`
Name string `gorm:"column:name" json:"name"`
ShowName string `gorm:"column:show_name" json:"show_name"`
// i18n 列(方案 A):name_en 为规范拉丁名,A-Z 排序/搜索统一基于它;
// name_cn 为中文名;二者皆为空的服务端按 locale 回落。
NameEn string `gorm:"column:name_en" json:"name_en"`
NameCn string `gorm:"column:name_cn" json:"name_cn"`
IsDeleted uint8 `gorm:"column:is_deleted" json:"is_deleted"`
}
// TableName 指定表名。
func (Brand) TableName() string { return "brand" }

56
internal/model/runway.go Normal file
View File

@ -0,0 +1,56 @@
package model
// BrandRunway 走秀档案(对外称"文章")。
type BrandRunway struct {
ID uint32 `gorm:"primaryKey;column:id" json:"id"`
Title string `gorm:"column:title" json:"title"`
Description string `gorm:"column:description" json:"description"`
// i18n 列(方案 A):*_en 为规范英文(当前数据全英文),*_cn 为中文;
// 服务端按 locale 选列,缺翻译回落另一语言。
TitleEn string `gorm:"column:title_en" json:"title_en"`
TitleCn string `gorm:"column:title_cn" json:"title_cn"`
DescriptionEn string `gorm:"column:description_en" json:"description_en"`
DescriptionCn string `gorm:"column:description_cn" json:"description_cn"`
CreatedAt uint32 `gorm:"column:created_at" json:"created_at"`
UpdatedAt uint32 `gorm:"column:updated_at" json:"updated_at"`
IsDeleted uint8 `gorm:"column:is_deleted" json:"is_deleted"`
ImageCount uint16 `gorm:"column:image_count" json:"image_count"`
BrandID uint32 `gorm:"column:brand_id" json:"brand_id"`
Year uint16 `gorm:"column:year" json:"year"`
Cover string `gorm:"column:cover" json:"cover"`
SourceURL string `gorm:"column:source_url" json:"source_url"`
// 分类字段:由 title 解析回填(历史数据迁移一次性写入,现已由外部 SQL 迁移维护)
CollectionType string `gorm:"column:collection_type;size:16;not null;default:''" json:"collection_type"` // rtw/menswear/couture/resort/pre_fall
Season string `gorm:"column:season;size:8" json:"season"` // spring/fall/null
SeasonCode string `gorm:"column:season_code;size:8;not null;default:''" json:"season_code"` // SS26/FW25/RES26/PF25
}
// TableName 指定表名。
func (BrandRunway) TableName() string { return "brand_runway" }
// RunwayRow 走秀档案的查询投影行。
//
// 独立于 BrandRunway 定义,是为了承载 JOIN brand 得到的 brand_name ——
// 该字段不属于 brand_runway 表,混进实体会污染模型语义。
type RunwayRow struct {
ID uint32 `gorm:"column:id"`
BrandID uint32 `gorm:"column:brand_id"`
Title string `gorm:"column:title"`
TitleEn string `gorm:"column:title_en"`
TitleCn string `gorm:"column:title_cn"`
Description string `gorm:"column:description"`
DescriptionEn string `gorm:"column:description_en"`
DescriptionCn string `gorm:"column:description_cn"`
Cover string `gorm:"column:cover"`
Year uint16 `gorm:"column:year"`
ImageCount uint16 `gorm:"column:image_count"`
CollectionType string `gorm:"column:collection_type"`
Season string `gorm:"column:season"`
SeasonCode string `gorm:"column:season_code"`
CreatedAt uint32 `gorm:"column:created_at"`
SourceURL string `gorm:"column:source_url"`
BrandName string `gorm:"column:brand_name"`
BrandNameEn string `gorm:"column:brand_name_en"`
BrandNameCn string `gorm:"column:brand_name_cn"`
}

View File

@ -0,0 +1,17 @@
package model
// BrandRunwayImage 走秀图片。
type BrandRunwayImage struct {
ID uint32 `gorm:"primaryKey;column:id" json:"id"`
CreatedAt uint32 `gorm:"column:created_at" json:"created_at"`
UpdatedAt uint32 `gorm:"column:updated_at" json:"updated_at"`
IsDeleted uint8 `gorm:"column:is_deleted" json:"is_deleted"`
Image string `gorm:"column:image" json:"image"`
RunwayID uint32 `gorm:"column:runway_id" json:"runway_id"`
BrandID uint32 `gorm:"column:brand_id" json:"brand_id"`
Name string `gorm:"column:name" json:"name"`
SortOrder uint32 `gorm:"column:sort_order" json:"sort_order"` // 拖拽排序用,由迁移脚本新增
}
// TableName 指定表名。
func (BrandRunwayImage) TableName() string { return "brand_runway_images" }

17
internal/model/user.go Normal file
View File

@ -0,0 +1,17 @@
package model
// User 注册用户(账号体系)。
//
// PasswordHash 的 json tag 为 "-",确保密码哈希永远不会被序列化返回。
type User struct {
ID uint32 `gorm:"primaryKey;column:id" json:"id"`
CreatedAt uint32 `gorm:"column:created_at" json:"created_at"`
UpdatedAt uint32 `gorm:"column:updated_at" json:"updated_at"`
Username string `gorm:"column:username;size:64;uniqueIndex" json:"username"`
Email string `gorm:"column:email;size:191;uniqueIndex" json:"email"`
PasswordHash string `gorm:"column:password_hash;size:255" json:"-"`
IsDeleted uint8 `gorm:"column:is_deleted" json:"is_deleted"`
}
// TableName 指定表名。
func (User) TableName() string { return "users" }