Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
M
my-yaf-project
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
chenchuanwen
my-yaf-project
Commits
970fe2ab
Commit
970fe2ab
authored
Sep 05, 2018
by
liuyuzhen
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master_dev' of git.shenbd.com:qm-develop/shenbd into lyz
parents
939ab08f
9319c0d2
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
139 additions
and
111 deletions
+139
-111
Member.php
application/controllers/Member.php
+16
-0
MemberService.php
application/models/Business/User/MemberService.php
+9
-0
SessionRedis.php
application/models/Redis/Db0/SessionRedis.php
+96
-111
logOutTest.php
public/test/member/logOutTest.php
+18
-0
No files found.
application/controllers/Member.php
View file @
970fe2ab
...
...
@@ -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
());
}
...
...
application/models/Business/User/MemberService.php
View file @
970fe2ab
...
...
@@ -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
;
}
/**
* 注册时验证手机号码
...
...
application/models/Redis/Db0/SessionRedis.php
100644 → 100755
View file @
970fe2ab
<?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
;
}
}
public/test/member/logOutTest.php
0 → 100644
View file @
970fe2ab
<!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
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment