|
|
|
@ -107,13 +107,20 @@ func QueryGoodsListByComprehension(c *gin.Context) {
|
|
|
|
|
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)
|
|
|
|
|
filters := map[string]interface{}{}
|
|
|
|
|
if p.SecondCategoryID > 0 {
|
|
|
|
|
filters["brand_id"] = p.BrandID
|
|
|
|
|
}
|
|
|
|
|
if p.SecondCategoryID > 0 {
|
|
|
|
|
filters["second_category_id"] = p.SecondCategoryID
|
|
|
|
|
}
|
|
|
|
|
findByKeyWord(q3, p.Keyword, filters, &goodsList, p.Page, p.IsSale, false)
|
|
|
|
|
back.Suc(c, "", GetGoodsRespByInfoList(goodsList, p.UserId, p.IsSale))
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func findByKeyWord(q *gorm2.DB, str string, data *[]goods.Information, page uint, isSale bool, isCondition bool) {
|
|
|
|
|
func findByKeyWord(q *gorm2.DB, str string, filters map[string]interface{}, data *[]goods.Information, page uint, isSale bool, isCondition bool) {
|
|
|
|
|
if str != "" {
|
|
|
|
|
gl, _, _ := search_ali.SearchByAliES(str, isSale, 20, int(page))
|
|
|
|
|
gl, _, _ := search_ali.SearchByAliES(str, filters, isSale, 20, int(page))
|
|
|
|
|
q = q.Where("a.id in (?)", gl)
|
|
|
|
|
if !isCondition {
|
|
|
|
|
q = q.Clauses(clause.OrderBy{
|
|
|
|
@ -167,7 +174,14 @@ func QueryGoodsListBySalesVolume(c *gin.Context) {
|
|
|
|
|
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)
|
|
|
|
|
}
|
|
|
|
|
findByKeyWord(q3, p.Keyword, &goodsList, p.Page, p.IsSale, true)
|
|
|
|
|
filters := map[string]interface{}{}
|
|
|
|
|
if p.SecondCategoryID > 0 {
|
|
|
|
|
filters["brand_id"] = p.BrandID
|
|
|
|
|
}
|
|
|
|
|
if p.SecondCategoryID > 0 {
|
|
|
|
|
filters["second_category_id"] = p.SecondCategoryID
|
|
|
|
|
}
|
|
|
|
|
findByKeyWord(q3, p.Keyword, filters, &goodsList, p.Page, p.IsSale, true)
|
|
|
|
|
back.Suc(c, "", GetGoodsRespByInfoList(goodsList, p.UserId, p.IsSale))
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -204,7 +218,14 @@ func QueryGoodsListByDiscountPrice(c *gin.Context) {
|
|
|
|
|
q3 = q3.Where("id in (?) and sale_publish = 1 and is_sale= 1", sub)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
findByKeyWord(q3, p.Keyword, &goodsList, p.Page, p.IsSale, true)
|
|
|
|
|
filters := map[string]interface{}{}
|
|
|
|
|
if p.SecondCategoryID > 0 {
|
|
|
|
|
filters["brand_id"] = p.BrandID
|
|
|
|
|
}
|
|
|
|
|
if p.SecondCategoryID > 0 {
|
|
|
|
|
filters["second_category_id"] = p.SecondCategoryID
|
|
|
|
|
}
|
|
|
|
|
findByKeyWord(q3, p.Keyword, filters, &goodsList, p.Page, p.IsSale, true)
|
|
|
|
|
back.Suc(c, "", GetGoodsRespByInfoList(goodsList, p.UserId, p.IsSale))
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|