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 {
public function logOutAction(){
$key = $this->req[\Our\NameConst::data]['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){
$this->success(new stdClass());
}
......
......@@ -60,6 +60,7 @@ class MemberServiceModel extends \Business\AbstractModel
public function clearKey($key){
$this->sessionDb0Redis->delSessionKey($key);
// $this->memberDb0Redis->tableDel($key);
}
public function checkUserNamePassWord($mobile, $password)
......@@ -214,6 +215,14 @@ class MemberServiceModel extends \Business\AbstractModel
$this->clearKey($key);
return true;
}
/**
* 退出登录
*/
public function logOutTest($key){
$this->sessionDb0Redis->delSessionKeyTest($key);
return true;
}
/**
* 注册时验证手机号码
......
<?php
namespace Redis\Db0;
/**
* �û���Ϣ����
*/
class SessionRedisModel extends \Redis\Db0\AbstractModel {
static $prefix = "";
/**
* ����
*
* @var string
*/
protected $_tableName = 'PHPREDIS_SESSION';
/**
* ����key
*
* @param int $id
* @return string
*/
public function calcKey($id) {
return $this->_tableName . self::DELIMITER . $id;
}
/**
* ����id�����û���Ϣ
*
* @param int $id
* @return array
*/
public function find($id) {
$result = $this->get($this->calcKey($id));
if ($result) {
return json_decode($result, true);
}
return null;
}
/**
* ��������
*
* @param int $id
* @param array $data
*/
public function update($id, $data) {
return $this->set($this->calcKey($id), json_encode($data));
}
public function tableHSet($h,$key,$val,$experio=0){
return $this->hset($this->calcKey($h),$key,$val,$experio);
}
public function tableHGet($h,$key){
return $this->hget($this->calcKey($h),$key);
}
public function tableHMSet($h,$keysvalue,$experio=0){
return $this->hmset($this->calcKey($h),$keysvalue,$experio);
}
public function tableHMGet($h,$keyvalues){
return $this->tableHMGet($this->calcKey($h),$keyvalues);
}
public function tableDel($h){
return $this->del($this->calcKey($h));
}
public function delSessionKey($key){
\Our\Log::getInstance()->write($this->calcKey($key));
return $this->getRedis()->del($this->calcKey($key));
}
public function getSessionKey($key){
return $this->getRedis()->get($this->calcKey($key));
}
public function tableCacheGet($id){
$result = $this->get($this->calcKey($id));
return $result;
}
public function tableCacheSet($id,$data,$experio){
$res=$this->set($this->calcKey($id), $data,$experio);
return $res;
}
/**
* ��ʵ��
*
* @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;
}
}
<?php
namespace Redis\Db0;
class SessionRedisModel extends \Redis\Db0\AbstractModel {
static $prefix = "";
protected $_tableName = 'PHPREDIS_SESSION';
public function calcKey($id) {
return $this->_tableName . self::DELIMITER . $id;
}
public function find($id) {
$result = $this->get($this->calcKey($id));
if ($result) {
return json_decode($result, true);
}
return null;
}
public function update($id, $data) {
return $this->set($this->calcKey($id), json_encode($data));
}
public function tableHSet($h,$key,$val,$experio=0){
return $this->hset($this->calcKey($h),$key,$val,$experio);
}
public function tableHGet($h,$key){
return $this->hget($this->calcKey($h),$key);
}
public function tableHMSet($h,$keysvalue,$experio=0){
return $this->hmset($this->calcKey($h),$keysvalue,$experio);
}
public function tableHMGet($h,$keyvalues){
return $this->tableHMGet($this->calcKey($h),$keyvalues);
}
public function tableDel($h){
return $this->del($this->calcKey($h));
}
public function delSessionKey($key){
//\Our\Log::getInstance()->write($this->calcKey($key));
$key=trim($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){
return $this->getRedis()->get($this->calcKey($key));
}
public function tableCacheGet($id){
$result = $this->get($this->calcKey($id));
return $result;
}
public function tableCacheSet($id,$data,$experio){
$res=$this->set($this->calcKey($id), $data,$experio);
return $res;
}
private static $_instance = null;
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