update
This commit is contained in:
@ -19,11 +19,12 @@ import (
|
||||
type SSGHandler struct {
|
||||
brands service.BrandService
|
||||
index service.IndexService
|
||||
snaps service.StreetSnapService
|
||||
}
|
||||
|
||||
// NewSSGHandler 创建 SSG handler。
|
||||
func NewSSGHandler(brands service.BrandService, index service.IndexService) *SSGHandler {
|
||||
return &SSGHandler{brands: brands, index: index}
|
||||
func NewSSGHandler(brands service.BrandService, index service.IndexService, snaps service.StreetSnapService) *SSGHandler {
|
||||
return &SSGHandler{brands: brands, index: index, snaps: snaps}
|
||||
}
|
||||
|
||||
// IndexRunway 首页(/index/)runway 区块数据。
|
||||
@ -58,4 +59,15 @@ func (h *SSGHandler) HotBrands(c *gin.Context) {
|
||||
response.Data(c, http.StatusOK, list)
|
||||
}
|
||||
|
||||
|
||||
// StreetSnapPopular 首页热门街拍(按图片数前 N,返回完整对象含封面)。
|
||||
//
|
||||
// GET /api/v1/ssg/street-snaps/popular
|
||||
func (h *SSGHandler) StreetSnapPopular(c *gin.Context) {
|
||||
const limit = 20
|
||||
list, err := h.snaps.Popular(c.Request.Context(), limit)
|
||||
if err != nil {
|
||||
fail(c, err)
|
||||
return
|
||||
}
|
||||
response.Data(c, http.StatusOK, list)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user