|
|
@@ -8,12 +8,10 @@ namespace hd\controllers;
|
|
|
|
|
|
use biz\ghs\classes\GhsClass;
|
|
|
use bizGhs\admin\classes\AdminClass;
|
|
|
-use bizGhs\item\classes\ItemClass;
|
|
|
use bizGhs\item\classes\ItemClassClass;
|
|
|
use bizGhs\product\classes\ProductClass;
|
|
|
use bizGhs\product\services\ProductService;
|
|
|
use bizGhs\item\services\ItemService;
|
|
|
-use common\components\noticeUtil;
|
|
|
use common\components\util;
|
|
|
use Yii;
|
|
|
|
|
|
@@ -113,20 +111,25 @@ class ProductController extends BaseController
|
|
|
{
|
|
|
$get = Yii::$app->request->get();
|
|
|
$id = $get['id'] ?? 0;
|
|
|
- $ghs = GhsClass::getGhsInfo($id);
|
|
|
- if(empty($ghs)){
|
|
|
+ $ghsShopId = $get['shopId'] ?? 0;
|
|
|
+ if (empty($id)) {
|
|
|
+ $ghs = GhsClass::build($ghsShopId, $this->shopId, $this->sjId);
|
|
|
+ } else {
|
|
|
+ $ghs = GhsClass::getGhsInfo($id);
|
|
|
+ }
|
|
|
+ if (empty($ghs)) {
|
|
|
util::fail('供货商无效');
|
|
|
}
|
|
|
- $shopId = $ghs['ghsShopId']??0;
|
|
|
- $sjId = $ghs['ghsSjId']??0;
|
|
|
- AdminClass::addRecentShop($shopId,$this->admin);
|
|
|
+ $shopId = $ghs['ghsShopId'] ?? 0;
|
|
|
+ $sjId = $ghs['ghsSjId'] ?? 0;
|
|
|
+ AdminClass::addRecentShop($shopId, $this->admin);
|
|
|
//获取所有当前供应商的分类 (全部、常用)
|
|
|
//根据分类组装分类下的花材信息
|
|
|
$classIds = ItemClassClass::getGhsItemClassAll($sjId);
|
|
|
$where['merchantId'] = $sjId;
|
|
|
$where['shopId'] = $shopId;
|
|
|
|
|
|
- $itemInfoData = ProductClass::getAllByCondition($where,null,"*");
|
|
|
+ $itemInfoData = ProductClass::getAllByCondition($where, null, "*");
|
|
|
$itemInfoData = ProductClass::groupProductInfo($itemInfoData);
|
|
|
//常用的itemIds
|
|
|
$oftenItemIds = ProductClass::getOftenItemIds($shopId);
|
|
|
@@ -135,7 +138,7 @@ class ProductController extends BaseController
|
|
|
|
|
|
//dd($itemInfoData);
|
|
|
//组装数据: [{classId:'','className:'',child:[{itemInfoData}]}]
|
|
|
- $data = ProductService::assembleData($classIds, $itemIdsInfo,$itemInfoData, $oftenItemIds, '');
|
|
|
+ $data = ProductService::assembleData($classIds, $itemIdsInfo, $itemInfoData, $oftenItemIds, '');
|
|
|
|
|
|
util::success($data);
|
|
|
}
|