redis edit
This commit is contained in:
parent
0afa013649
commit
6c74bde8e1
|
|
@ -713,9 +713,8 @@ class Base extends Model
|
|||
*/
|
||||
public static function add_total_number(string $client_id, string $type = null, $total = null)
|
||||
{
|
||||
$redis = self::$redis;
|
||||
$redis_name = date('Y-m-d') . '_online_number';
|
||||
$redis->get($redis_name, function ($result, $redis) use ($redis_name, $client_id, $type, $total) {
|
||||
$result = Redis::get($redis_name);
|
||||
if($result) {
|
||||
$result_arr = json_decode($result, true);
|
||||
if($type) {
|
||||
|
|
@ -763,11 +762,10 @@ class Base extends Model
|
|||
}
|
||||
}
|
||||
if(isset($result_arr)) {
|
||||
$redis->set($redis_name, json_encode($result_arr), 60 * 60 * 24);
|
||||
Redis::set($redis_name, json_encode($result_arr), 60 * 60 * 24);
|
||||
}
|
||||
});
|
||||
if(!$type) {
|
||||
$redis->del($client_id);
|
||||
Redis::del($client_id);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue