* +---------------------------------------------------------------------- */ namespace app\listener\admin; /** * Class AdminLogin * @package app\listener\admin */ class AdminLoginListener { public function handle($event) { $res = false; $res1 = false; try { [$key] = $event; //检测消息队列是否执行 $path = root_path('runtime') . '.queue'; $content = file_get_contents($path); $res = $key === $content; if (sys_config('queue_open', 0) == 0) $res = true; unlink($path); } catch (\Throwable $e) { } try { $timerPath = root_path('runtime') . '.timer'; $timer = file_get_contents($timerPath); if ($timer && $timer <= time() && $timer > (time() - 70)) { $res1 = true; } } catch (\Throwable $e) { } return [$res, $res1]; } }