diff --git a/application/common/command/CheckOrderDispatchCommand.php b/application/common/command/CheckOrderDispatchCommand.php new file mode 100644 index 0000000..e6f8125 --- /dev/null +++ b/application/common/command/CheckOrderDispatchCommand.php @@ -0,0 +1,65 @@ +setName('check:dispatch') + ->setDescription($this->title); + } + + protected function execute(Input $input, Output $output){ + // 查询所有待派单,且未通知过的订单 + $orders = Db::name('order') + ->alias('o') + ->join('order_dispatch_notify n', 'o.id = n.order_id','left') + ->where('o.status', Order::STATUS_DISPATCHING) + ->whereNull('n.id') // 没有记录就表示还没通知 + ->where('o.create_time', '<=', now()->format('Y-m-d H:i:s')) + ->field(['o.id','o.area_id','o.order_no']) + ->select(); + $log_insert = []; + $now = now()->format('Y-m-d H:i:s'); + + foreach ($orders as $order){ + $area_id = substr($order['area_id'], 0, 4); + $res = Admin::where('area_ids', 'like', '%' . $area_id . '%') + ->column('id'); + + $insert = []; + foreach ($res as $re) { + $insert [] = [ + 'to_id' => $re, + 'type' => 1, + 'title' => '订单未派单超时通知', + 'content' => '您有一条订单号为 ' . $order['order_no'] . ' 超过20分钟未派单,请及时派单!' + ]; + } + $build = new Message(); + $build->saveAll($insert); + $log_insert [] = [ + 'order_id' => $order['id'], + 'notified_at' => $now, + 'created_at' => $now, + ]; + } + Db::name('order_dispatch_notify')->insertAll($log_insert); + } +} \ No newline at end of file diff --git a/crontab b/crontab index 9f15d46..7d4c28a 100755 --- a/crontab +++ b/crontab @@ -1,4 +1,5 @@ * * * * * docker exec php-www php /var/www/html/allocatr/think check:dispatch-toget >> /var/log/mycron.log 2>&1 +* * * * * docker exec php-www php /var/www/html/allocatr/think check:dispatch >> /var/log/mycron.log 2>&1 1 9 * * * docker exec php-www php /var/www/html/allocatr/think check:dispatch-record-notice >> /var/log/mycron.log 2>&1 */5 * * * * docker exec php-www php /var/www/html/allocatr/think check:dispatch-sms-plant >> /var/log/mycron.log 2>&1 */5 * * * * docker exec php-www php /var/www/html/allocatr/think check:dispatch-tts-overtime >> /var/log/mycron.log 2>&1 diff --git a/public/assets/js/backend/message.js b/public/assets/js/backend/message.js index 87a7904..babd5b8 100644 --- a/public/assets/js/backend/message.js +++ b/public/assets/js/backend/message.js @@ -43,7 +43,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin return val; } }, - {field: 'content', title: __('Content'), operate: false, table: table, class: 'autocontent', formatter: Table.api.formatter.content}, + {field: 'content', title: __('Content'), operate: false, table: table, class: 'autocontent', width:'600', formatter: Table.api.formatter.content}, // {field: 'uri', title: __('Uri'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content}, {field: 'create_time', title: __('Create_time'), operate:'RANGE', addclass:'datetimerange', autocomplete:false}, // {field: 'update_time', title: __('Update_time'), operate:'RANGE', addclass:'datetimerange', autocomplete:false},