Jelajahi Sumber

管理员退出操作

shish 6 tahun lalu
induk
melakukan
248c0252f2

+ 131 - 115
app/backend/controllers/AdminController.php

@@ -1,5 +1,9 @@
 <?php
+
 namespace backend\controllers;
+
+use common\components\httpUtil;
+use common\components\jwt;
 use Yii;
 use yii\web\Controller;
 use yii\helpers\Json;
@@ -11,67 +15,68 @@ use common\components\stringUtil;
 use common\components\qrCodeUtil;
 use common\services\xhAdminToMerchantService;
 
-class AdminController extends BackendController{
-
-	public $withoutLogin	= ['check-mobile'];
-
+class AdminController extends BackendController
+{
+	
+	public $withoutLogin = ['check-mobile'];
+	
 	/**
 	 * 生成管理员
 	 */
 	public function actionGenerate()
 	{
-		$get			= Yii::$app->request->get();
-		$newAccountKey	= isset($get['newAccount']) ? $get['newAccount'] : '';
+		$get = Yii::$app->request->get();
+		$newAccountKey = isset($get['newAccount']) ? $get['newAccount'] : '';
 		//解密获取新帐号
-		$newAccount		= urldecode(stringUtil::authcode($newAccountKey,'DECODE'));
-		if(empty($newAccount)){
+		$newAccount = urldecode(stringUtil::authcode($newAccountKey, 'DECODE'));
+		if (empty($newAccount)) {
 			util::stop('链接已经失效,请重新授权');
 		}
-		$session						= Yii::$app->session;
-		$session['usable_new_account']	= $newAccount;
-		$relation						= xhAdminToMerchantService::getByAdminId($this->adminId);
-		if(!empty($relation)){
-			$this->redirect(['admin/result','account' => $this->merchant['id']]);
+		$session = Yii::$app->session;
+		$session['usable_new_account'] = $newAccount;
+		$relation = xhAdminToMerchantService::getByAdminId($this->adminId);
+		if (!empty($relation)) {
+			$this->redirect(['admin/result', 'account' => $this->merchant['id']]);
 			util::end();
 		}
-		return $this->renderPartial('generate',['admin' => $this->admin,'merchant' => $this->merchant]);
+		return $this->renderPartial('generate', ['admin' => $this->admin, 'merchant' => $this->merchant]);
 	}
-
+	
 	/**
 	 * 检查手机是否已经生成管理员
 	 */
 	public function actionCheckMobile()
 	{
-		$get		= Yii::$app->request->get();
-		$mobile		= isset($get['mobile']) ? $get['mobile'] : '';
-		$admin		= xhAdminService::getByMobile($mobile);
-		if(empty($admin)){
+		$get = Yii::$app->request->get();
+		$mobile = isset($get['mobile']) ? $get['mobile'] : '';
+		$admin = xhAdminService::getByMobile($mobile);
+		if (empty($admin)) {
 			util::successInfo('可以使用');
 		}
 		util::failInfo('手机号已使用');
 	}
-
+	
 	/**
 	 * 生成管理员,生成验证码
 	 */
 	public function actionGenerateCode()
 	{
-		$get		= Yii::$app->request->get();
-		$mobile		= isset($get['mobile']) ? $get['mobile'] : '';
-		if(preg_match("/^1[0-9]\d{9}$/",$mobile) == false){
+		$get = Yii::$app->request->get();
+		$mobile = isset($get['mobile']) ? $get['mobile'] : '';
+		if (preg_match("/^1[0-9]\d{9}$/", $mobile) == false) {
 			util::failInfo('手机号填写有误');
 		}
-		$admin		= xhAdminService::getByMobile($mobile);
-		if(!empty($admin)){
+		$admin = xhAdminService::getByMobile($mobile);
+		if (!empty($admin)) {
 			util::failInfo('这个手机号已经使用过了');
 		}
-		$session		= Yii::$app->session;
-		$now			= time();
-		if(isset($session['authCode']) == false || ($now - $session['authCodeTime']) > 120){
-			$num										= stringUtil::getRandNum(5);
-			$session['authCode']						= $num;
-			$session['authCodeTime']					= time();
-			$msg										= "您正在设置管理员,验证码:".$num;
+		$session = Yii::$app->session;
+		$now = time();
+		if (isset($session['authCode']) == false || ($now - $session['authCodeTime']) > 120) {
+			$num = stringUtil::getRandNum(5);
+			$session['authCode'] = $num;
+			$session['authCodeTime'] = time();
+			$msg = "您正在设置管理员,验证码:" . $num;
 			xhCommonService::sendMobileMsg($mobile, $msg);
 			util::successInfo();
 		}
@@ -82,137 +87,137 @@ class AdminController extends BackendController{
 	 */
 	public function actionCheckCode()
 	{
-		$get			= Yii::$app->request->get();
-		$authCode		= isset($get['authCode']) ? $get['authCode'] : '';
-		$session		= Yii::$app->session;
-		if(isset($session['authCode']) && $authCode == $session['authCode']){
+		$get = Yii::$app->request->get();
+		$authCode = isset($get['authCode']) ? $get['authCode'] : '';
+		$session = Yii::$app->session;
+		if (isset($session['authCode']) && $authCode == $session['authCode']) {
 			util::successInfo('');
 		}
 		util::failInfo('验证号不正确');
 	}
-
+	
 	public function actionResult()
 	{
-		return $this->renderPartial('result',['merchant' => $this->merchant]);
+		return $this->renderPartial('result', ['merchant' => $this->merchant]);
 	}
-
+	
 	/**
-     * 绑定
+	 * 绑定
 	 */
 	public function actionBinding()
 	{
-		$post						= Yii::$app->request->post();
-		$session					= Yii::$app->session;
-		if(isset($session['usable_new_account']) == false || empty($session['usable_new_account'])){
+		$post = Yii::$app->request->post();
+		$session = Yii::$app->session;
+		if (isset($session['usable_new_account']) == false || empty($session['usable_new_account'])) {
 			util::failInfo('授权已经失效,请重新授权');
 		}
-		if(isset($session['authCode']) == false){
+		if (isset($session['authCode']) == false) {
 			util::failInfo('没有验证码');
 		}
-		$code						= isset($post['code']) ? $post['code'] : '';
-		if($code != $session['authCode']){
+		$code = isset($post['code']) ? $post['code'] : '';
+		if ($code != $session['authCode']) {
 			util::failInfo('验证码不正确');
 		}
-		$mobile						= isset($post['mobile']) ? $post['mobile'] : '';
-		if(stringUtil::isMobieNumber($mobile) == false){
+		$mobile = isset($post['mobile']) ? $post['mobile'] : '';
+		if (stringUtil::isMobieNumber($mobile) == false) {
 			util::failInfo('手机号填写有误');
 		}
-		$admin						= xhAdminService::getByMobile($mobile);
-		if(!empty($admin)){
+		$admin = xhAdminService::getByMobile($mobile);
+		if (!empty($admin)) {
 			util::failInfo('手机号已经被使用');
 		}
-		$relation					= xhAdminToMerchantService::getByAdminId($this->adminId);
-		if(!empty($relation)){
+		$relation = xhAdminToMerchantService::getByAdminId($this->adminId);
+		if (!empty($relation)) {
 			util::failInfo('管理员已经绑定商家');
 		}
-		$newAccount					= $session['usable_new_account'];
-		$newMerchant				= xhMerchantService::getByAccount($newAccount);
-		if(empty($newMerchant)){
+		$newAccount = $session['usable_new_account'];
+		$newMerchant = xhMerchantService::getByAccount($newAccount);
+		if (empty($newMerchant)) {
 			util::failInfo('商家信息不完整');
 		}
-		$merchantId					= $this->merchant['id'];
-		$account					= $this->merchant['id'];
-		$adminId					= $this->adminId;
-		$data['mobile']				= $mobile;
-		$data['password']			= md5($post['password']);
+		$merchantId = $this->merchant['id'];
+		$account = $this->merchant['id'];
+		$adminId = $this->adminId;
+		$data['mobile'] = $mobile;
+		$data['password'] = md5($post['password']);
 		xhAdminService::updateById($adminId, $data);
-		$addAdminData				= ['merchantId'=>$newMerchant['id'],'adminId'=>$this->adminId,'receiveMsg'=>1,'createTime'=>date("Y-m-d H:i:s")];
+		$addAdminData = ['merchantId' => $newMerchant['id'], 'adminId' => $this->adminId, 'receiveMsg' => 1, 'createTime' => date("Y-m-d H:i:s")];
 		xhAdminToMerchantService::add($addAdminData);
 		unset($session['usable_new_account']);
 		util::successInfo('设置成功');
 	}
-
+	
 	public function actionGetReplaceQrCode()
 	{
-		$get			= Yii::$app->request->get();
-		$url			= Yii::$app->params['adminUrl'].'/admin/replace?account='.$this->merchant['id'];
-		$logo			= Yii::getAlias("@app").'/../images'.$this->merchant['logo'];//取商家的logo
-		$imgUrl			= qrCodeUtil::generateFixQrCode($url,'backend_replace_admin_url_'.$this->merchant['id'],$logo);
+		$get = Yii::$app->request->get();
+		$url = Yii::$app->params['adminUrl'] . '/admin/replace?account=' . $this->merchant['id'];
+		$logo = Yii::getAlias("@app") . '/../images' . $this->merchant['logo'];//取商家的logo
+		$imgUrl = qrCodeUtil::generateFixQrCode($url, 'backend_replace_admin_url_' . $this->merchant['id'], $logo);
 		xhAdminService::logout();
-		echo Json::encode(['code' => 'A0001','msg' => 'success','data' => ['url' => $imgUrl]]);
+		echo Json::encode(['code' => 'A0001', 'msg' => 'success', 'data' => ['url' => $imgUrl]]);
 	}
-
+	
 	/**
 	 * 替换页
 	 */
 	public function actionReplace()
 	{
-		if($this->isWeixin == false){
+		if ($this->isWeixin == false) {
 			util::stop('请使用微信访问');
 		}
-		$preAdmin		= xhAdminToMerchantService::getAdminByMerchantId($this->merchantId);
-		$preAdminId		= $preAdmin['id'];
-		$newAdminId		= $this->adminId; 
-		if($newAdminId == $preAdminId){
+		$preAdmin = xhAdminToMerchantService::getAdminByMerchantId($this->merchantId);
+		$preAdminId = $preAdmin['id'];
+		$newAdminId = $this->adminId;
+		if ($newAdminId == $preAdminId) {
 			util::stop('您已经绑定过了');
 		}
-		$relation		= xhAdminToMerchantService::getByAdminId($newAdminId);
-		if(!empty($relation)){
+		$relation = xhAdminToMerchantService::getByAdminId($newAdminId);
+		if (!empty($relation)) {
 			util::stop('您的微信已经绑定商家,请先解除绑定');
 		}
-		return $this->renderPartial('replace',['preAdmin'=>$preAdmin]);
+		return $this->renderPartial('replace', ['preAdmin' => $preAdmin]);
 	}
-
+	
 	/**
-     * 显示新管理员页
+	 * 显示新管理员页
 	 */
 	public function actionExecReplace()
 	{
-		$get 					= Yii::$app->request->get();
-		$replaceAdminAuthCode	= isset($get['replaceAdminAuthCode']) ? $get['replaceAdminAuthCode'] : '';
-		$admin					= $this->admin;
-		return $this->renderPartial('execReplace',['replaceAdminAuthCode'=>$replaceAdminAuthCode,'admin'=>$admin]);
+		$get = Yii::$app->request->get();
+		$replaceAdminAuthCode = isset($get['replaceAdminAuthCode']) ? $get['replaceAdminAuthCode'] : '';
+		$admin = $this->admin;
+		return $this->renderPartial('execReplace', ['replaceAdminAuthCode' => $replaceAdminAuthCode, 'admin' => $admin]);
 	}
-
+	
 	/**
 	 * 更换管理员生成验证码
 	 */
 	public function actionRelaceAdminGenerateCode()
 	{
-		$get			= Yii::$app->request->get();
-		$preAdmin		= xhAdminToMerchantService::getAdminByMerchantId($this->merchantId);
-		$mobile			= $preAdmin['mobile'];
-		$session		= Yii::$app->session;
-		$now			= time();
-		if(isset($session['replaceAdminAuthCode']) == false || ($now - $session['replaceAdminAuthCodeTime']) > 120){
-			$num										= stringUtil::getRandNum(5);
-			$session['replaceAdminAuthCode']			= $num;
-			$session['replaceAdminAuthCodeTime']		= time();
-			$msg										= "您正在更换管理员,验证码:".$num;
+		$get = Yii::$app->request->get();
+		$preAdmin = xhAdminToMerchantService::getAdminByMerchantId($this->merchantId);
+		$mobile = $preAdmin['mobile'];
+		$session = Yii::$app->session;
+		$now = time();
+		if (isset($session['replaceAdminAuthCode']) == false || ($now - $session['replaceAdminAuthCodeTime']) > 120) {
+			$num = stringUtil::getRandNum(5);
+			$session['replaceAdminAuthCode'] = $num;
+			$session['replaceAdminAuthCodeTime'] = time();
+			$msg = "您正在更换管理员,验证码:" . $num;
 			xhCommonService::sendMobileMsg($mobile, $msg);
 			util::successInfo();
 		}
 	}
-
+	
 	/**
 	 * 检查验证码
 	 */
 	public function actionCheckRelaceAdminGenerateCode()
 	{
-		$get			= Yii::$app->request->get();
-		$authCode		= isset($get['authCode']) ? $get['authCode'] : '';
-		$session		= Yii::$app->session;
-		if(isset($session['replaceAdminAuthCode']) && $authCode == $session['replaceAdminAuthCode']){
+		$get = Yii::$app->request->get();
+		$authCode = isset($get['authCode']) ? $get['authCode'] : '';
+		$session = Yii::$app->session;
+		if (isset($session['replaceAdminAuthCode']) && $authCode == $session['replaceAdminAuthCode']) {
 			util::successInfo('');
 		}
 		util::failInfo('验证号不正确');
@@ -220,41 +225,52 @@ class AdminController extends BackendController{
 	
 	public function actionAjaxExecReplace()
 	{
-		$post					= Yii::$app->request->post();
-		$replaceAdminAuthCode	= isset($post['replaceAdminAuthCode']) ? $post['replaceAdminAuthCode'] : '';
-		$code					= isset($post['code']) ? $post['code'] : '';
-		$mobile					= isset($post['mobile']) ? $post['mobile'] : '';
-		$password				= isset($post['password']) ? $post['password'] : '';
-		$session				= Yii::$app->session;
-		if(isset($session['replaceAdminAuthCode']) == false || $session['replaceAdminAuthCode'] != $replaceAdminAuthCode){
+		$post = Yii::$app->request->post();
+		$replaceAdminAuthCode = isset($post['replaceAdminAuthCode']) ? $post['replaceAdminAuthCode'] : '';
+		$code = isset($post['code']) ? $post['code'] : '';
+		$mobile = isset($post['mobile']) ? $post['mobile'] : '';
+		$password = isset($post['password']) ? $post['password'] : '';
+		$session = Yii::$app->session;
+		if (isset($session['replaceAdminAuthCode']) == false || $session['replaceAdminAuthCode'] != $replaceAdminAuthCode) {
 			util::stop('验证码已经失效了');
 		}
-		if(isset($session['authCode']) == false || $session['authCode'] != $code){
+		if (isset($session['authCode']) == false || $session['authCode'] != $code) {
 			util::stop('验证码已经失效');
 		}
-		$preAdmin				= xhAdminToMerchantService::getAdminByMerchantId($this->merchantId);
-		$preAdminId				= $preAdmin['id'];
-		$newAdminId				= $this->adminId;
-		$relation				= xhAdminToMerchantService::getByAdminId($newAdminId);
-		if(!empty($relation)){
+		$preAdmin = xhAdminToMerchantService::getAdminByMerchantId($this->merchantId);
+		$preAdminId = $preAdmin['id'];
+		$newAdminId = $this->adminId;
+		$relation = xhAdminToMerchantService::getByAdminId($newAdminId);
+		if (!empty($relation)) {
 			util::stop('您的微信已经绑定商家了,请先解除绑定');
 		}
 		//删除原有管理关系
 		xhAdminToMerchantService::delByAdminId($preAdminId);
 		//更新原管理员信息
-		xhAdminService::updateById($preAdminId, ['mobile'=>'','password'=>'']);
+		xhAdminService::updateById($preAdminId, ['mobile' => '', 'password' => '']);
 		//添加新管理员
-		xhAdminToMerchantService::add(['adminId'=>$newAdminId,'merchantId'=>$this->merchantId,'createTime'=>date("Y-m-d H:i:s"),'receiveMsg'=>1]);
+		xhAdminToMerchantService::add(['adminId' => $newAdminId, 'merchantId' => $this->merchantId, 'createTime' => date("Y-m-d H:i:s"), 'receiveMsg' => 1]);
 		//更新管理员的信息
-		xhAdminService::updateById($newAdminId, ['mobile'=>$mobile,'password'=>md5($password)]);
+		xhAdminService::updateById($newAdminId, ['mobile' => $mobile, 'password' => md5($password)]);
 		unset($session['replaceAdminAuthCode']);
 		unset($session['authCode']);
 		util::successInfo();
 	}
-
+	
 	public function actionReplaceResult()
 	{
 		return $this->renderPartial('replaceResult');
 	}
 	
+	//退出 shish 2019.11.24
+	public function actionLogout()
+	{
+		$token = httpUtil::getToken();
+		$r = jwt::delToken($token, $this->adminId);
+		if ($r) {
+			util::ok();
+		}
+		util::fail('没有退出');
+	}
+	
 }

+ 1 - 10
app/backend/controllers/AuthController.php

@@ -5,7 +5,6 @@ namespace backend\controllers;
 use biz\merchant\services\AdminService;
 use biz\platform\services\WxOpenService;
 use common\components\jwt;
-use common\services\xhAdminService;
 use common\components\util;
 use Yii;
 use common\components\stringUtil;
@@ -33,17 +32,9 @@ class AuthController extends PublicController
 			util::fail('密码错误');
 		}
 		$adminId = $admin['id'];
-		//来源
-		$sourceId = WxOpenService::getSourceId();
 		//获取token
-		$token = jwt::get($sourceId, $adminId);
+		$token = jwt::get($adminId);
 		util::success(['token' => $token]);
 	}
 
-	public function actionLogout()
-	{
-		xhAdminService::logout();
-		echo 'ok';
-	}
-
 }

+ 1 - 3
app/mobile/controllers/AuthController.php

@@ -132,11 +132,9 @@ class AuthController extends PublicController
 		Yii::$app->params['user'] = $user;
 		Yii::$app->params['merchantId'] = $merchantId;
 		Yii::$app->params['merchant'] = $merchant;
-		//来源
-		$sourceId = WxOpenService::getSourceId();
 		$userId = $user['id'];
 		//获取token
-		$token = jwt::get($sourceId, $userId);
+		$token = jwt::get($userId);
 		$url = strpos($url, '?') === false ? $url . '?token=' . $token : $url . '&token=' . $token;
 		$this->redirect($url);
 	}

+ 1 - 1
app/mobile/controllers/BaseController.php

@@ -27,7 +27,7 @@ class BaseController extends PublicController
 	public function beforeAction($action)
 	{
 		//token验证
-		$userId = jwt::checkLogin();
+		$userId = jwt::getLoginId();
 		
 		$header = httpUtil::getHeader();
 		$account = isset($header['account']) ? $header['account'] : 0;

+ 9 - 1
common/components/httpUtil.php

@@ -7,6 +7,7 @@
  */
 
 namespace common\components;
+
 use Yii;
 
 class httpUtil
@@ -52,6 +53,13 @@ class httpUtil
 		return $headers;
 	}
 
+	public static function getToken()
+	{
+		$header = self::getHeader();
+		$token = isset($header['token']) ? $header['token'] : '';
+		return $token;
+	}
+
 	//获取地址里的account shish 2019.11.24
 	public static function getAccount($url)
 	{
@@ -70,5 +78,5 @@ class httpUtil
 		}
 		return $account;
 	}
-
+	
 }

+ 59 - 14
common/components/jwt.php

@@ -7,6 +7,7 @@
 
 namespace common\components;
 
+use biz\platform\services\WxOpenService;
 use Lcobucci\JWT\Builder;
 use Lcobucci\JWT\Parser;
 use Lcobucci\JWT\ValidationData;
@@ -18,38 +19,41 @@ class jwt
 {
 	
 	//生成token
-	public static function create($sourceId, $userId)
+	public static function create($uniqueId)
 	{
 		$time = time();
 		$signer = new Sha256();
 		$salt = Yii::$app->params['secretKey'];
 		$key = new Key($salt);
 		$host = httpUtil::getHost();
-		$uniqueId = $sourceId . '_' . $userId;
+		$sourceId = WxOpenService::getSourceId();
+		$jwtId = $sourceId . '_' . $uniqueId;
 		$token = (new Builder())->issuedBy($host)//发布者的url地址
 		->canOnlyBeUsedBy($host)//接受者的url地址
-		->identifiedBy($uniqueId, true)//该jwt的唯一ID编号
+		->identifiedBy($jwtId, true)//该jwt的唯一ID编号
 		->issuedAt($time)//该jwt的发布时间
 		->canOnlyBeUsedAfter($time)//该jwt的使用时间不能早于该时间
 		->expiresAt($time + 8640000)//该jwt销毁的时间
-		->set('userId', $userId)//设置一个变量
+		->set('uniqueId', $uniqueId)//设置一个变量
 		->sign($signer, $key)->getToken();
 		
-		$keyName = self::getKeyName($sourceId, $userId);
+		$keyName = self::getKeyName($sourceId, $uniqueId);
 		Yii::$app->redis->executeCommand('SET', [$keyName, $token]);
 		
 		return $token;
 	}
 	
-	public static function getKeyName($sourceId, $userId)
+	public static function getKeyName($sourceId, $uniqueId)
 	{
-		return 'JWT_' . $sourceId . '_' . $userId;
+		return 'JWT_' . $sourceId . '_' . $uniqueId;
 	}
 	
 	//返回一个可用的token shish 2019.11.22
-	public static function get($sourceId, $userId)
+	public static function get($uniqueId)
 	{
-		$keyName = self::getKeyName($sourceId, $userId);
+		//来源
+		$sourceId = WxOpenService::getSourceId();
+		$keyName = self::getKeyName($sourceId, $uniqueId);
 		$cacheToken = Yii::$app->redis->executeCommand('GET', [$keyName]);
 		$token = '';
 		//从缓存中获取
@@ -60,7 +64,7 @@ class jwt
 			$token = $r == false ? '' : $cacheToken;
 		}
 		if (empty($token)) {
-			$token = self::create($sourceId, $userId);
+			$token = self::create($uniqueId);
 		}
 		return $token;
 	}
@@ -71,6 +75,7 @@ class jwt
 		$token = (new Parser())->parse($token);
 		//数据校验
 		$data = new ValidationData();//使用当前时间来校验数据
+		
 		if (!$token->validate($data)) {
 			Yii::info('token时间验证没有通过。token:' . $token);
 			return 0;
@@ -84,12 +89,12 @@ class jwt
 		}
 		$token->getHeaders(); // 获取JWT的Header(头部)信息
 		$token->getClaims(); // 获取JWT的PayLoad(负载)信息
-		$userId = $token->getClaim('userId');
-		return $userId;
+		$uniqueId = $token->getClaim('uniqueId');
+		return $uniqueId;
 	}
 	
-	//判断有没登陆并返回userId shish 2019.11.22
-	public static function checkLogin()
+	//判断有没登陆并返回id shish 2019.11.22
+	public static function getLoginId()
 	{
 		$header = httpUtil::getHeader();
 		$token = isset($header['token']) ? $header['token'] : '';
@@ -99,4 +104,44 @@ class jwt
 		return self::validate($token);
 	}
 	
+	public static function delToken($token, $uniqueId)
+	{
+		$sourceId = WxOpenService::getSourceId();
+		$jwtId = $sourceId . '_' . $uniqueId;
+		$host = httpUtil::getHost();
+		$signer = new Sha256();//生成JWT时使用的加密方式
+		$salt = Yii::$app->params['secretKey'];
+		$signKey = new Key($salt);
+		
+		$token = (new Parser())->parse($token);
+		//数据校验
+		$data = new ValidationData();//使用当前时间来校验数据
+		$data->setIssuer($host);
+		$data->setAudience($host);
+		$data->setId($jwtId);
+		
+		if (!$token->verify($signer, $signKey)) {
+			Yii::info('token解密没有通过。token:' . $token);
+			return false;
+		}
+		
+		if (!$token->validate($data)) {
+			Yii::info('token验证没有通过。token:' . $token);
+			return false;
+		}
+		
+		$token->getHeaders(); // 获取JWT的Header(头部)信息
+		$token->getClaims(); // 获取JWT的PayLoad(负载)信息
+		$returnId = $token->getClaim('uniqueId');
+		if ($returnId != $uniqueId) {
+			Yii::info('token验证出的id不是登陆用户id。token:' . $token);
+			return false;
+		}
+		
+		//设置为过期
+		$data->setCurrentTime(time() + 600);
+		
+		return true;
+	}
+	
 }