fix(publish): 后台详情与品牌列表改读基表,修复未发布内容在后台不可达

This commit is contained in:
toom1996
2026-09-23 10:16:09 +08:00
parent f5144038ab
commit 4169ebe1ed
9 changed files with 287 additions and 52 deletions

View File

@ -107,7 +107,10 @@ func (h *BackstageHandler) UserSetTier(c *gin.Context) {
c.Redirect(http.StatusFound, "/admin/users")
}
// Brands 品牌管理列表:支持关键词搜索、A-Z 字母索引、分页,复用 BrandService.List。
// Brands 品牌管理列表:支持关键词搜索、A-Z 字母索引、分页,复用 BrandService.AdminList。
//
// 必须用 AdminList:公开 List 的「必须有已发布走秀档案」子查询会把只有待审走秀的品牌挡掉,
// 后台需要仍能看到它们(否则待审品牌从后台列表消失)。
func (h *BackstageHandler) Brands(c *gin.Context) {
q := dto.BrandQuery{
Keyword: c.Query("keyword"),
@ -115,7 +118,7 @@ func (h *BackstageHandler) Brands(c *gin.Context) {
Page: atoiDefault(c.Query("page"), 1),
Locale: "en",
}
items, total, err := h.brand.List(c.Request.Context(), q)
items, total, err := h.brand.AdminList(c.Request.Context(), q)
if err != nil {
renderPage(c, http.StatusInternalServerError, "error", gin.H{"Error": err.Error()})
return
@ -225,7 +228,10 @@ func (h *BackstageHandler) Runways(c *gin.Context) {
})
}
// RunwayDetail 走秀详情:展示完整图集,复用 ArticleService.Detail。
// RunwayDetail 走秀详情:展示完整图集,复用 ArticleService.DetailAdmin(读基表,含待审)。
//
// 必须用 DetailAdmin:后台列表刻意展示 pending / rejected 行并链到本页,
// 公开的 ArticleService.Detail 读视图会把它们当不存在,导致待审项 404。
// 路由 :id 是 runway 类型化编码(无前缀,类型进密码),按 TypeRunway 解码(与公开接口 article_handler 一致)。
func (h *BackstageHandler) RunwayDetail(c *gin.Context) {
raw := c.Param("id")
@ -234,7 +240,7 @@ func (h *BackstageHandler) RunwayDetail(c *gin.Context) {
renderPage(c, http.StatusNotFound, "error", gin.H{"Error": "走秀不存在或已删除: " + raw})
return
}
art, err := h.article.Detail(c.Request.Context(), strconv.FormatUint(uint64(numeric), 10), "en")
art, err := h.article.DetailAdmin(c.Request.Context(), strconv.FormatUint(uint64(numeric), 10), "en")
if err != nil {
renderPage(c, http.StatusNotFound, "error", gin.H{"Error": "走秀不存在或已删除: " + raw})
return
@ -278,7 +284,10 @@ func (h *BackstageHandler) StreetSnaps(c *gin.Context) {
})
}
// StreetSnapDetail 街拍详情:展示完整图集,复用 StreetSnapService.Detail。
// StreetSnapDetail 街拍详情:展示完整图集,复用 StreetSnapService.DetailAdmin(读基表,含待审)。
//
// 必须用 DetailAdmin:后台列表刻意展示 pending / rejected 行并链到本页,
// 公开的 StreetSnapService.Detail 读视图会把它们当不存在,导致待审项 404。
// 路由 :id 是 snap 类型化编码(无前缀,类型进密码),按 TypeSnap 解码(与公开接口 street_snap_handler 一致)。
func (h *BackstageHandler) StreetSnapDetail(c *gin.Context) {
raw := c.Param("id")
@ -287,7 +296,7 @@ func (h *BackstageHandler) StreetSnapDetail(c *gin.Context) {
renderPage(c, http.StatusNotFound, "error", gin.H{"Error": "街拍不存在或已删除: " + raw})
return
}
snap, err := h.street.Detail(c.Request.Context(), strconv.FormatUint(uint64(numeric), 10))
snap, err := h.street.DetailAdmin(c.Request.Context(), strconv.FormatUint(uint64(numeric), 10))
if err != nil {
renderPage(c, http.StatusNotFound, "error", gin.H{"Error": "街拍不存在或已删除: " + raw})
return