shish 1 ay önce
ebeveyn
işleme
f88d3565b3
1 değiştirilmiş dosya ile 5 ekleme ve 21 silme
  1. 5 21
      app-hd/controllers/GhsController.php

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

@@ -59,14 +59,8 @@ class GhsController extends BaseController
         if (empty($ghs)) {
             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('不是你的供货商呢');
-            }
+        if (isset($ghs['salt']) == false || $ghs['salt'] != $salt) {
+            util::fail('不是您的供货商');
         }
         $customId = $ghs['customId'] ?? 0;
         $custom = CustomClass::getById($customId);
@@ -190,7 +184,7 @@ class GhsController extends BaseController
         $where['ownShopId'] = $this->shopId;
         $where['delStatus'] = $delStatus;
 
-        $name = $get['name'] ?? '';
+        $name = isset($get['name']) ? $get['name'] : '';
         if (stringUtil::isLetter($name)) {
             $where['py'] = ['like', $name];
         } else {
@@ -227,22 +221,12 @@ 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;
-
-        if (!empty($salt)) {
-            if (!isset($ghsInfo['salt']) || $ghsInfo['salt'] != $salt) {
-                util::fail('不是您的批发店哈');
-            }
-        } else {
-            if (!isset($ghsInfo['ownShopId']) || $ghsInfo['ownShopId'] != $this->shopId) {
-                util::fail('不是你的批发店呢');
-            }
-        }
+        GhsClass::valid($ghsInfo, $this->shopId);
 
         //是否有充值送红包活动
         $ghsShopId = $ghsInfo['shopId'] ?? 0;
@@ -496,4 +480,4 @@ class GhsController extends BaseController
         util::complete();
     }
 
-}
+}