REDIS_HOST, 'port' => REDIS_PORT, 'auth' => REDIS_AUTH)) { parent::__construct($options); } public function getkey() { $res = $this->keys('*'); return $res; } /** * 获取app用户的token * @author: huangch * @return mixed */ public function get_user_token($uid) { return $this->get('x_user_token:'.$uid); } /** * 获取app用户的refresh_token * @author: huangch * @return mixed */ public function get_user_refresh_token($uid) { return $this->get('x_user_refresh_token:'.$uid); } /** * 设置用户token * @author: huangch */ public function set_user_token($user) { $this->set('x_user_token:'.$user['id'], $user['token'],86400); $this->set('x_user_refresh_token:'.$user['id'], $user['refresh_token'],86400 * 180); } /** * 刷新用户token * @param $uid * @param $token * @param $refresh_token * @author: huangch */ public function refresh_user_token($uid,$token,$refresh_token) { $this->set('x_user_token:'.$uid, $token,86400); $this->set('x_user_refresh_token:'.$uid, $refresh_token,86400 * 180); } /** * 小程序用户设置token * @param $user * @author: linch */ public function set_mini_app_user_token($user) { $this->set('mini_app_user_token:' . $user['uid'], $user['token'], 3600); } /** * 小程序用户获取token * @param $uid * @author: linch */ public function get_mini_app_user_token($uid) { return $this->get('mini_app_user_token:' . $uid); } }