fix:销量排序

master
howell 3 years ago
parent e14cf1a9c0
commit e2e86803af

@ -153,10 +153,9 @@ func QueryGoodsListBySalesVolume(c *gin.Context) {
if p.IsSale {
status = 0
}
var goodsList []goods.Information
order := fmt.Sprintf("sales_volume + sales_volume_inc %s, id desc", p.Order)
q3 := mysql2.Db.Table("recook_goods_info as a").Order(order).Where(goods.Information{
order := fmt.Sprintf("vol %s, id desc", p.Order)
q3 := mysql2.Db.Select("a.*, b.vol").Table("recook_goods_info as a").Joins("JOINS (SELECT goods_id, sum(sales_volume + sales_volume_inc ) as vol FROM recook_goods_sku GROUP BY goods_id) as b on a.id = b.goods_id ").Order(order).Where(goods.Information{
BrandID: p.BrandID,
SecondCategoryID: p.SecondCategoryID,
PublishStatus: uint(status),

Loading…
Cancel
Save