This commit is contained in:
xman 2025-06-02 19:24:15 +08:00
parent 612306d1d9
commit 79f6f4e821
2 changed files with 62 additions and 26 deletions

View File

@ -25,6 +25,7 @@ class NoticeLogic
public function callIt($log) public function callIt($log)
{ {
try {
$dispatch = OrderDispatch::get($log->dispatch_id); $dispatch = OrderDispatch::get($log->dispatch_id);
//1=派单2=提前通知3=超时通知 //1=派单2=提前通知3=超时通知
$ttsCode = null; $ttsCode = null;
@ -51,7 +52,7 @@ class NoticeLogic
$log->content = 'TTSID为空'; $log->content = 'TTSID为空';
$log->save(); $log->save();
} }
try {
$reponse = DyvmsService::getInstance()->call($dispatch->worker_tel, $ttsCode, md5(time())); $reponse = DyvmsService::getInstance()->call($dispatch->worker_tel, $ttsCode, md5(time()));
if($reponse->statusCode == 200 && $reponse->body->code == 'OK'){ if($reponse->statusCode == 200 && $reponse->body->code == 'OK'){

View File

@ -0,0 +1,35 @@
<?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');
}
}