shish 1 жил өмнө
parent
commit
3a135ff74d

+ 11 - 0
app-ghs/controllers/CustomController.php

@@ -32,6 +32,17 @@ class CustomController extends BaseController
         $post = Yii::$app->request->post();
         $shopId = $this->shopId;
         ShopClass::updateById($shopId, $post);
+
+        $showStock = $post['showStock'] ?? 0;
+        $arr = ['showStock' => $showStock];
+        $needCheck = $post['needCheck'] ?? 0;
+        if($needCheck == 1){
+            //如果新客需要审核,老的全部要打开为已经审核通过了
+            $arr['passStatus'] = 1;
+        }
+        CustomClass::updateByCondition(['ownShopId'=>$shopId], $arr);
+        GhsClass::updateByCondition(['shopId'=>$shopId], $arr);
+
         util::complete('修改成功');
     }
 

+ 0 - 20
app-ghs/controllers/ShopController.php

@@ -155,26 +155,6 @@ class ShopController extends BaseController
             }
         }
 
-        //显示和隐藏库存,同时影响到老客户和新注册客户 ssh 20250309 暂时由石少华改,可以影响到所有人
-        $showStock = $post['showStock'] ?? 0;
-        $shopId = $this->shopId;
-        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]);
-                }
-            }
-        }
-
         $post['meetNum'] = isset($post['meetNum']) && !empty($post['meetNum']) ? $post['meetNum'] : 0;
         $post['meetAmount'] = isset($post['meetAmount']) && !empty($post['meetAmount']) ? $post['meetAmount'] : 0;
         $post['cutAmount'] = isset($post['cutAmount']) && !empty($post['cutAmount']) ? $post['cutAmount'] : 0;