shish hace 5 años
padre
commit
eba6afca61
Se han modificado 1 ficheros con 11 adiciones y 5 borrados
  1. 11 5
      app-hd/controllers/ProductController.php

+ 11 - 5
app-hd/controllers/ProductController.php

@@ -7,6 +7,7 @@
 namespace hd\controllers;
 
 use biz\ghs\classes\GhsClass;
+use biz\shop\classes\ShopClass;
 use bizGhs\admin\classes\AdminClass;
 use bizGhs\item\classes\ItemClassClass;
 use bizGhs\product\classes\ProductClass;
@@ -113,18 +114,23 @@ class ProductController extends BaseController
     {
         $get = Yii::$app->request->get();
         $id = $get['id'] ?? 0;
-        $ghsShopId = $get['shopId'] ?? 0;
+        $shopId = $get['shopId'] ?? 0;
         if (empty($id)) {
-            $ghs = GhsClass::build($ghsShopId, $this->shopId, $this->sjId);
+            if (!empty($this->shopId)) {
+                $ghs = GhsClass::build($shopId, $this->shopId, $this->sjId);
+                $sjId = $ghs['ghsSjId'] ?? 0;
+            } else {
+                $shop = ShopClass::getShopInfo($shopId);
+                $sjId = $shop['sjId'] ?? 0;
+            }
         } else {
             $ghs = GhsClass::getGhsInfo($id);
+            $sjId = $ghs['ghsSjId'] ?? 0;
         }
         if (empty($ghs)) {
             util::fail('供货商无效');
         }
-        $shopId = $ghs['ghsShopId'] ?? 0;
-        $sjId = $ghs['ghsSjId'] ?? 0;
-        AdminClass::addRecentShop($shopId, $this->admin);
+
         //获取所有当前供应商的分类 (全部、常用)
         //根据分类组装分类下的花材信息
         $classIds = ItemClassClass::getGhsItemClassAll($sjId);