Commit d0ba9898 authored by hujun's avatar hujun

修改保护期

parent 416c3996
...@@ -142,17 +142,15 @@ class RedisCacheService ...@@ -142,17 +142,15 @@ class RedisCacheService
} }
/** /**
* @param $type * @param $type 1:客户 2:经纪人 3:角色组 4:权限
* @param $id * @param $id
* @return array|bool|false|mixed|\PDOStatement|string|\think\Model * @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) { public function getRedisCache($type, $id) {
if (empty($id)) { if (empty($id)) {
return false; return false;
} }
try {
switch ($type) { switch ($type) {
case 1: case 1:
$result = $this->redis_ext->get($this->user_key . $id); $result = $this->redis_ext->get($this->user_key . $id);
...@@ -189,6 +187,9 @@ class RedisCacheService ...@@ -189,6 +187,9 @@ class RedisCacheService
default : default :
$result = false; $result = false;
} }
} catch (\Exception $e) {
$result = false;
}
return $result; return $result;
} }
} }
\ No newline at end of file
...@@ -10,6 +10,7 @@ namespace app\index\service; ...@@ -10,6 +10,7 @@ namespace app\index\service;
use app\api_broker\service\PushMessageService; use app\api_broker\service\PushMessageService;
use app\api_broker\service\RedisCacheService;
use app\api_broker\service\VipService; use app\api_broker\service\VipService;
use app\extra\RedisExt; use app\extra\RedisExt;
use app\index\validate\MemberValidate; use app\index\validate\MemberValidate;
...@@ -357,7 +358,20 @@ class UserService ...@@ -357,7 +358,20 @@ class UserService
if(!$user_id){ if(!$user_id){
return 1; return 1;
} }
$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"); $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号之后的版本可去除此处代码*/ /*先判断客户创建时间是否超过24小时 目的是兼容老数据 2018-10-20号之后的版本可去除此处代码*/
// if((time() - strtotime($res['create_time'])) < (60*60*24)){ // if((time() - strtotime($res['create_time'])) < (60*60*24)){
......
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