|
|
|
@ -11,8 +11,16 @@ import (
|
|
|
|
|
"github.com/gin-gonic/gin"
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
/*热销榜*/
|
|
|
|
|
type UserParam struct {
|
|
|
|
|
UserID uint
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func QueryHotSellGoodsList(c *gin.Context) {
|
|
|
|
|
var p UserParam
|
|
|
|
|
if err := tools.ParseParams(&p, c); err != nil {
|
|
|
|
|
back.Fail(c, err.Error())
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
var rankings []goods.HotSellRankings
|
|
|
|
|
dbc.DB.Select("goods_id").Limit(10).Offset(0).
|
|
|
|
|
Order("sales desc, clicks desc").Find(&rankings, "date = ?", time.Now().Format("2006-01-02"))
|
|
|
|
@ -30,7 +38,7 @@ func QueryHotSellGoodsList(c *gin.Context) {
|
|
|
|
|
dbc.DB.First(&goodsInfo, v)
|
|
|
|
|
goodsList = append(goodsList, goodsInfo)
|
|
|
|
|
}
|
|
|
|
|
list = GetGoodsRespByInfoList(goodsList)
|
|
|
|
|
list = GetGoodsRespByInfoList(goodsList, p.UserID)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
back.Suc(c, "", list)
|
|
|
|
@ -38,6 +46,7 @@ func QueryHotSellGoodsList(c *gin.Context) {
|
|
|
|
|
|
|
|
|
|
type ql struct {
|
|
|
|
|
Status uint `json:"status"`
|
|
|
|
|
UserID uint `json:"user_id"`
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func QueryRecommendList(c *gin.Context) {
|
|
|
|
@ -60,15 +69,18 @@ func QueryRecommendList(c *gin.Context) {
|
|
|
|
|
dbc.DB.First(&goodsInfo, v)
|
|
|
|
|
goodsList = append(goodsList, goodsInfo)
|
|
|
|
|
}
|
|
|
|
|
list = GetGoodsRespByInfoList(goodsList)
|
|
|
|
|
list = GetGoodsRespByInfoList(goodsList, p.UserID)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
back.Suc(c, "", list)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*瑞库制品*/
|
|
|
|
|
func QueryRecookMake(c *gin.Context) {
|
|
|
|
|
|
|
|
|
|
var p UserParam
|
|
|
|
|
if err := tools.ParseParams(&p, c); err != nil {
|
|
|
|
|
back.Fail(c, err.Error())
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
goodsIdList := []uint{23, 35, 66, 68, 173, 188, 227, 231, 314, 317}
|
|
|
|
|
|
|
|
|
|
list := make([]QueryCategoryGoodsListResp, 0, 0)
|
|
|
|
@ -79,15 +91,18 @@ func QueryRecookMake(c *gin.Context) {
|
|
|
|
|
dbc.DB.First(&goodsInfo, v)
|
|
|
|
|
goodsList = append(goodsList, goodsInfo)
|
|
|
|
|
}
|
|
|
|
|
list = GetGoodsRespByInfoList(goodsList)
|
|
|
|
|
list = GetGoodsRespByInfoList(goodsList, p.UserID)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
back.Suc(c, "", list)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*数码家电*/
|
|
|
|
|
func QueryDigital(c *gin.Context) {
|
|
|
|
|
|
|
|
|
|
var p UserParam
|
|
|
|
|
if err := tools.ParseParams(&p, c); err != nil {
|
|
|
|
|
back.Fail(c, err.Error())
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
goodsIdList := []uint{9, 12, 35, 44, 49, 311, 23, 39, 42, 27}
|
|
|
|
|
|
|
|
|
|
list := make([]QueryCategoryGoodsListResp, 0, 0)
|
|
|
|
@ -98,14 +113,18 @@ func QueryDigital(c *gin.Context) {
|
|
|
|
|
dbc.DB.First(&goodsInfo, v)
|
|
|
|
|
goodsList = append(goodsList, goodsInfo)
|
|
|
|
|
}
|
|
|
|
|
list = GetGoodsRespByInfoList(goodsList)
|
|
|
|
|
list = GetGoodsRespByInfoList(goodsList, p.UserID)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
back.Suc(c, "", list)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*家居生活*/
|
|
|
|
|
func QueryHomeLive(c *gin.Context) {
|
|
|
|
|
var p UserParam
|
|
|
|
|
if err := tools.ParseParams(&p, c); err != nil {
|
|
|
|
|
back.Fail(c, err.Error())
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
goodsIdList := []uint{2, 385, 22, 60, 293, 34, 124, 128, 157, 254}
|
|
|
|
|
|
|
|
|
@ -117,7 +136,7 @@ func QueryHomeLive(c *gin.Context) {
|
|
|
|
|
dbc.DB.First(&goodsInfo, v)
|
|
|
|
|
goodsList = append(goodsList, goodsInfo)
|
|
|
|
|
}
|
|
|
|
|
list = GetGoodsRespByInfoList(goodsList)
|
|
|
|
|
list = GetGoodsRespByInfoList(goodsList, p.UserID)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
back.Suc(c, "", list)
|
|
|
|
|