通知
This commit is contained in:
parent
6045d93716
commit
696919950d
|
|
@ -25,7 +25,7 @@ class NoticeLogic
|
|||
|
||||
public function callIt($log)
|
||||
{
|
||||
try {
|
||||
|
||||
$dispatch = OrderDispatch::get($log->dispatch_id);
|
||||
//1=派单,2=提前通知,3=超时通知
|
||||
$ttsCode = null;
|
||||
|
|
@ -69,12 +69,10 @@ class NoticeLogic
|
|||
$log->save();
|
||||
}
|
||||
}else{
|
||||
throw new Exception('语音通知服务未开启');
|
||||
}
|
||||
}catch (Exception $exception){
|
||||
$log->status = -1;
|
||||
$log->content = $exception->getMessage();
|
||||
$log->content = 'TTSID为空';
|
||||
$log->save();
|
||||
//throw new Exception('语音通知服务未开启');
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -11,13 +11,16 @@ use app\common\Logic\NoticeLogic;
|
|||
use think\console\Command;
|
||||
use think\console\Input;
|
||||
use think\console\Output;
|
||||
use think\Db;
|
||||
use think\Exception;
|
||||
|
||||
class CheckOrdeRecordCommand extends Command
|
||||
{
|
||||
protected $title = 'dispatch跟进记录通知,每天9点1分执行';
|
||||
protected function configure()
|
||||
{
|
||||
$this->setName('check:dispatch-record-notice')
|
||||
->setDescription('dispatch跟进记录通知,每天9点1分执行');
|
||||
->setDescription($this->title);
|
||||
}
|
||||
|
||||
protected function execute(Input $input, Output $output){
|
||||
|
|
@ -29,6 +32,7 @@ class CheckOrdeRecordCommand extends Command
|
|||
->chunk(100, function ($list) {
|
||||
$ids = [];
|
||||
$dispatchIds = [];
|
||||
try {
|
||||
foreach ($list as $item) {
|
||||
$ids[] = $item->id;
|
||||
$dispatchIds[] = $item->dispatch_id;
|
||||
|
|
@ -53,8 +57,16 @@ class CheckOrdeRecordCommand extends Command
|
|||
}
|
||||
OrderDispatchRecord::whereIn('id',$ids)->where('status',0)->update(['status'=>1]);
|
||||
$count = OrderDispatch::whereIn('id',$dispatchIds)->where('follow',1)->update(['follow'=>0]);
|
||||
|
||||
echo 'count:'.$count.PHP_EOL;
|
||||
}catch (Exception $exception){
|
||||
Db::name('debug_log')->insert([
|
||||
'title' => $this->title,
|
||||
'content' => '错误内容:'.$exception->getMessage().',错误行:'. $exception->getLine().',错误文件:'. $exception->getFile(),
|
||||
'create_time' => date('Y-m-d H:i:s', time())
|
||||
]);
|
||||
}
|
||||
|
||||
|
||||
});
|
||||
|
||||
$output->info('OVER');
|
||||
|
|
|
|||
|
|
@ -9,15 +9,17 @@ use app\common\Logic\OrderLogic;
|
|||
use think\console\Command;
|
||||
use think\console\Input;
|
||||
use think\console\Output;
|
||||
use think\Db;
|
||||
use think\Exception;
|
||||
use think\Hook;
|
||||
|
||||
class CheckOrderDispatchGotCommand extends Command
|
||||
{
|
||||
protected $title = '【自动派单未接单检测,五分钟未接单,重派派单】/【自动派单上门时间已到,未完成上门】,每分钟执行一次';
|
||||
protected function configure()
|
||||
{
|
||||
$this->setName('check:dispatch-toget')
|
||||
->setDescription('【自动派单未接单检测,五分钟未接单,重派派单】/【自动派单上门时间已到,未完成上门】,每分钟执行一次');
|
||||
->setDescription($this->title);
|
||||
}
|
||||
|
||||
protected function execute(Input $input, Output $output){
|
||||
|
|
@ -72,6 +74,11 @@ class CheckOrderDispatchGotCommand extends Command
|
|||
|
||||
echo 'arrive_count:'. $count. PHP_EOL;
|
||||
}catch (Exception $exception){
|
||||
Db::name('debug_log')->insert([
|
||||
'title' => $this->title,
|
||||
'content' => '错误内容:'.$exception->getMessage().',错误行:'. $exception->getLine().',错误文件:'. $exception->getFile(),
|
||||
'create_time' => date('Y-m-d H:i:s', time())
|
||||
]);
|
||||
echo $exception->getMessage(). PHP_EOL;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,14 +7,16 @@ use app\admin\model\OrderDispatch;
|
|||
use think\console\Command;
|
||||
use think\console\Input;
|
||||
use think\console\Output;
|
||||
use think\Db;
|
||||
use think\Exception;
|
||||
|
||||
class CheckSmsPlantCommand extends Command
|
||||
{
|
||||
protected $title = 'dispatch预约任务短信提醒,每5分钟执行一次';
|
||||
protected function configure()
|
||||
{
|
||||
$this->setName('check:dispatch-sms-plant')
|
||||
->setDescription('dispatch已预约任务短信提醒,每5分钟执行一次');
|
||||
->setDescription($this->title);
|
||||
}
|
||||
|
||||
protected function execute(Input $input, Output $output){
|
||||
|
|
@ -34,6 +36,12 @@ class CheckSmsPlantCommand extends Command
|
|||
}catch (Exception $exception){
|
||||
|
||||
echo '短信发送失败:'.$exception->getMessage().PHP_EOL;
|
||||
|
||||
Db::name('debug_log')->insert([
|
||||
'title' => $this->title,
|
||||
'content' => '错误内容:'.$exception->getMessage().',错误行:'. $exception->getLine().',错误文件:'. $exception->getFile(),
|
||||
'create_time' => date('Y-m-d H:i:s', time())
|
||||
]);
|
||||
}
|
||||
echo '短信发送完成:'.$item->id.PHP_EOL;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -11,13 +11,18 @@ use app\common\Logic\NoticeLogic;
|
|||
use think\console\Command;
|
||||
use think\console\Input;
|
||||
use think\console\Output;
|
||||
use think\Db;
|
||||
use think\Exception;
|
||||
|
||||
class CheckTTSOverTimeCommand extends Command
|
||||
{
|
||||
|
||||
protected $title = 'dispatch超时未完成任务语音通知,每5分钟执行一次';
|
||||
|
||||
protected function configure()
|
||||
{
|
||||
$this->setName('check:dispatch-tts-overtime')
|
||||
->setDescription('dispatch超时未完成任务语音通知,每5分钟执行一次');
|
||||
->setDescription($this->title);
|
||||
}
|
||||
|
||||
protected function execute(Input $input, Output $output){
|
||||
|
|
@ -31,6 +36,7 @@ class CheckTTSOverTimeCommand extends Command
|
|||
->chunk(100, function ($list) {
|
||||
$ids = [];
|
||||
$logs = [];
|
||||
try {
|
||||
foreach ($list as $item) {
|
||||
$ids[] = $item->id;
|
||||
//修改状态
|
||||
|
|
@ -49,6 +55,15 @@ class CheckTTSOverTimeCommand extends Command
|
|||
$count = OrderDispatch::whereIn('id',$ids)->update(['follow'=>0,'tts_notice'=>3,'tts_check_time'=>date('Y-m-d H:i:s')]);
|
||||
echo $count.PHP_EOL;
|
||||
}
|
||||
|
||||
}catch (Exception $exception){
|
||||
Db::name('debug_log')->insert([
|
||||
'title' => $this->title,
|
||||
'content' => '错误内容:'.$exception->getMessage().',错误行:'. $exception->getLine().',错误文件:'. $exception->getFile(),
|
||||
'create_time' => date('Y-m-d H:i:s', time())
|
||||
]);
|
||||
}
|
||||
|
||||
});
|
||||
$output->info('OVER');
|
||||
}
|
||||
|
|
|
|||
|
|
@ -11,13 +11,17 @@ use app\common\Logic\NoticeLogic;
|
|||
use think\console\Command;
|
||||
use think\console\Input;
|
||||
use think\console\Output;
|
||||
use think\Db;
|
||||
use think\Exception;
|
||||
|
||||
class CheckTTSPlantCommand extends Command
|
||||
{
|
||||
protected $title = 'dispatch预约任务语音提醒,每5分钟执行一次';
|
||||
|
||||
protected function configure()
|
||||
{
|
||||
$this->setName('check:dispatch-tts-plant')
|
||||
->setDescription('dispatch已预约任务语音提醒,每5分钟执行一次');
|
||||
->setDescription($this->title);
|
||||
}
|
||||
|
||||
protected function execute(Input $input, Output $output){
|
||||
|
|
@ -33,6 +37,8 @@ class CheckTTSPlantCommand extends Command
|
|||
$ids = [];
|
||||
$logs = [];
|
||||
foreach ($list as $item) {
|
||||
|
||||
try {
|
||||
$ids[] = $item->id;
|
||||
//修改状态
|
||||
$logs[] = [
|
||||
|
|
@ -45,6 +51,13 @@ class CheckTTSPlantCommand extends Command
|
|||
'update_time' => date('Y-m-d H:i:s')
|
||||
];
|
||||
(new TtsLog())->insertAll($logs);
|
||||
}catch (Exception $exception){
|
||||
Db::name('debug_log')->insert([
|
||||
'title' => $this->title,
|
||||
'content' => '错误内容:'.$exception->getMessage().',错误行:'. $exception->getLine().',错误文件:'. $exception->getFile(),
|
||||
'create_time' => date('Y-m-d H:i:s', time())
|
||||
]);
|
||||
}
|
||||
}
|
||||
if(!empty($ids)){
|
||||
$count = OrderDispatch::whereIn('id',$ids)->update(['tts_notice'=>2,'tts_check_time'=>date('Y-m-d H:i:s')]);
|
||||
|
|
|
|||
|
|
@ -11,13 +11,17 @@ use app\common\Logic\NoticeLogic;
|
|||
use think\console\Command;
|
||||
use think\console\Input;
|
||||
use think\console\Output;
|
||||
use think\Db;
|
||||
use think\Exception;
|
||||
|
||||
class CheckTTSTaskCommand extends Command
|
||||
{
|
||||
protected $title = 'dispatch语音发送任务,每1分钟执行一次';
|
||||
|
||||
protected function configure()
|
||||
{
|
||||
$this->setName('check:dispatch-tts-task')
|
||||
->setDescription('语音发送任务,每1分钟执行一次');
|
||||
->setDescription($this->title);
|
||||
}
|
||||
|
||||
protected function execute(Input $input, Output $output){
|
||||
|
|
@ -26,7 +30,19 @@ class CheckTTSTaskCommand extends Command
|
|||
$Model->where('status','=',0)
|
||||
->chunk(100, function ($list)use($ttsService) {
|
||||
foreach ($list as $item) {
|
||||
try {
|
||||
$ttsService->callIt($item);
|
||||
}catch (Exception $exception){
|
||||
$item->status = -1;
|
||||
$item->content = $exception->getMessage();
|
||||
$item->save();
|
||||
|
||||
Db::name('debug_log')->insert([
|
||||
'title' => $this->title,
|
||||
'content' => '错误内容:'.$exception->getMessage().',错误行:'. $exception->getLine().',错误文件:'. $exception->getFile(),
|
||||
'create_time' => date('Y-m-d H:i:s', time())
|
||||
]);
|
||||
}
|
||||
echo $item->id.PHP_EOL;
|
||||
}
|
||||
});
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user