shish 1 tahun lalu
induk
melakukan
2691dad1b7
1 mengubah file dengan 21 tambahan dan 0 penghapusan
  1. 21 0
      app-ghs/controllers/ProductController.php

+ 21 - 0
app-ghs/controllers/ProductController.php

@@ -1255,6 +1255,27 @@ class ProductController extends BaseController
                 }
             }
         }
+
+        //判断这个花材能否被修改单位比和重量,同步参考ShopController actionMyShop方法,关键词has_right_shop_list
+        //判断当前登录的人,在自己有财务权限的main里面,是否包括了这个花材所属的平台id,同个平台id所有花材的main
+        $adminId = $this->adminId;
+        $staffList = ShopAdminClass::getAllByCondition(['adminId' => $adminId], null, '*', null, true);
+        $hasMainList = [];
+        if (!empty($staffList)) {
+            foreach ($staffList as $staff) {
+                $hasMainList[] = $staff->mainId;
+            }
+        }
+        $sameList = ProductClass::getAllByCondition(['itemId' => $ptItemId], null, 'id,itemId,mainId');
+        $sameMainList = array_column($sameList, 'mainId');
+        echo "<pre>";
+        print_r($sameMainList);
+        print_r($hasMainList);
+        die;
+        $hasNot = array_diff($sameMainList, $hasMainList);
+        $hasRightChange = empty($hasNot) ? 1 : 0;
+        $respond['hasRightChange'] = $hasRightChange;
+
         $respond['cpInfo'] = $cpInfo;
         util::success($respond);
     }