Commit a7799d85 authored by zhz's avatar zhz

bug2862,2868

parent 9cff256a
...@@ -279,10 +279,12 @@ class GoodsCommonServiceModel extends \Business\AbstractModel ...@@ -279,10 +279,12 @@ class GoodsCommonServiceModel extends \Business\AbstractModel
case 1: case 1:
$order[] = ['sale_num','DESC']; $order[] = ['sale_num','DESC'];
$order[] = ['eval_score','DESC']; $order[] = ['eval_score','DESC'];
$order[] = ['goodsCommonId','DESC'];
$saleSort = true; $saleSort = true;
break; break;
case 2: case 2:
$order[] = ['sale_num','DESC']; $order[] = ['sale_num','DESC'];
$order[] = ['goodsCommonId','DESC'];
$saleSort = true; $saleSort = true;
break; break;
case 3: case 3:
...@@ -297,6 +299,8 @@ class GoodsCommonServiceModel extends \Business\AbstractModel ...@@ -297,6 +299,8 @@ class GoodsCommonServiceModel extends \Business\AbstractModel
default: default:
$order[] = ['sale_num','DESC']; $order[] = ['sale_num','DESC'];
$order[] = ['eval_score','DESC']; $order[] = ['eval_score','DESC'];
$order[] = ['goodsCommonId','DESC'];
$saleSort = true;
break; break;
} }
return array($where,$order,$attrStr,$saleSort); return array($where,$order,$attrStr,$saleSort);
...@@ -458,7 +462,6 @@ class GoodsCommonServiceModel extends \Business\AbstractModel ...@@ -458,7 +462,6 @@ class GoodsCommonServiceModel extends \Business\AbstractModel
if($pageSize === 0){ if($pageSize === 0){
\Error\ErrorModel::throwException(\Error\CodeConfigModel::commonError); \Error\ErrorModel::throwException(\Error\CodeConfigModel::commonError);
} }
$limit = array($pageIndex*$pageSize,$pageSize); $limit = array($pageIndex*$pageSize,$pageSize);
$where = array(); $where = array();
$where[] = "store_id={$storeId}"; $where[] = "store_id={$storeId}";
......
...@@ -399,11 +399,14 @@ class StoreServiceModel extends \Business\AbstractModel{ ...@@ -399,11 +399,14 @@ class StoreServiceModel extends \Business\AbstractModel{
public function getRecommendGoods($storeId,$activities){ public function getRecommendGoods($storeId,$activities){
$storeClassDAO = \DAO\StoreGoodsClassModel::getInstance(); $storeClassDAO = \DAO\StoreGoodsClassModel::getInstance();
$tempStcs = $storeClassDAO->getList(array('store_id'=>$storeId),'stc_id,stc_name'); $tempStcs = $storeClassDAO->getList(array('store_id'=>$storeId),'stc_id,stc_name');
$recommendGoods = [];
if($tempStcs) { if($tempStcs) {
$storeClassGoodsDao = \DAO\StoreGoodsClassGoodsModel::getInstance(); $storeClassGoodsDao = \DAO\StoreGoodsClassGoodsModel::getInstance();
$stcGoods = $storeClassGoodsDao->getList('stc_id in('.implode(',',array_column($tempStcs,'stc_id')).')','stc_id,goods_common_id'); $stcGoods = $storeClassGoodsDao->getList('stc_id in('.implode(',',array_column($tempStcs,'stc_id')).')','stc_id,goods_common_id');
foreach ($tempStcs as $stc) {
$recommendGoods[$stc['stc_id']] = array('stcId'=>$stc['stc_id'],'stcName'=>$stc['stc_name'],'goods'=>[]);
}
} }
$recommendGoods = [];
if($stcGoods){ if($stcGoods){
$goodsIds = array_column($stcGoods,'goods_common_id'); $goodsIds = array_column($stcGoods,'goods_common_id');
$goodsCommonDAO = \DAO\GoodsCommonModel::getInstance(); $goodsCommonDAO = \DAO\GoodsCommonModel::getInstance();
...@@ -412,7 +415,6 @@ class StoreServiceModel extends \Business\AbstractModel{ ...@@ -412,7 +415,6 @@ class StoreServiceModel extends \Business\AbstractModel{
}else{ }else{
$tempGoods = $goodsCommonDAO->getListWithSale(array('han_goods_common.goods_commonid in('.implode(',',$goodsIds).')'),'goods_name,goods_image,goods_price,goods_marketprice,han_goods_common.goods_commonid,IFNULL(discount_price,han_goods_common.goods_price) AS goodsPrice',$activities); $tempGoods = $goodsCommonDAO->getListWithSale(array('han_goods_common.goods_commonid in('.implode(',',$goodsIds).')'),'goods_name,goods_image,goods_price,goods_marketprice,han_goods_common.goods_commonid,IFNULL(discount_price,han_goods_common.goods_price) AS goodsPrice',$activities);
} }
if($tempGoods && $tempStcs){ if($tempGoods && $tempStcs){
$stcs = []; $stcs = [];
foreach ($tempStcs as $v){ foreach ($tempStcs as $v){
...@@ -431,18 +433,19 @@ class StoreServiceModel extends \Business\AbstractModel{ ...@@ -431,18 +433,19 @@ class StoreServiceModel extends \Business\AbstractModel{
'goodsPrice'=>$goods[$v['goods_common_id']]['goodsPrice'], 'goodsPrice'=>$goods[$v['goods_common_id']]['goodsPrice'],
'goodsMarketPrice'=>$goods[$v['goods_common_id']]['goods_marketprice'], 'goodsMarketPrice'=>$goods[$v['goods_common_id']]['goods_marketprice'],
]; ];
if(key_exists($v['stc_id'],$recommendGoods)){ array_push($recommendGoods[$v['stc_id']]['goods'],$good);
if(count($recommendGoods[$v['stc_id']]['goods']) >= 8){ // if(key_exists($v['stc_id'],$recommendGoods)){
continue; // if(count($recommendGoods[$v['stc_id']]['goods']) >= 8){
} // continue;
array_push($recommendGoods[$v['stc_id']]['goods'],$good); // }
}else{ // array_push($recommendGoods[$v['stc_id']]['goods'],$good);
$recommendGoods[$v['stc_id']] = [ // }else{
'stcId'=>$v['stc_id'], // $recommendGoods[$v['stc_id']] = [
'stcName'=>$stcs[$v['stc_id']]['stc_name'], // 'stcId'=>$v['stc_id'],
'goods'=>array($good) // 'stcName'=>$stcs[$v['stc_id']]['stc_name'],
]; // 'goods'=>array($good)
} // ];
// }
} }
} }
$tempRecommendGoods = array(); $tempRecommendGoods = array();
......
File mode changed from 100755 to 100644
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