初始化代码
This commit is contained in:
37
application/common/command/ClearRoomRobot.php
Normal file
37
application/common/command/ClearRoomRobot.php
Normal file
@@ -0,0 +1,37 @@
|
||||
<?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;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user