Commit db48279e authored by zhz's avatar zhz

goods

parent 51a390ab
...@@ -946,23 +946,17 @@ class GoodsCommonServiceModel extends \Business\AbstractModel ...@@ -946,23 +946,17 @@ class GoodsCommonServiceModel extends \Business\AbstractModel
// if($goodsCommonRedis->tableSIsMember('weekSales:'.$storeId, $goodsCommonId)) { // if($goodsCommonRedis->tableSIsMember('weekSales:'.$storeId, $goodsCommonId)) {
// $tempArr[] = $goodsCommonId; // $tempArr[] = $goodsCommonId;
// } // }
if($goodsCommonRedis->tableSIsMember('weekSales:'.$storeId, $goodsCommonId)) { $weekSales = $goodsCommonRedis->smembers('weekSales:'.$storeId);
$weekSales = $goodsCommonRedis->smembers('weekSales:'.$storeId); if($weekSales) {
if($weekSales) { $arr = array_merge(array_diff($weekSales, $existIds));
$arr = array_merge(array_diff($weekSales, $existIds)); if($arr) {
if($arr) { shuffle($arr);
shuffle($arr); $ret = array_pop($arr);
$ret = array_pop($arr); if($ret) {
if($ret) { $commonIds[] = $ret;
$commonIds[] = $ret; $existIds[] = $ret;
$existIds[] = $ret;
}
} }
} }
}else{
$arr = $goodsCommonRedis->tableSRandMember('weekSales:'.$storeId,1);
$commonIds = array_merge($commonIds,$arr);
$existIds = array_merge($existIds,$arr);
} }
//本周销售过的商品取两个 //本周销售过的商品取两个
...@@ -990,7 +984,7 @@ class GoodsCommonServiceModel extends \Business\AbstractModel ...@@ -990,7 +984,7 @@ class GoodsCommonServiceModel extends \Business\AbstractModel
} }
} }
} }
$recommendGoods = $goodsCommonRedis->smembers('weekSaleGoods:'.$storeId); $recommendGoods = $goodsCommonRedis->smembers('recommendGoods:'.$storeId);
if($recommendGoods) { if($recommendGoods) {
$arr = array_merge(array_diff($recommendGoods, $existIds)); $arr = array_merge(array_diff($recommendGoods, $existIds));
if($arr) { if($arr) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment