shish 1 hónapja
szülő
commit
c658eec77d
1 módosított fájl, 21 hozzáadás és 5 törlés
  1. 21 5
      app-hd/controllers/GhsController.php

+ 21 - 5
app-hd/controllers/GhsController.php

@@ -59,8 +59,14 @@ class GhsController extends BaseController
         if (empty($ghs)) {
             util::fail('没有找到供货商的信息哦');
         }
-        if (isset($ghs['salt']) == false || $ghs['salt'] != $salt) {
-            util::fail('不是您的供货商');
+        if (!empty($salt)) {
+            if (!isset($ghs['salt']) || $ghs['salt'] != $salt) {
+                util::fail('不是您的供货商哈');
+            }
+        } else {
+            if (!isset($ghs['ownShopId']) || $ghs['ownShopId'] != $this->shopId) {
+                util::fail('不是你的供货商呢');
+            }
         }
         $customId = $ghs['customId'] ?? 0;
         $custom = CustomClass::getById($customId);
@@ -184,7 +190,7 @@ class GhsController extends BaseController
         $where['ownShopId'] = $this->shopId;
         $where['delStatus'] = $delStatus;
 
-        $name = isset($get['name']) ? $get['name'] : '';
+        $name = $get['name'] ?? '';
         if (stringUtil::isLetter($name)) {
             $where['py'] = ['like', $name];
         } else {
@@ -221,12 +227,22 @@ class GhsController extends BaseController
     public function actionDetail()
     {
         $id = Yii::$app->request->get('id');
+        $salt = Yii::$app->request->get('salt');
         $ghsInfo = GhsClass::getGhsInfo($id);
         $giveLevel = $ghsInfo['giveLevel'] ?? 0;
         $levelMap = CustomClass::$nickNameMap;
         $giveLevelName = $levelMap[$giveLevel] ?? '散客';
         $ghsInfo['giveLevelName'] = $giveLevelName;
-        GhsClass::valid($ghsInfo, $this->shopId);
+
+        if (!empty($salt)) {
+            if (!isset($ghsInfo['salt']) || $ghsInfo['salt'] != $salt) {
+                util::fail('不是您的批发店哈');
+            }
+        } else {
+            if (!isset($ghsInfo['ownShopId']) || $ghsInfo['ownShopId'] != $this->shopId) {
+                util::fail('不是你的批发店呢');
+            }
+        }
 
         //是否有充值送红包活动
         $ghsShopId = $ghsInfo['shopId'] ?? 0;
@@ -480,4 +496,4 @@ class GhsController extends BaseController
         util::complete();
     }
 
-}
+}