|
|
|
@ -84,9 +84,11 @@ func (l logic) ViewLikeMayBe(userId uint, isSale bool) []goods3.QueryCategoryGoo
|
|
|
|
|
if isSale {
|
|
|
|
|
where = mysql2.Db.Where("sale_publish = 1 and is_sale = 1")
|
|
|
|
|
}
|
|
|
|
|
q := mysql2.Db
|
|
|
|
|
for _, v := range kw {
|
|
|
|
|
where = where.Or("goods_name like ?", fmt.Sprintf("%%%v%%", v))
|
|
|
|
|
q = q.Or("goods_name like ?", fmt.Sprintf("%%%v%%", v))
|
|
|
|
|
}
|
|
|
|
|
where = where.Where(q)
|
|
|
|
|
var goodsList []goods.Information
|
|
|
|
|
if len(kw) > 0 {
|
|
|
|
|
mysql2.Db.Table((&goods.Information{}).TableName()).Where(where).Order("RAND()").Limit(20).Find(&goodsList)
|
|
|
|
|