refactor(street): 审核页改为统一网格+勾选成组;移除并入上一张

This commit is contained in:
toom1996
2026-09-21 23:59:59 +08:00
parent 9807752e4e
commit 0d4000bba5
7 changed files with 63 additions and 206 deletions

View File

@ -70,9 +70,6 @@ type DraftDetailView struct {
Images []DraftImageRef `json:"images"`
// Fields 是审核前可微调的字段列表(按模块声明顺序渲染),替代模板里的 IsStreet 分支。
Fields []EditField `json:"fields"`
// MainID 审核页「当前主图」的行 id,来自 URL 查询参数 ?main=;0 表示未选定。
// 只有街拍模块会用到(走秀无主副图概念)。
MainID uint32 `json:"main_id"`
// Groups 街拍详情的「主图 → 其副图」分组视图(按 sort_order 顺序)。走秀模块留空。
// 与 Images 同源同序:Images 保持扁平(既有渲染 / runway 仍用),Groups 供按组折叠。
Groups []DraftImageGroup `json:"groups,omitempty"`
@ -127,8 +124,6 @@ type ReviewService interface {
DeleteDraftImage(ctx context.Context, kind string, draftID, imgID uint32) error
// AttachDraftImages 把若干张草稿图并入指定主图(街拍专用;走秀模块返回 ErrInvalidImageGroup)。
AttachDraftImages(ctx context.Context, kind string, draftID, mainImgID uint32, imgIDs []uint32) error
// AttachPrevDraftImage 把某张草稿图并入「同草稿内上一行所属组的主图」(街拍专用)。
AttachPrevDraftImage(ctx context.Context, kind string, draftID, imgID uint32) error
// DetachDraftImage 把副图拆出恢复为主图(街拍专用)。
DetachDraftImage(ctx context.Context, kind string, draftID, imgID uint32) error
// KindTabs 返回类型标签(含「全部」与每个模块的待审数),驱动大审核列表概览。
@ -299,13 +294,6 @@ func (s *reviewService) AttachDraftImages(ctx context.Context, kind string, draf
return translateGroupErr(s.repo.AttachStreetDraftImages(ctx, draftID, mainImgID, imgIDs))
}
func (s *reviewService) AttachPrevDraftImage(ctx context.Context, kind string, draftID, imgID uint32) error {
if kind != dto.IngestKindStreet {
return ErrInvalidImageGroup
}
return translateGroupErr(s.repo.AttachPrevStreetDraftImage(ctx, draftID, imgID))
}
func (s *reviewService) DetachDraftImage(ctx context.Context, kind string, draftID, imgID uint32) error {
if kind != dto.IngestKindStreet {
return ErrInvalidImageGroup
@ -490,8 +478,10 @@ func (m *streetModule) DraftDetail(ctx context.Context, id uint32) (*DraftDetail
root := resolveRoot(im.ID)
isDetail := root != im.ID
isDetailVal := uint8(0)
parent := uint32(0) // 副图徽标显示「所属主图」:取沿链归并后的根主图;主图恒为 0
if isDetail {
isDetailVal = 1
parent = root
}
ref := DraftImageRef{
ID: im.ID,
@ -499,7 +489,7 @@ func (m *streetModule) DraftDetail(ctx context.Context, id uint32) (*DraftDetail
Name: im.Name,
SortOrder: im.SortOrder,
IsDetail: isDetailVal,
ParentImageID: im.ParentImageID,
ParentImageID: parent,
DetailCount: detailCount[im.ID],
}
v.Images = append(v.Images, ref)