Эх сурвалжийг харах

修复session掉失问题

moshaorui 3 долоо хоног өмнө
parent
commit
fdab4e5cf2

+ 9 - 0
app/Http/Middleware/DistAuth.php

@@ -27,6 +27,15 @@ class DistAuth
                 }
             }
         }
+        //判断是否登录,如果getDistributor不存在,则触发登录页面
+        if (Admin::user()) {
+            if (!getDistributor()) {
+                if (strpos($request->url(), 'auth/logout') == false) {
+                    // 存在时的逻辑
+                    return redirect('/dist/auth/logout');
+                }
+            }
+        }
 
         //否则继续处理当前请求
         return $next($request);