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

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

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