37 lines
759 B
PHP
37 lines
759 B
PHP
<?php
|
|
|
|
|
|
namespace app\common\command;
|
|
|
|
|
|
use think\console\Command;
|
|
use think\console\Input;
|
|
use think\console\Output;
|
|
|
|
class ClearRoomRobot extends Command
|
|
{
|
|
protected function configure()
|
|
{
|
|
$this->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;
|
|
}
|
|
|
|
}
|
|
} |