From 8316a1dfdcc49458429402f162e96d2373d39e07 Mon Sep 17 00:00:00 2001 From: xman <1946321327@qq.com> Date: Mon, 31 Mar 2025 15:15:41 +0800 Subject: [PATCH] hook --- .../admin/behavior/SendOverTimeSms.php | 24 +++++++++++ .../command/CheckOrderDispatchCommand.php | 43 +++++++++++++++++++ application/tags.php | 1 + 3 files changed, 68 insertions(+) create mode 100644 application/admin/behavior/SendOverTimeSms.php create mode 100644 application/common/command/CheckOrderDispatchCommand.php diff --git a/application/admin/behavior/SendOverTimeSms.php b/application/admin/behavior/SendOverTimeSms.php new file mode 100644 index 0000000..3a6a7d3 --- /dev/null +++ b/application/admin/behavior/SendOverTimeSms.php @@ -0,0 +1,24 @@ +status == OrderDispatch::STATUS_OVERTIME){ //发送短信 + + } + }catch (Exception $exception){ + + } + } +} diff --git a/application/common/command/CheckOrderDispatchCommand.php b/application/common/command/CheckOrderDispatchCommand.php new file mode 100644 index 0000000..647d513 --- /dev/null +++ b/application/common/command/CheckOrderDispatchCommand.php @@ -0,0 +1,43 @@ +setName('check:dispatch-overtime') + ->setDescription('检测dispatch表超时任务'); + + } + + protected function execute(Input $input, Output $output){ + + $Model = new OrderDispatch(); + + $now = date('Y-m-d H:i:s'); + + $Model->where('status',OrderDispatch::STATUS_PLANIT) + ->where('plan_time','<=',$now) + ->chunk(100, function ($list) { + foreach ($list as $item) { + //1修改为超时 + $item->status = OrderDispatch::STATUS_OVERTIME; + $item->save(); + $params = ['dispatch'=>$item,'remark'=>'系统自动处理,任务超时']; + Hook::listen('order_dispatch_change',$params); + } + }); + + } + + +} \ No newline at end of file diff --git a/application/tags.php b/application/tags.php index f1d6c53..f8f83ad 100755 --- a/application/tags.php +++ b/application/tags.php @@ -46,5 +46,6 @@ return [ 'order_dispatch_change' => [ 'app\\admin\\behavior\\OrderDispatchLog', + 'app\\admin\\behavior\\SendOverTimeSms', ], ];