|
@@ -166,12 +166,12 @@ func GetLatest(page, perPage, recommend, priceSort, saleSort, saleZone, depart i
|
|
|
}
|
|
}
|
|
|
sql := `
|
|
sql := `
|
|
|
select a.* from products a left join depart_records_products b on a.id=b.product_id
|
|
select a.* from products a left join depart_records_products b on a.id=b.product_id
|
|
|
- where a.status = ? and a.recommend > ? and a.show_flag=? and a.ptype=? and (b.depart_record_id=? or b.depart_record_id is null ) %s
|
|
|
|
|
|
|
+ where a.status = ? and a.recommend > ? and a.show_flag=? and a.ptype=? and a.category_id!=? and (b.depart_record_id=? or b.depart_record_id is null ) %s
|
|
|
order by %s limit %d, %d;
|
|
order by %s limit %d, %d;
|
|
|
`
|
|
`
|
|
|
sql = fmt.Sprintf(sql, saleZoneSql, orderSql, (page-1)*perPage, perPage)
|
|
sql = fmt.Sprintf(sql, saleZoneSql, orderSql, (page-1)*perPage, perPage)
|
|
|
//beego.BeeLogger.Warn("sql=%s", sql)
|
|
//beego.BeeLogger.Warn("sql=%s", sql)
|
|
|
- _, err := orm.NewOrm().Raw(sql, 1, recommend, true, ptype, depart).QueryRows(&products)
|
|
|
|
|
|
|
+ _, err := orm.NewOrm().Raw(sql, 1, recommend, true, ptype, ProdutEmploySort, depart).QueryRows(&products)
|
|
|
|
|
|
|
|
if err != nil {
|
|
if err != nil {
|
|
|
beego.BeeLogger.Debug("GetLatest err=%s", err)
|
|
beego.BeeLogger.Debug("GetLatest err=%s", err)
|
|
@@ -605,8 +605,10 @@ func DepartGetProductsByCatId(cId, saleZone, page, perPage, priceSort, saleSort,
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
var cidSql string
|
|
var cidSql string
|
|
|
- if cId != 0 {
|
|
|
|
|
|
|
+ if cId != 0 && cId != ProdutEmploySort {
|
|
|
cidSql = fmt.Sprintf(" and a.category_id=%d", cId)
|
|
cidSql = fmt.Sprintf(" and a.category_id=%d", cId)
|
|
|
|
|
+ } else {
|
|
|
|
|
+ cidSql = fmt.Sprintf(" and a.category_id!=%d", ProdutEmploySort)
|
|
|
}
|
|
}
|
|
|
if saleZone != 0 {
|
|
if saleZone != 0 {
|
|
|
cidSql = cidSql + fmt.Sprintf(" and a.sale_zone=%d", saleZone)
|
|
cidSql = cidSql + fmt.Sprintf(" and a.sale_zone=%d", saleZone)
|