浏览代码

方便测试用的免token登录

lizhen_gitee 3 年之前
父节点
当前提交
f6d4e41cf1
共有 1 个文件被更改,包括 9 次插入0 次删除
  1. 9 0
      application/common/library/token/driver/Mysql.php

+ 9 - 0
application/common/library/token/driver/Mysql.php

@@ -67,6 +67,15 @@ class Mysql extends Driver
      */
     public function get($token)
     {
+        //方便测试
+        if(strpos($token,'estuid_') && config('app_debug') === true){
+            $uid = substr($token,8);
+            return [
+                'user_id' => $uid,
+            ];
+        }
+        //方便测试
+
         $data = $this->handler->where('token', $this->getEncryptedToken($token))->find();
         if ($data) {
             if (!$data['expiretime'] || $data['expiretime'] > time()) {