style(street): gofmt 规范化街拍主副图相关文件
This commit is contained in:
@ -62,12 +62,12 @@ type PublicStreetSnap struct {
|
||||
|
||||
// PublicStreetSnapDetail 对外只读街拍详情:含完整图片集与主副图分组。
|
||||
type PublicStreetSnapDetail struct {
|
||||
UID string `json:"id"`
|
||||
Title string `json:"title"`
|
||||
Cover string `json:"cover"`
|
||||
Images []PublicArticleImage `json:"images"` // 扁平图片集(保持不变,向后兼容)
|
||||
Groups []PublicStreetSnapGroup `json:"groups,omitempty"` // 按主副图分组(主图→其副图),与 Images 同源同序
|
||||
Favorited bool `json:"favorited,omitempty"` // 已登录时该图集是否被当前用户收藏(gallery 级)
|
||||
UID string `json:"id"`
|
||||
Title string `json:"title"`
|
||||
Cover string `json:"cover"`
|
||||
Images []PublicArticleImage `json:"images"` // 扁平图片集(保持不变,向后兼容)
|
||||
Groups []PublicStreetSnapGroup `json:"groups,omitempty"` // 按主副图分组(主图→其副图),与 Images 同源同序
|
||||
Favorited bool `json:"favorited,omitempty"` // 已登录时该图集是否被当前用户收藏(gallery 级)
|
||||
}
|
||||
|
||||
// PublicStreetSnapGroup 一张主图及其副图,供前端按组折叠展示。
|
||||
|
||||
@ -25,14 +25,14 @@ func (StreetSnap) TableName() string { return "street_snaps" }
|
||||
//
|
||||
// 仿 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"`
|
||||
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"`
|
||||
|
||||
@ -30,14 +30,14 @@ func (StreetSnapDraft) TableName() string { return "street_snap_drafts" }
|
||||
|
||||
// StreetSnapDraftImage 街拍草稿图片(对应 street_snap_draft_images)。
|
||||
type StreetSnapDraftImage struct {
|
||||
ID uint32 `gorm:"primaryKey;column:id" json:"id"`
|
||||
DraftID uint32 `gorm:"column:draft_id" json:"draft_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"`
|
||||
ID uint32 `gorm:"primaryKey;column:id" json:"id"`
|
||||
DraftID uint32 `gorm:"column:draft_id" json:"draft_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"`
|
||||
|
||||
@ -256,20 +256,20 @@ func (r *reviewRepository) SaveRunwayFromDraft(ctx context.Context, draftID uint
|
||||
if len(imgs) > 0 {
|
||||
rows := make([]model.BrandRunwayImage, 0, len(imgs))
|
||||
for i, im := range imgs {
|
||||
rows = append(rows, model.BrandRunwayImage{
|
||||
RunwayID: runwayID,
|
||||
BrandID: draft.BrandID,
|
||||
Image: im.Image,
|
||||
Name: im.Name,
|
||||
SortOrder: uint32(i + 1),
|
||||
LookIndex: im.LookIndex,
|
||||
IsDetail: im.IsDetail,
|
||||
Phash: im.Phash,
|
||||
IsDuplicate: im.IsDuplicate,
|
||||
DupOf: im.DupOf,
|
||||
CreatedAt: now,
|
||||
UpdatedAt: now,
|
||||
})
|
||||
rows = append(rows, model.BrandRunwayImage{
|
||||
RunwayID: runwayID,
|
||||
BrandID: draft.BrandID,
|
||||
Image: im.Image,
|
||||
Name: im.Name,
|
||||
SortOrder: uint32(i + 1),
|
||||
LookIndex: im.LookIndex,
|
||||
IsDetail: im.IsDetail,
|
||||
Phash: im.Phash,
|
||||
IsDuplicate: im.IsDuplicate,
|
||||
DupOf: im.DupOf,
|
||||
CreatedAt: now,
|
||||
UpdatedAt: now,
|
||||
})
|
||||
}
|
||||
if cErr := tx.Create(&rows).Error; cErr != nil {
|
||||
return cErr
|
||||
|
||||
@ -37,7 +37,7 @@ type DraftImageRef struct {
|
||||
SortOrder uint32 `json:"sort_order"`
|
||||
IsDetail uint8 `json:"is_detail"` // 1=副图(挂在 ParentImageID 指向的主图下);0=主图
|
||||
ParentImageID uint32 `json:"parent_image_id"` // 副图所属主图的行 id;主图为 0
|
||||
DetailCount int `json:"detail_count"` // 仅主图有意义:名下(存活)副图数量
|
||||
DetailCount int `json:"detail_count"` // 仅主图有意义:名下(存活)副图数量
|
||||
}
|
||||
|
||||
// EditField 审核详情页里可编辑字段的通用描述;详情页按此循环渲染输入框,
|
||||
|
||||
Reference in New Issue
Block a user