Bladeren bron

qs xcx ProdutEmploySort

abiao 1 jaar geleden
bovenliggende
commit
5367c51af9
1 gewijzigde bestanden met toevoegingen van 5 en 3 verwijderingen
  1. 5 3
      go/gopath/src/fohow.com/apps/models/product_model/product.go

+ 5 - 3
go/gopath/src/fohow.com/apps/models/product_model/product.go

@@ -166,12 +166,12 @@ func GetLatest(page, perPage, recommend, priceSort, saleSort, saleZone, depart i
 	}
 	sql := `
 	  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; 
 	`
 	sql = fmt.Sprintf(sql, saleZoneSql, orderSql, (page-1)*perPage, perPage)
 	//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 {
 		beego.BeeLogger.Debug("GetLatest err=%s", err)
@@ -605,8 +605,10 @@ func DepartGetProductsByCatId(cId, saleZone, page, perPage, priceSort, saleSort,
 	}
 
 	var cidSql string
-	if cId != 0 {
+	if cId != 0 && cId != ProdutEmploySort {
 		cidSql = fmt.Sprintf(" and a.category_id=%d", cId)
+	} else {
+		cidSql = fmt.Sprintf(" and a.category_id!=%d", ProdutEmploySort)
 	}
 	if saleZone != 0 {
 		cidSql = cidSql + fmt.Sprintf(" and a.sale_zone=%d", saleZone)