shish 1 jaar geleden
bovenliggende
commit
6da89615d0
1 gewijzigde bestanden met toevoegingen van 15 en 8 verwijderingen
  1. 15 8
      app-ghs/controllers/ShopController.php

+ 15 - 8
app-ghs/controllers/ShopController.php

@@ -155,16 +155,23 @@ class ShopController extends BaseController
             }
         }
 
-        //显示和隐藏库存,同时影响到老客户和新注册客户 ssh 20250309
+        //显示和隐藏库存,同时影响到老客户和新注册客户 ssh 20250309 暂时由石少华改,可以影响到所有人
         $showStock = $post['showStock'] ?? 0;
         $shopId = $this->shopId;
-        $customList = CustomClass::getAllByCondition(['ownShopId' => $shopId], null, 'id,ghsId,ownShopId', null, true);
-        if (!empty($customList)) {
-            foreach ($customList as $key => $custom) {
-                $ghsId = $custom->ghsId ?? 0;
-                $customId = $custom->id;
-                CustomClass::updateById($customId, ['showStock' => $showStock]);
-                GhsClass::updateById($ghsId, ['showStock' => $showStock]);
+        if (getenv('YII_ENV') == 'production') {
+            $adminIds = [4];
+        } else {
+            $adminIds = [919];
+        }
+        if (in_array($this->adminId, $adminIds)) {
+            $customList = CustomClass::getAllByCondition(['ownShopId' => $shopId], null, 'id,ghsId,ownShopId', null, true);
+            if (!empty($customList)) {
+                foreach ($customList as $key => $custom) {
+                    $ghsId = $custom->ghsId ?? 0;
+                    $customId = $custom->id;
+                    CustomClass::updateById($customId, ['showStock' => $showStock]);
+                    GhsClass::updateById($ghsId, ['showStock' => $showStock]);
+                }
             }
         }