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;
}
/** /**
* 注册时验证手机号码 * 注册时验证手机号码
......
<?php <?php
namespace Redis\Db0; namespace Redis\Db0;
/**
* �û���Ϣ���� class SessionRedisModel extends \Redis\Db0\AbstractModel {
*/
class SessionRedisModel extends \Redis\Db0\AbstractModel { static $prefix = "";
static $prefix = "";
/** protected $_tableName = 'PHPREDIS_SESSION';
* ����
*
* @var string public function calcKey($id) {
*/ return $this->_tableName . self::DELIMITER . $id;
protected $_tableName = 'PHPREDIS_SESSION'; }
/**
* ����key public function find($id) {
* $result = $this->get($this->calcKey($id));
* @param int $id
* @return string if ($result) {
*/ return json_decode($result, true);
public function calcKey($id) { }
return $this->_tableName . self::DELIMITER . $id; return null;
} }
/**
* ����id�����û���Ϣ
* public function update($id, $data) {
* @param int $id return $this->set($this->calcKey($id), json_encode($data));
* @return array }
*/
public function find($id) { public function tableHSet($h,$key,$val,$experio=0){
$result = $this->get($this->calcKey($id)); return $this->hset($this->calcKey($h),$key,$val,$experio);
}
if ($result) {
return json_decode($result, true); public function tableHGet($h,$key){
} return $this->hget($this->calcKey($h),$key);
return null; }
}
public function tableHMSet($h,$keysvalue,$experio=0){
/** return $this->hmset($this->calcKey($h),$keysvalue,$experio);
* �������� }
*
* @param int $id public function tableHMGet($h,$keyvalues){
* @param array $data return $this->tableHMGet($this->calcKey($h),$keyvalues);
*/ }
public function update($id, $data) {
return $this->set($this->calcKey($id), json_encode($data));
} public function tableDel($h){
return $this->del($this->calcKey($h));
public function tableHSet($h,$key,$val,$experio=0){ }
return $this->hset($this->calcKey($h),$key,$val,$experio);
} public function delSessionKey($key){
//\Our\Log::getInstance()->write($this->calcKey($key));
public function tableHGet($h,$key){ $key=trim($key);
return $this->hget($this->calcKey($h),$key); return $this->getRedis()->del($this->calcKey($key));
}
}
public function tableHMSet($h,$keysvalue,$experio=0){ public function delSessionKeyTest($key){
return $this->hmset($this->calcKey($h),$keysvalue,$experio); \Our\Log::getInstance()->write($this->calcKey($key));
} $redisObject=$this->getRedis();
$deleteKey=$this->calcKey($key);
public function tableHMGet($h,$keyvalues){ $res=$redisObject->del($deleteKey);
return $this->tableHMGet($this->calcKey($h),$keyvalues); var_dump($res);
} session_unset();
session_destroy();
exit;
public function tableDel($h){
return $this->del($this->calcKey($h)); }
} public function getSessionKey($key){
return $this->getRedis()->get($this->calcKey($key));
public function delSessionKey($key){ }
\Our\Log::getInstance()->write($this->calcKey($key));
return $this->getRedis()->del($this->calcKey($key)); public function tableCacheGet($id){
$result = $this->get($this->calcKey($id));
} return $result;
public function getSessionKey($key){ }
return $this->getRedis()->get($this->calcKey($key)); public function tableCacheSet($id,$data,$experio){
} $res=$this->set($this->calcKey($id), $data,$experio);
return $res;
public function tableCacheGet($id){ }
$result = $this->get($this->calcKey($id));
return $result; private static $_instance = null;
}
public function tableCacheSet($id,$data,$experio){
$res=$this->set($this->calcKey($id), $data,$experio); public static function getInstance() {
return $res; if (!(self::$_instance instanceof self)) {
} self::$_instance = new self();
/** }
* ��ʵ��
* return self::$_instance;
* @var \Redis\Db0\UserModel }
*/
private static $_instance = null; }
/**
* ��ȡ��ʵ��
*
* @return \Redis\Db0\UserModel
*/
public static function getInstance() {
if (!(self::$_instance instanceof self)) {
self::$_instance = new self();
}
return self::$_instance;
}
}
<!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