shish 5 gadi atpakaļ
vecāks
revīzija
6f7d1700c3
1 mainītis faili ar 10 papildinājumiem un 6 dzēšanām
  1. 10 6
      app-ghs/controllers/StockController.php

+ 10 - 6
app-ghs/controllers/StockController.php

@@ -2,6 +2,7 @@
 
 namespace ghs\controllers;
 
+use bizGhs\product\classes\ProductClass;
 use bizGhs\stock\classes\StockRecordClass;
 use common\components\dateUtil;
 use common\components\util;
@@ -10,16 +11,19 @@ use Yii;
 //库存管理与预警 linqh 2021.1.26
 class StockController extends BaseController
 {
-    //库存预警同花材列表共用一个接口
-    //库存管理同花材列表共用一个接口
 
     //库存明细 linqh 2021.1.26
     public function actionDetail()
     {
         $get = Yii::$app->request->get();
-        $itemId = $get['itemId']??0;
-        $where = ['itemId'=>$itemId,'shopId'=>$this->shopId];
+        $id = $get['id'] ?? 0;
 
+        $product = ProductClass::getById($id, true);
+        if (isset($product->shopId) == false || $product->shopId != $this->shopId) {
+            util::fail('没有权限');
+        }
+
+        $where = ['productId' => $id];
         $searchTime = $get['searchTime'] ?? '';
         if (!empty($searchTime)) {
             $startTime = $get['startTime'] ?? '';
@@ -27,8 +31,8 @@ class StockController extends BaseController
             $period = dateUtil::formatTime($searchTime, $startTime, $endTime);
             $where['addTime'] = ['between', [$period['startTime'], $period['endTime']]];
         }
-        
         $list = StockRecordClass::getRecordList($where);
         util::success($list);
     }
-}
+
+}