update
This commit is contained in:
@ -27,23 +27,23 @@ func NewBrandHandler(brands service.BrandService) *BrandHandler {
|
||||
//
|
||||
// 查询参数:
|
||||
// - letter A-Z 字母;other 表示中文分桶;缺省返回全部拉丁字母开头的品牌
|
||||
// - keyword 品牌名 / 展示名模糊搜索
|
||||
// - page / size 分页,size 默认 200、上限 500
|
||||
// - only_with_articles 默认 1,只返回有走秀档案的品牌;传 0 返回全部
|
||||
// - keyword 品牌名 / 展示名模糊搜索(不过滤"必须有走秀档案")
|
||||
// - page 页码(size 已写死 30,前端不传)
|
||||
// - featured 传 1 时只返回"代表品牌"精选集合
|
||||
// - metric 精选排名指标:images(默认)/ shows
|
||||
// - limit 精选集合大小,默认 200、上限 500
|
||||
//
|
||||
// 注:原 only_with_articles 参数已删除——字母索引始终只返回有走秀档案的品牌,
|
||||
// 该过滤不再可由调用方关闭。
|
||||
func (h *BrandHandler) List(c *gin.Context) {
|
||||
q := dto.BrandQuery{
|
||||
Letter: strings.ToUpper(strings.TrimSpace(c.Query("letter"))),
|
||||
Keyword: strings.TrimSpace(c.Query("keyword")),
|
||||
Page: queryInt(c, "page", 1),
|
||||
Size: queryInt(c, "size", 200),
|
||||
OnlyWithArticles: queryBool(c, "only_with_articles", true),
|
||||
Featured: queryBool(c, "featured", false),
|
||||
Metric: strings.ToLower(strings.TrimSpace(c.Query("metric"))),
|
||||
Limit: queryInt(c, "limit", 200),
|
||||
Locale: parseLocale(c),
|
||||
Letter: strings.ToUpper(strings.TrimSpace(c.Query("letter"))),
|
||||
Keyword: strings.TrimSpace(c.Query("keyword")),
|
||||
Page: queryInt(c, "page", 1),
|
||||
Featured: queryBool(c, "featured", false),
|
||||
Metric: strings.ToLower(strings.TrimSpace(c.Query("metric"))),
|
||||
Limit: queryInt(c, "limit", 200),
|
||||
Locale: parseLocale(c),
|
||||
}
|
||||
q.Normalize()
|
||||
|
||||
@ -52,5 +52,5 @@ func (h *BrandHandler) List(c *gin.Context) {
|
||||
fail(c, err)
|
||||
return
|
||||
}
|
||||
response.Page(c, http.StatusOK, list, total, q.Page, q.Size)
|
||||
response.Page(c, http.StatusOK, list, total, q.Size)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user