|
|
@@ -9,15 +9,22 @@ class ProductService extends BaseService
|
|
|
|
|
|
public static $baseFile = '\bizGhs\product\classes\ProductClass';
|
|
|
|
|
|
+ const ALL_CLASS_ID = '-1';
|
|
|
+ const OFTEN_CLASS_ID = '-2';
|
|
|
+
|
|
|
//组装分类花材数据
|
|
|
public static function assembleData($classIds,$itemIdsInfo,$itemInfoData,$oftenItemIds)
|
|
|
{
|
|
|
$oftenItemInfoData = [];
|
|
|
+ $allData = [];
|
|
|
if($itemInfoData){
|
|
|
foreach ($itemInfoData as $v){
|
|
|
if(in_array($v['itemId'],$oftenItemIds)){
|
|
|
+ $v['classId'] = self::OFTEN_CLASS_ID;
|
|
|
$oftenItemInfoData[] = $v;
|
|
|
}
|
|
|
+ $v['classId'] = self::ALL_CLASS_ID;
|
|
|
+ $allData[] = $v;
|
|
|
}
|
|
|
}
|
|
|
//classId=>itemId
|
|
|
@@ -30,15 +37,15 @@ class ProductService extends BaseService
|
|
|
//全部, 常用, 各个分类
|
|
|
$allData = [
|
|
|
[
|
|
|
- 'classId'=> -1,
|
|
|
+ 'classId'=> self::ALL_CLASS_ID,
|
|
|
'className'=>'全部',
|
|
|
- 'child'=>$itemInfoData,
|
|
|
+ 'child'=>$allData,
|
|
|
]
|
|
|
];
|
|
|
//常用
|
|
|
$oftenData = [
|
|
|
[
|
|
|
- 'classId'=> -2,
|
|
|
+ 'classId'=> self::OFTEN_CLASS_ID,
|
|
|
'className'=>'常用',
|
|
|
'child'=>$oftenItemInfoData,
|
|
|
]
|
|
|
@@ -54,7 +61,9 @@ class ProductService extends BaseService
|
|
|
if($items){
|
|
|
foreach ($itemInfoData as $v){
|
|
|
if(in_array($v['itemId'],$items)){
|
|
|
+ $v['classId'] = $classId; //前端要求增加classId 2021.1.31 linqh
|
|
|
$tmp['child'][] = $v;
|
|
|
+
|
|
|
}
|
|
|
}
|
|
|
}else{
|
|
|
@@ -64,7 +73,9 @@ class ProductService extends BaseService
|
|
|
}
|
|
|
|
|
|
}
|
|
|
- $data = array_merge($oftenData,$allData,$classData);
|
|
|
+ //$data = array_merge($oftenData,$allData,$classData);
|
|
|
+ //去除全部
|
|
|
+ $data = array_merge($oftenData,$classData);
|
|
|
|
|
|
return $data;
|
|
|
}
|