qiushang 1 年之前
父节点
当前提交
b4dc3e8a20
共有 2 个文件被更改,包括 11 次插入13 次删除
  1. 11 11
      app/Http/Api/WechatOfficialController.php
  2. 0 2
      app/Http/Home/SoftController.php

+ 11 - 11
app/Http/Api/WechatOfficialController.php

@@ -185,9 +185,9 @@ class WechatOfficialController extends HttpBaseController
         }
         }
 
 
         $oauthUrl = 'https://www.xingyousoft.com';
         $oauthUrl = 'https://www.xingyousoft.com';
-        if ($sceneStr) {
-            $oauthUrl = $this->app->oauth->withState(base64_encode($sceneStr))->redirect();
-        }
+        // if ($sceneStr) {
+        //     $oauthUrl = $this->app->oauth->withState(base64_encode($sceneStr))->redirect();
+        // }
 
 
         // 发送登录成功消息
         // 发送登录成功消息
         $this->app->template_message->send([
         $this->app->template_message->send([
@@ -411,19 +411,19 @@ class WechatOfficialController extends HttpBaseController
 
 
         if ($isSuccess) {
         if ($isSuccess) {
             // 保存生成token需要的信息
             // 保存生成token需要的信息
-            //$loginToken = new LoginTokenService($this->siteInfo['token_table']);
-            //$token = $loginToken->createOnlyOneToken($userId, $productMid);
-            //Cache::put('TOKEN_' . $sceneStr, $token, 5 * 60); // 有效期5分钟
-            //Log::info('33333333333333333333 === ' . 'TOKEN_' . $sceneStr . ' ==== ' . $token);
+            $loginToken = new LoginTokenService($this->siteInfo['token_table']);
+            $token = $loginToken->createOnlyOneToken($userId, $productMid);
+            Cache::put('TOKEN_' . $sceneStr, $token, 5 * 60); // 有效期5分钟
+            Log::info('33333333333333333333 === ' . 'TOKEN_' . $sceneStr . ' ==== ' . $token);
 
 
             // 如果用户直接点击手机登录链接,而没有扫描,则处理一下当前的扫描状态
             // 如果用户直接点击手机登录链接,而没有扫描,则处理一下当前的扫描状态
-            //if (!Cache::get("SCAN_" . $sceneStr)) {
-            //    Cache::put("SCAN_" . $sceneStr, true, 2 * 60); // 有效期2分钟
-            //}
+            if (!Cache::get("SCAN_" . $sceneStr)) {
+                Cache::put("SCAN_" . $sceneStr, true, 2 * 60); // 有效期2分钟
+            }
 
 
             // 网页跳转,带一个随机参数,然后再通过该参数来换取session
             // 网页跳转,带一个随机参数,然后再通过该参数来换取session
             $key = md5(microtime() . $sceneStr);
             $key = md5(microtime() . $sceneStr);
-            //Cache::put($key, $token, 2 * 60); // 有效期3分钟
+            Cache::put($key, $token, 2 * 60); // 有效期3分钟
 
 
             return redirect('/mobile/#/?key=' . $key);
             return redirect('/mobile/#/?key=' . $key);
         } else {
         } else {

+ 0 - 2
app/Http/Home/SoftController.php

@@ -437,8 +437,6 @@ class SoftController extends HttpBaseController
         $loginToken = new LoginTokenService($this->siteInfo['token_table']);
         $loginToken = new LoginTokenService($this->siteInfo['token_table']);
         // token 放到了userAgent里面,后期优化
         // token 放到了userAgent里面,后期优化
         $tokenInfo = $loginToken->findToken($token);
         $tokenInfo = $loginToken->findToken($token);
-        Log::info('111111111 === ' . 'token----' . json_encode($token) );
-        Log::info('222222222 === ' . 'tokenInfo----' . json_encode($tokenInfo) );
 
 
         if ($tokenInfo) {
         if ($tokenInfo) {
             $this->userId = $tokenInfo->user_id;
             $this->userId = $tokenInfo->user_id;