|
|
|
@ -94,8 +94,7 @@ func QueryGoodsListByComprehension(c *gin.Context) {
|
|
|
|
|
if p.IsSale {
|
|
|
|
|
status = 0
|
|
|
|
|
}
|
|
|
|
|
q3 := mysql2.Db.Table("recook_goods_info as a").
|
|
|
|
|
Order("id desc").Where(goods.Information{
|
|
|
|
|
q3 := mysql2.Db.Table("recook_goods_info as a").Where(goods.Information{
|
|
|
|
|
BrandID: p.BrandID,
|
|
|
|
|
SecondCategoryID: p.SecondCategoryID,
|
|
|
|
|
PublishStatus: uint(status),
|
|
|
|
@ -103,7 +102,11 @@ func QueryGoodsListByComprehension(c *gin.Context) {
|
|
|
|
|
if p.ActivityID != 0 {
|
|
|
|
|
// 批发活动id
|
|
|
|
|
sub := mysql2.Db.Table((&ac2.ActivityGoods{}).TableName()).Select("goods_id").Where("activity_id = ?", p.ActivityID)
|
|
|
|
|
q3 = q3.Where("id in (?) and sale_publish = 1 and is_sale = 1", sub)
|
|
|
|
|
ids := make([]uint, 0)
|
|
|
|
|
sub.Pluck("goods_id", ids)
|
|
|
|
|
q3 = q3.Clauses(clause.OrderBy{
|
|
|
|
|
Expression: clause.Expr{SQL: "FIELD(id,?)", Vars: []interface{}{ids}, WithoutParentheses: true}})
|
|
|
|
|
q3 = q3.Where("id in (?) and sale_publish = 1 and is_sale = 1", ids)
|
|
|
|
|
}
|
|
|
|
|
findByKeyWord(q3, p.Keyword, &goodsList, p.Page, p.IsSale, false)
|
|
|
|
|
back.Suc(c, "", GetGoodsRespByInfoList(goodsList, p.UserId, p.IsSale))
|
|
|
|
|