update
This commit is contained in:
@ -44,6 +44,8 @@ func (h *StreetSnapHandler) List(c *gin.Context) {
|
||||
fail(c, err)
|
||||
return
|
||||
}
|
||||
// 列表首屏对游客完全公开(翻页门槛由 PublicFirstPageAuth 兜底),不做预览截断——
|
||||
// 「未登录限制」已转移到详情页:每篇图集最多看 PreviewLimit 张图片,列表照常展示全部专辑。
|
||||
response.Page(c, http.StatusOK, list, total, q.Size)
|
||||
}
|
||||
|
||||
@ -81,5 +83,15 @@ func (h *StreetSnapHandler) Detail(c *gin.Context) {
|
||||
fail(c, err)
|
||||
return
|
||||
}
|
||||
response.Data(c, http.StatusOK, detail)
|
||||
|
||||
// 未登录:图片集仅返回预览上限(PreviewLimit)张,并打 preview=true,
|
||||
// 前端据此在详情页展示「登录查看全部图片」门禁;已登录(带有效 Bearer)返回完整图片集。
|
||||
anon := isAnon(c)
|
||||
preview := false
|
||||
imageTotal := len(detail.Images)
|
||||
if anon && imageTotal > dto.PreviewLimit {
|
||||
detail.Images = detail.Images[:dto.PreviewLimit]
|
||||
preview = true
|
||||
}
|
||||
response.DataPreview(c, http.StatusOK, detail, preview, imageTotal)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user