style(street): gofmt 规范化街拍主副图相关文件

This commit is contained in:
toom1996
2026-09-21 22:36:07 +08:00
parent 3428a9823b
commit 3b60e6fdea
5 changed files with 37 additions and 37 deletions

View File

@ -62,12 +62,12 @@ type PublicStreetSnap struct {
// PublicStreetSnapDetail 对外只读街拍详情:含完整图片集与主副图分组。 // PublicStreetSnapDetail 对外只读街拍详情:含完整图片集与主副图分组。
type PublicStreetSnapDetail struct { type PublicStreetSnapDetail struct {
UID string `json:"id"` UID string `json:"id"`
Title string `json:"title"` Title string `json:"title"`
Cover string `json:"cover"` Cover string `json:"cover"`
Images []PublicArticleImage `json:"images"` // 扁平图片集(保持不变,向后兼容) Images []PublicArticleImage `json:"images"` // 扁平图片集(保持不变,向后兼容)
Groups []PublicStreetSnapGroup `json:"groups,omitempty"` // 按主副图分组(主图→其副图),与 Images 同源同序 Groups []PublicStreetSnapGroup `json:"groups,omitempty"` // 按主副图分组(主图→其副图),与 Images 同源同序
Favorited bool `json:"favorited,omitempty"` // 已登录时该图集是否被当前用户收藏(gallery 级) Favorited bool `json:"favorited,omitempty"` // 已登录时该图集是否被当前用户收藏(gallery 级)
} }
// PublicStreetSnapGroup 一张主图及其副图,供前端按组折叠展示。 // PublicStreetSnapGroup 一张主图及其副图,供前端按组折叠展示。

View File

@ -25,14 +25,14 @@ func (StreetSnap) TableName() string { return "street_snaps" }
// //
// 仿 brand_runway_images,但把 runway_id 改名为 snap_id,去掉 brand_id(街拍无品牌关联)。 // 仿 brand_runway_images,但把 runway_id 改名为 snap_id,去掉 brand_id(街拍无品牌关联)。
type StreetSnapImage struct { type StreetSnapImage struct {
ID uint32 `gorm:"primaryKey;column:id" json:"id"` ID uint32 `gorm:"primaryKey;column:id" json:"id"`
SnapID uint32 `gorm:"column:snap_id" json:"snap_id"` SnapID uint32 `gorm:"column:snap_id" json:"snap_id"`
Image string `gorm:"column:image" json:"image"` Image string `gorm:"column:image" json:"image"`
Name string `gorm:"column:name" json:"name"` Name string `gorm:"column:name" json:"name"`
SortOrder uint32 `gorm:"column:sort_order" json:"sort_order"` SortOrder uint32 `gorm:"column:sort_order" json:"sort_order"`
IsDeleted uint8 `gorm:"column:is_deleted" json:"is_deleted"` IsDeleted uint8 `gorm:"column:is_deleted" json:"is_deleted"`
CreatedAt uint32 `gorm:"column:created_at" json:"created_at"` CreatedAt uint32 `gorm:"column:created_at" json:"created_at"`
UpdatedAt uint32 `gorm:"column:updated_at" json:"updated_at"` UpdatedAt uint32 `gorm:"column:updated_at" json:"updated_at"`
// 去重字段:见 BrandRunwayImage 注释。phash 为 vector(64) 二进制向量(NULL=无法解码)。 // 去重字段:见 BrandRunwayImage 注释。phash 为 vector(64) 二进制向量(NULL=无法解码)。
Phash sql.NullString `gorm:"column:phash;type:vector(64)" json:"phash"` Phash sql.NullString `gorm:"column:phash;type:vector(64)" json:"phash"`

View File

@ -30,14 +30,14 @@ func (StreetSnapDraft) TableName() string { return "street_snap_drafts" }
// StreetSnapDraftImage 街拍草稿图片(对应 street_snap_draft_images)。 // StreetSnapDraftImage 街拍草稿图片(对应 street_snap_draft_images)。
type StreetSnapDraftImage struct { type StreetSnapDraftImage struct {
ID uint32 `gorm:"primaryKey;column:id" json:"id"` ID uint32 `gorm:"primaryKey;column:id" json:"id"`
DraftID uint32 `gorm:"column:draft_id" json:"draft_id"` DraftID uint32 `gorm:"column:draft_id" json:"draft_id"`
Image string `gorm:"column:image" json:"image"` Image string `gorm:"column:image" json:"image"`
Name string `gorm:"column:name" json:"name"` Name string `gorm:"column:name" json:"name"`
SortOrder uint32 `gorm:"column:sort_order" json:"sort_order"` SortOrder uint32 `gorm:"column:sort_order" json:"sort_order"`
IsDeleted uint8 `gorm:"column:is_deleted" json:"is_deleted"` IsDeleted uint8 `gorm:"column:is_deleted" json:"is_deleted"`
CreatedAt uint32 `gorm:"column:created_at" json:"created_at"` CreatedAt uint32 `gorm:"column:created_at" json:"created_at"`
UpdatedAt uint32 `gorm:"column:updated_at" json:"updated_at"` UpdatedAt uint32 `gorm:"column:updated_at" json:"updated_at"`
// 去重字段:见 BrandRunwayImage 注释。phash 为 vector(64) 二进制向量(NULL=无法解码)。 // 去重字段:见 BrandRunwayImage 注释。phash 为 vector(64) 二进制向量(NULL=无法解码)。
Phash sql.NullString `gorm:"column:phash;type:vector(64)" json:"phash"` Phash sql.NullString `gorm:"column:phash;type:vector(64)" json:"phash"`

View File

@ -256,20 +256,20 @@ func (r *reviewRepository) SaveRunwayFromDraft(ctx context.Context, draftID uint
if len(imgs) > 0 { if len(imgs) > 0 {
rows := make([]model.BrandRunwayImage, 0, len(imgs)) rows := make([]model.BrandRunwayImage, 0, len(imgs))
for i, im := range imgs { for i, im := range imgs {
rows = append(rows, model.BrandRunwayImage{ rows = append(rows, model.BrandRunwayImage{
RunwayID: runwayID, RunwayID: runwayID,
BrandID: draft.BrandID, BrandID: draft.BrandID,
Image: im.Image, Image: im.Image,
Name: im.Name, Name: im.Name,
SortOrder: uint32(i + 1), SortOrder: uint32(i + 1),
LookIndex: im.LookIndex, LookIndex: im.LookIndex,
IsDetail: im.IsDetail, IsDetail: im.IsDetail,
Phash: im.Phash, Phash: im.Phash,
IsDuplicate: im.IsDuplicate, IsDuplicate: im.IsDuplicate,
DupOf: im.DupOf, DupOf: im.DupOf,
CreatedAt: now, CreatedAt: now,
UpdatedAt: now, UpdatedAt: now,
}) })
} }
if cErr := tx.Create(&rows).Error; cErr != nil { if cErr := tx.Create(&rows).Error; cErr != nil {
return cErr return cErr

View File

@ -37,7 +37,7 @@ type DraftImageRef struct {
SortOrder uint32 `json:"sort_order"` SortOrder uint32 `json:"sort_order"`
IsDetail uint8 `json:"is_detail"` // 1=副图(挂在 ParentImageID 指向的主图下);0=主图 IsDetail uint8 `json:"is_detail"` // 1=副图(挂在 ParentImageID 指向的主图下);0=主图
ParentImageID uint32 `json:"parent_image_id"` // 副图所属主图的行 id;主图为 0 ParentImageID uint32 `json:"parent_image_id"` // 副图所属主图的行 id;主图为 0
DetailCount int `json:"detail_count"` // 仅主图有意义:名下(存活)副图数量 DetailCount int `json:"detail_count"` // 仅主图有意义:名下(存活)副图数量
} }
// EditField 审核详情页里可编辑字段的通用描述;详情页按此循环渲染输入框, // EditField 审核详情页里可编辑字段的通用描述;详情页按此循环渲染输入框,