redis edit
This commit is contained in:
@@ -713,9 +713,8 @@ class Base extends Model
|
|||||||
*/
|
*/
|
||||||
public static function add_total_number(string $client_id, string $type = null, $total = null)
|
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_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) {
|
if($result) {
|
||||||
$result_arr = json_decode($result, true);
|
$result_arr = json_decode($result, true);
|
||||||
if($type) {
|
if($type) {
|
||||||
@@ -763,11 +762,10 @@ class Base extends Model
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(isset($result_arr)) {
|
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) {
|
if(!$type) {
|
||||||
$redis->del($client_id);
|
Redis::del($client_id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user