shish пре 3 година
родитељ
комит
cf3aaff9b1
1 измењених фајлова са 9 додато и 5 уклоњено
  1. 9 5
      app-hd/controllers/ProductController.php

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

@@ -387,13 +387,17 @@ class ProductController extends BaseController
     //供货商产品的详情 ssh 20230111
     //供货商产品的详情 ssh 20230111
     public function actionGhsProductDetail()
     public function actionGhsProductDetail()
     {
     {
-        $id = Yii::$app->request->get('id', 0);
+        $get = Yii::$app->request->get();
+        $id = $get['id'] ?? 0;
+        $ghsId = $get['ghsId'] ?? 0;
         $product = ProductClass::getById($id);
         $product = ProductClass::getById($id);
-        if (!empty($product)) {
-            $level = 1;
-            $list = ProductClass::groupProductInfo([$product], $level);
-            $product = current($list);
+        if (empty($product)) {
+            util::fail('没有花材信息');
         }
         }
+        $ghsInfo = GhsClass::getById($ghsId, true);
+        $level = $ghsInfo->giveLevel ? $ghsInfo->giveLevel : 1;
+        $list = ProductClass::groupProductInfo([$product], $level);
+        $product = current($list);
         util::success($product);
         util::success($product);
     }
     }