|
|
@@ -15,10 +15,11 @@ class ProductService extends BaseService
|
|
|
const OFTEN_CLASS_ID = '-2';
|
|
|
|
|
|
//组装分类花材数据
|
|
|
- public static function assembleData($classIds,$itemIdsInfo,$itemInfoData,$oftenItemIds,$type)
|
|
|
+ public static function assembleData($classIds,$itemIdsInfo,$itemInfoData,$oftenItemIds,$type,$showSale=false)
|
|
|
{
|
|
|
$oftenItemInfoData = [];
|
|
|
$allData = [];
|
|
|
+ $saleItem = []; //今日特价
|
|
|
if($itemInfoData){
|
|
|
foreach ($itemInfoData as $v){
|
|
|
// if(in_array($v['itemId'],$oftenItemIds)){
|
|
|
@@ -26,6 +27,10 @@ class ProductService extends BaseService
|
|
|
// $oftenItemInfoData[] = $v;
|
|
|
// }
|
|
|
$v['classId'] = self::ALL_CLASS_ID;
|
|
|
+ if($v['price'] < $v['cost']+ $v['addPrice']){
|
|
|
+ //特价
|
|
|
+ $saleItem[] = $v;
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -37,11 +42,12 @@ class ProductService extends BaseService
|
|
|
}
|
|
|
}
|
|
|
//全部, 常用, 各个分类
|
|
|
- $allData = [
|
|
|
+ //常用改为今日特价
|
|
|
+ $saleData = [
|
|
|
[
|
|
|
'classId'=> self::ALL_CLASS_ID,
|
|
|
- 'className'=>'全部',
|
|
|
- 'child'=>$allData,
|
|
|
+ 'className'=>'今日特价',
|
|
|
+ 'child'=>$saleItem,
|
|
|
]
|
|
|
];
|
|
|
//常用
|
|
|
@@ -90,7 +96,9 @@ class ProductService extends BaseService
|
|
|
|
|
|
}
|
|
|
|
|
|
-
|
|
|
+ if($showSale && !empty($saleItem)){
|
|
|
+ $classData = array_merge($saleData,$classData);
|
|
|
+ }
|
|
|
//$data = array_merge($oftenData,$allData,$classData);
|
|
|
//去除全部
|
|
|
//隐藏常用
|