shish il y a 5 ans
Parent
commit
f460731431

+ 28 - 9
app-ghs/controllers/ProductController.php

@@ -7,6 +7,7 @@
 namespace ghs\controllers;
 
 
+use biz\admin\classes\AdminRoleClass;
 use bizGhs\admin\classes\AdminClass;
 use bizGhs\item\classes\ItemClass;
 use bizGhs\item\classes\ItemClassClass;
@@ -54,7 +55,7 @@ class ProductController extends BaseController
         $where['shopId'] = $shopId;
         $where['delStatus'] = 0;
 
-        $itemInfoData = ProductClass::getAllByCondition($where, ['actualSold'=>SORT_DESC,'inTurn'=>SORT_DESC], "*");
+        $itemInfoData = ProductClass::getAllByCondition($where, ['actualSold' => SORT_DESC, 'inTurn' => SORT_DESC], "*");
         $itemInfoData = ProductClass::groupProductInfo($itemInfoData);
         //常用的itemIds
         $oftenItemIds = ProductClass::getOftenItemIds($shopId);
@@ -94,10 +95,10 @@ class ProductController extends BaseController
             $shopId = $this->shopId;
         }
         $where['shopId'] = $shopId;
-        $productIds = Yii::$app->request->get('ids','');
-        if(!empty($productIds)){
-            $productIdArr = explode(',',$productIds);
-            if(!empty($productIdArr)){
+        $productIds = Yii::$app->request->get('ids', '');
+        if (!empty($productIds)) {
+            $productIdArr = explode(',', $productIds);
+            if (!empty($productIdArr)) {
                 $where['id'] = ['in', $productIdArr];
             }
         }
@@ -110,7 +111,7 @@ class ProductController extends BaseController
             $respond['list'] = ProductClass::groupClassName($this->sjId, $respond['list']);
             util::success($respond);
         }
-        $data = ProductClass::getAllByCondition($where, ['actualSold'=>SORT_DESC,'inTurn'=>SORT_DESC], "*");
+        $data = ProductClass::getAllByCondition($where, ['actualSold' => SORT_DESC, 'inTurn' => SORT_DESC], "*");
 
         $data = ProductClass::groupProductInfo($data);
         $data = ProductClass::groupClassName($this->sjId, $data);
@@ -208,13 +209,13 @@ class ProductController extends BaseController
         if (empty($data) || empty($type)) {
             util::fail("参数错误");
         }
-        if (in_array($type, ['inTurn', 'addPrice', 'cost', 'weight', 'ratio','delStatus'])){
+        if (in_array($type, ['inTurn', 'addPrice', 'cost', 'weight', 'ratio', 'delStatus'])) {
             $data = json_decode($data, true);
         }
         foreach ($data as $v) {
-            if($type=='delStatus'){
+            if ($type == 'delStatus') {
                 $val = $v[$type] ?? '';
-                if(!in_array($val,[0,1])){
+                if (!in_array($val, [0, 1])) {
                     util::fail("参数错误");
                 }
             }
@@ -242,6 +243,15 @@ class ProductController extends BaseController
     public function actionUpdate()
     {
         $post = Yii::$app->request->post();
+
+        $shopAdmin = $this->shopAdmin;
+        $roleId = $shopAdmin['roleId'] ?? 0;
+        $role = AdminRoleClass::getById($roleId);
+        $roleName = $role['roleName'] ?? '';
+        if ($roleName == '员工') {
+            util::fail('您没有权限操作哦');
+        }
+
         ProductClass::updateProduct($post);
         util::complete();
     }
@@ -258,6 +268,15 @@ class ProductController extends BaseController
     public function actionAdd()
     {
         $post = Yii::$app->request->post();
+
+        $shopAdmin = $this->shopAdmin;
+        $roleId = $shopAdmin['roleId'] ?? 0;
+        $role = AdminRoleClass::getById($roleId);
+        $roleName = $role['roleName'] ?? '';
+        if ($roleName == '员工') {
+            util::fail('您没有权限操作哦');
+        }
+
         ProductClass::addProduct($post);
         util::complete('添加成功');
     }

+ 1 - 1
app-ghs/controllers/PurchaseOrderController.php

@@ -25,7 +25,7 @@ class PurchaseOrderController extends BaseController
         $role = AdminRoleClass::getById($roleId);
         $roleName = $role['roleName'] ?? '';
         if ($roleName == '员工') {
-            util::fail('员工没有权限操作');
+            util::fail('您没有权限操作哦');
         }
 
         $ghsItemInfo = $post['itemInfo'] ?? '';

+ 1 - 1
app-ghs/controllers/StockInController.php

@@ -43,7 +43,7 @@ class StockInController extends BaseController
         $role = AdminRoleClass::getById($roleId);
         $roleName = $role['roleName'] ?? '';
         if ($roleName == '员工') {
-            util::fail('员工没有权限操作');
+            util::fail('您没有权限操作哦');
         }
 
         $orderSn = $get['orderSn'];

+ 1 - 1
app-ghs/controllers/StockOutController.php

@@ -35,7 +35,7 @@ class StockOutController extends BaseController
         $role = AdminRoleClass::getById($roleId);
         $roleName = $role['roleName'] ?? '';
         if ($roleName == '员工') {
-            util::fail('员工没有权限操作');
+            util::fail('您没有权限操作哦');
         }
 
         $post = Yii::$app->request->post();