fix:你可能喜欢3

master
howell 3 years ago
parent 8c65b9c975
commit e7fd36836a

@ -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)

Loading…
Cancel
Save