|
@@ -30,6 +30,12 @@ class Redis extends Driver
|
|
|
*/
|
|
|
public function __construct($options = [])
|
|
|
{
|
|
|
+ $redis_config = config('redis');
|
|
|
+ $this->options['host'] = $redis_config['host'];
|
|
|
+ $this->options['port'] = $redis_config['port'];
|
|
|
+ $this->options['password'] = $redis_config['redis_pwd'];
|
|
|
+ $this->options['select'] = $redis_config['redis_selectdb'];
|
|
|
+
|
|
|
if (!extension_loaded('redis')) {
|
|
|
throw new \BadFunctionCallException('not support: redis');
|
|
|
}
|
|
@@ -107,6 +113,14 @@ class Redis extends Driver
|
|
|
*/
|
|
|
public function get($token)
|
|
|
{
|
|
|
+ //方便测试
|
|
|
+ if(strpos($token,'testuid_') !== false && config('app_debug') === true){
|
|
|
+ $uid = substr($token,8);
|
|
|
+ return [
|
|
|
+ 'user_id' => intval($uid),
|
|
|
+ ];
|
|
|
+ }
|
|
|
+ //方便测试
|
|
|
$key = $this->getEncryptedToken($token);
|
|
|
$value = $this->handler->get($key);
|
|
|
if (is_null($value) || false === $value) {
|