setName('clear-room-robot') ->setDescription('清理空房间机器人'); } /** * 清理空房间机器人 * @param Input $input * @param Output $output * @return int|void|null * @throws \think\Exception * @throws \think\exception\PDOException */ protected function execute(Input $input, Output $output) { while (true) { sleep(60); model('api/room')->auto_clear_robot_room(); echo '清理空房间机器人!'.PHP_EOL; } } }