Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
T
tl_estate
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
hujun
tl_estate
Commits
d0ba9898
Commit
d0ba9898
authored
Apr 03, 2019
by
hujun
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改保护期
parent
416c3996
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
55 additions
and
40 deletions
+55
-40
RedisCacheService.php
application/api_broker/service/RedisCacheService.php
+40
-39
UserService.php
application/index/service/UserService.php
+15
-1
No files found.
application/api_broker/service/RedisCacheService.php
View file @
d0ba9898
...
...
@@ -142,52 +142,53 @@ class RedisCacheService
}
/**
* @param $type
* @param $type
1:客户 2:经纪人 3:角色组 4:权限
* @param $id
* @return array|bool|false|mixed|\PDOStatement|string|\think\Model
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public
function
getRedisCache
(
$type
,
$id
)
{
if
(
empty
(
$id
))
{
return
false
;
}
switch
(
$type
)
{
case
1
:
$result
=
$this
->
redis_ext
->
get
(
$this
->
user_key
.
$id
);
if
(
empty
(
$result
))
{
$result
=
$this
->
userCache
(
$id
);
}
else
{
$result
=
json_decode
(
$result
,
true
);
}
break
;
case
2
:
$result
=
$this
->
redis_ext
->
get
(
$this
->
agent_key
.
$id
);
if
(
empty
(
$result
))
{
$result
=
$this
->
agentCache
(
$id
);
}
else
{
$result
=
json_decode
(
$result
,
true
);
}
break
;
case
3
:
$result
=
$this
->
redis_ext
->
get
(
$this
->
group_key
.
$id
);
if
(
empty
(
$result
))
{
$result
=
$this
->
groupCache
(
$id
);
}
else
{
$result
=
json_decode
(
$result
,
true
);
}
break
;
case
4
:
$result
=
$this
->
redis_ext
->
get
(
$this
->
rule_key
.
$id
);
if
(
empty
(
$result
))
{
$result
=
$this
->
authCache
(
$id
);
}
else
{
$result
=
json_decode
(
$result
,
true
);
}
break
;
default
:
$result
=
false
;
try
{
switch
(
$type
)
{
case
1
:
$result
=
$this
->
redis_ext
->
get
(
$this
->
user_key
.
$id
);
if
(
empty
(
$result
))
{
$result
=
$this
->
userCache
(
$id
);
}
else
{
$result
=
json_decode
(
$result
,
true
);
}
break
;
case
2
:
$result
=
$this
->
redis_ext
->
get
(
$this
->
agent_key
.
$id
);
if
(
empty
(
$result
))
{
$result
=
$this
->
agentCache
(
$id
);
}
else
{
$result
=
json_decode
(
$result
,
true
);
}
break
;
case
3
:
$result
=
$this
->
redis_ext
->
get
(
$this
->
group_key
.
$id
);
if
(
empty
(
$result
))
{
$result
=
$this
->
groupCache
(
$id
);
}
else
{
$result
=
json_decode
(
$result
,
true
);
}
break
;
case
4
:
$result
=
$this
->
redis_ext
->
get
(
$this
->
rule_key
.
$id
);
if
(
empty
(
$result
))
{
$result
=
$this
->
authCache
(
$id
);
}
else
{
$result
=
json_decode
(
$result
,
true
);
}
break
;
default
:
$result
=
false
;
}
}
catch
(
\Exception
$e
)
{
$result
=
false
;
}
return
$result
;
}
...
...
application/index/service/UserService.php
View file @
d0ba9898
...
...
@@ -10,6 +10,7 @@ namespace app\index\service;
use
app\api_broker\service\PushMessageService
;
use
app\api_broker\service\RedisCacheService
;
use
app\api_broker\service\VipService
;
use
app\extra\RedisExt
;
use
app\index\validate\MemberValidate
;
...
...
@@ -357,7 +358,20 @@ class UserService
if
(
!
$user_id
){
return
1
;
}
$res
=
$this
->
user
->
selectUser
(
$user_id
,
"id,protect_time,create_time"
);
$redis_cache
=
new
RedisCacheService
();
$user_data
=
$redis_cache
->
getRedisCache
(
1
,
$user_id
);
if
(
empty
(
$user_data
))
{
$res
=
$this
->
user
->
selectUser
(
$user_id
,
"id,protect_time,create_time"
);
}
else
{
if
(
$user_data
[
'status'
]
==
0
||
$user_data
[
'status'
]
==
-
1
)
{
$res
[
'protect_time'
]
=
$user_data
[
'protect_time'
];
}
}
if
(
empty
(
$res
[
'protect_time'
]))
{
return
1
;
//过保护期
}
/*先判断客户创建时间是否超过24小时 目的是兼容老数据 2018-10-20号之后的版本可去除此处代码*/
// if((time() - strtotime($res['create_time'])) < (60*60*24)){
...
...
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