allocatr/application/common/command/CheckTTSTaskCommand.php
2025-06-02 19:24:42 +08:00

35 lines
964 B
PHP

<?php
namespace app\common\command;
use app\admin\model\Message;
use app\admin\model\OrderDispatch;
use app\admin\model\OrderDispatchRecord;
use app\admin\model\TtsLog;
use app\common\Logic\NoticeLogic;
use think\console\Command;
use think\console\Input;
use think\console\Output;
class CheckTTSTaskCommand extends Command
{
protected function configure()
{
$this->setName('check:dispatch-tts-task')
->setDescription('语音发送任务,每分钟执行一次');
}
protected function execute(Input $input, Output $output){
$Model = new TtsLog();
$ttsService = new NoticeLogic();
$Model->where('status','=',OrderDispatch::STATUS_CLOCK)
->where('tts_notice','<',3)
->chunk(100, function ($list)use($ttsService) {
foreach ($list as $item) {
$ttsService->callIt($item);
}
});
$output->info('OVER');
}
}