Commit 970fe2ab authored by liuyuzhen's avatar liuyuzhen

Merge branch 'master_dev' of git.shenbd.com:qm-develop/shenbd into lyz

parents 939ab08f 9319c0d2
...@@ -85,6 +85,22 @@ class MemberController extends \Our\Controller_AbstractApi { ...@@ -85,6 +85,22 @@ class MemberController extends \Our\Controller_AbstractApi {
public function logOutAction(){ public function logOutAction(){
$key = $this->req[\Our\NameConst::data]['key']; $key = $this->req[\Our\NameConst::data]['key'];
$result = $this->memberService->logOut($key); $result = $this->memberService->logOut($key);
session_unset();
session_destroy();
if($result){
$this->success(new stdClass());
}
ErrorModel::throwException(CodeConfigModel::noLogin);
}
/**
* 用户退出登录
* @throws Exception
*/
public function logOutTestAction(){
$key = $this->req[\Our\NameConst::data]['key'];
$result = $this->memberService->logOutTest($key);
if($result){ if($result){
$this->success(new stdClass()); $this->success(new stdClass());
} }
......
...@@ -60,6 +60,7 @@ class MemberServiceModel extends \Business\AbstractModel ...@@ -60,6 +60,7 @@ class MemberServiceModel extends \Business\AbstractModel
public function clearKey($key){ public function clearKey($key){
$this->sessionDb0Redis->delSessionKey($key); $this->sessionDb0Redis->delSessionKey($key);
// $this->memberDb0Redis->tableDel($key); // $this->memberDb0Redis->tableDel($key);
} }
public function checkUserNamePassWord($mobile, $password) public function checkUserNamePassWord($mobile, $password)
...@@ -214,6 +215,14 @@ class MemberServiceModel extends \Business\AbstractModel ...@@ -214,6 +215,14 @@ class MemberServiceModel extends \Business\AbstractModel
$this->clearKey($key); $this->clearKey($key);
return true; return true;
} }
/**
* 退出登录
*/
public function logOutTest($key){
$this->sessionDb0Redis->delSessionKeyTest($key);
return true;
}
/** /**
* 注册时验证手机号码 * 注册时验证手机号码
......
...@@ -2,35 +2,20 @@ ...@@ -2,35 +2,20 @@
namespace Redis\Db0; namespace Redis\Db0;
/**
* �û���Ϣ����
*/
class SessionRedisModel extends \Redis\Db0\AbstractModel { class SessionRedisModel extends \Redis\Db0\AbstractModel {
static $prefix = ""; static $prefix = "";
/**
* ����
*
* @var string
*/
protected $_tableName = 'PHPREDIS_SESSION'; protected $_tableName = 'PHPREDIS_SESSION';
/**
* ����key
*
* @param int $id
* @return string
*/
public function calcKey($id) { public function calcKey($id) {
return $this->_tableName . self::DELIMITER . $id; return $this->_tableName . self::DELIMITER . $id;
} }
/**
* ����id�����û���Ϣ
*
* @param int $id
* @return array
*/
public function find($id) { public function find($id) {
$result = $this->get($this->calcKey($id)); $result = $this->get($this->calcKey($id));
...@@ -40,12 +25,8 @@ class SessionRedisModel extends \Redis\Db0\AbstractModel { ...@@ -40,12 +25,8 @@ class SessionRedisModel extends \Redis\Db0\AbstractModel {
return null; return null;
} }
/**
* ��������
*
* @param int $id
* @param array $data
*/
public function update($id, $data) { public function update($id, $data) {
return $this->set($this->calcKey($id), json_encode($data)); return $this->set($this->calcKey($id), json_encode($data));
} }
...@@ -72,9 +53,21 @@ class SessionRedisModel extends \Redis\Db0\AbstractModel { ...@@ -72,9 +53,21 @@ class SessionRedisModel extends \Redis\Db0\AbstractModel {
} }
public function delSessionKey($key){ public function delSessionKey($key){
\Our\Log::getInstance()->write($this->calcKey($key)); //\Our\Log::getInstance()->write($this->calcKey($key));
$key=trim($key);
return $this->getRedis()->del($this->calcKey($key)); return $this->getRedis()->del($this->calcKey($key));
}
public function delSessionKeyTest($key){
\Our\Log::getInstance()->write($this->calcKey($key));
$redisObject=$this->getRedis();
$deleteKey=$this->calcKey($key);
$res=$redisObject->del($deleteKey);
var_dump($res);
session_unset();
session_destroy();
exit;
} }
public function getSessionKey($key){ public function getSessionKey($key){
return $this->getRedis()->get($this->calcKey($key)); return $this->getRedis()->get($this->calcKey($key));
...@@ -88,18 +81,10 @@ class SessionRedisModel extends \Redis\Db0\AbstractModel { ...@@ -88,18 +81,10 @@ class SessionRedisModel extends \Redis\Db0\AbstractModel {
$res=$this->set($this->calcKey($id), $data,$experio); $res=$this->set($this->calcKey($id), $data,$experio);
return $res; return $res;
} }
/**
* ��ʵ��
*
* @var \Redis\Db0\UserModel
*/
private static $_instance = null; private static $_instance = null;
/**
* ��ȡ��ʵ��
*
* @return \Redis\Db0\UserModel
*/
public static function getInstance() { public static function getInstance() {
if (!(self::$_instance instanceof self)) { if (!(self::$_instance instanceof self)) {
self::$_instance = new self(); self::$_instance = new self();
......
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>退出登录</title>
<style>
</style>
</head>
<body>
<form action="/member/logOutTest" method="post">
key:<input name="data[key]" value="64cc7258b88aec2494531234f6954477"/><br />
旧密码:<input name="data[debug]" value="1"/><br />
<input type="submit" value="提交">
</form>
</body>
</html>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment