Quellcode durchsuchen

session共享问题

541469799@qq.com vor 9 Monaten
Ursprung
Commit
99d8a56f25
2 geänderte Dateien mit 8 neuen und 2 gelöschten Zeilen
  1. 7 1
      app/index/controller/Passport.php
  2. 1 1
      app/index/view/index/vapePoints.html

+ 7 - 1
app/index/controller/Passport.php

@@ -15,6 +15,7 @@ namespace app\index\controller;
 use app\common\model\User as UserAlias;
 use app\index\model\User as UserModel;
 use app\index\model\user\UserAccessLog;
+use app\index\service\User as UserService;
 use think\facade\Cache;
 use app\index\service\passport\Login as LoginService;
 use think\facade\Session;
@@ -28,7 +29,7 @@ class Passport extends Controller
 {
     /**
      * 登录接口 (需提交手机号、短信验证码、第三方用户信息)
-     * @return \think\response\Json|\think\response\View
+     * @return
      * @throws \app\common\exception\BaseException
      * @throws \think\Exception
      * @throws \think\db\exception\DataNotFoundException
@@ -47,6 +48,11 @@ class Passport extends Controller
                 'create_time' => time()
             ]);
 
+            $userId = UserService::getCurrentLoginUserId();
+            if ($userId){
+                return redirect('/index/index/index.html');
+            }
+
             return view('logIn');
         }
         // 执行登录

+ 1 - 1
app/index/view/index/vapePoints.html

@@ -52,7 +52,7 @@
     </p>
     <br>
     <p>
-        For registration: <a href="/index/passport/login.html" class="aLink">click here! </a>(100 points)
+        For registration: <a href="/index/passport/login.html" class="aLink">click here! </a>(100 points). If you're already logged in, it will be redirected to the store Home.
         <br>
         IF you are already registered and:
         <br>