shish пре 4 година
родитељ
комит
5b5aec01e0
1 измењених фајлова са 8 додато и 6 уклоњено
  1. 8 6
      app-hd/controllers/AuthController.php

+ 8 - 6
app-hd/controllers/AuthController.php

@@ -45,22 +45,24 @@ class AuthController extends PublicController
         $cacheKey = 'SHOP_MINI_SESSION_KEY_' . $miniOpenId;
         $sessionKey = Yii::$app->redis->executeCommand('GET', [$cacheKey]);
         if (empty($sessionKey)) {
-            util::fail('登录失败了哦');
+            Yii::$app->redis->executeCommand('DEL', [$cacheKey]);
+            noticeUtil::push($cacheKey . " 登录失败!!sessionKey空的", '15280215347');
+            util::success(['hasNoOpenId' => 1], '登录失败');
         }
         $wxMiniSecret = Yii::getAlias("@vendor/weixinMiniSecret");
         require_once($wxMiniSecret . '/wxBizDataCrypt.php');
         $pc = new \WXBizDataCrypt($appId, $sessionKey);
         $errCode = $pc->decryptData($encryptedData, $iv, $result);
         if ($errCode != 0) {
-            noticeUtil::push($cacheKey . " 登录失败", '15280215347');
-            util::fail('登录失败...');
+            Yii::$app->redis->executeCommand('DEL', [$cacheKey]);
+            noticeUtil::push($cacheKey . " 登录失败!!!!sessionKey异常", '15280215347');
+            util::success(['hasNoOpenId' => 1], '登录失败');
         }
         $arr = Json::decode($result);
         $phoneNumber = isset($arr['purePhoneNumber']) ? $arr['purePhoneNumber'] : '';
         if (empty($phoneNumber)) {
-            noticeUtil::push($cacheKey . " 登录失败...", '15280215347');
-            util::fail('登录失败了');
-            //Yii::$app->redis->executeCommand('DEL', [$cacheKey]);
+            noticeUtil::push($cacheKey . " 登录失败了!获取手机号失败", '15280215347');
+            util::success(['hasNoOpenId' => 1], '登录失败');
         }
         $admin = AdminService::getByCondition(['mobile' => $phoneNumber]);
         if (empty($admin)) {