diff --git a/application/admin/controller/Order.php b/application/admin/controller/Order.php
index 2bc09c3..93a7de8 100644
--- a/application/admin/controller/Order.php
+++ b/application/admin/controller/Order.php
@@ -166,6 +166,8 @@ class Order extends Backend
'receive_type',
'plan_time',
'coupon_id',
+ 'is_overtime',
+ 'dispatch_admin_user',
'create_time',
'audit_time',
'total',
diff --git a/application/admin/controller/orders/Auditorder.php b/application/admin/controller/orders/Auditorder.php
index 868b3fa..2979194 100644
--- a/application/admin/controller/orders/Auditorder.php
+++ b/application/admin/controller/orders/Auditorder.php
@@ -68,7 +68,9 @@ class Auditorder extends Backend
->with([
'user' => function ($q) {
$q->field('id,nickname');
- },'workerman', 'source' => [
+ },'workerman','auditadmin' => function ($q) {
+ $q->field('id,nickname');
+ }, 'source' => [
'parent' => function ($q) {
$q->field('id,title');
}
diff --git a/application/command.php b/application/command.php
index c645023..e62e231 100755
--- a/application/command.php
+++ b/application/command.php
@@ -30,4 +30,5 @@ return [
'app\common\command\CheckTTSOverTimeCommand',
'app\common\command\CheckTTSTaskCommand',
'app\common\command\CheckTTSPlantCommand',
+ 'app\common\command\FixOrderOvertime',
];
diff --git a/application/common/command/CheckOrderDispatchCommand.php b/application/common/command/CheckOrderDispatchCommand.php
index 0adc079..70a9d52 100644
--- a/application/common/command/CheckOrderDispatchCommand.php
+++ b/application/common/command/CheckOrderDispatchCommand.php
@@ -60,6 +60,9 @@ class CheckOrderDispatchCommand extends Command
'notified_at' => $now,
'created_at' => $now,
];
+ Order::where('id',$order['id'])->update(
+ ['is_overtime' => 1]
+ );
}
Db::name('order_dispatch_notify')->insertAll($log_insert);
}
diff --git a/application/common/command/FixOrderOvertime.php b/application/common/command/FixOrderOvertime.php
new file mode 100644
index 0000000..11f7942
--- /dev/null
+++ b/application/common/command/FixOrderOvertime.php
@@ -0,0 +1,47 @@
+setName('fix:order_overtime')
+ ->setDescription('修复订单超时派单标记');
+ }
+
+ protected function execute(Input $input, Output $output)
+ {
+ $now = time();
+ $count = 0;
+
+ // 取出可能未超时标记的订单
+ $orders = Db::name('order')
+ ->where('is_overtime', 0)
+ ->field('id, create_time, dispatch_time')
+ ->select();
+
+ foreach ($orders as $order) {
+ $createTime = (int)$order['create_time'];
+ $dispatchTime = $order['dispatch_time'] ? strtotime($order['dispatch_time']) : strtotime($now);
+
+ $diffMinutes = ($dispatchTime - $createTime) / 60;
+
+ if ($diffMinutes > 20) {
+ Db::name('order')
+ ->where('id', $order['id'])
+ ->update(['is_overtime' => 1]);
+ $count++;
+ }
+ echo 'deal' . $count . PHP_EOL;
+ }
+
+ $output->writeln("已更新超时订单数量: $count");
+ $output->info('OVER');
+ }
+}
diff --git a/public/assets/js/backend/order.js b/public/assets/js/backend/order.js
index 9cfe091..5ff7b6c 100644
--- a/public/assets/js/backend/order.js
+++ b/public/assets/js/backend/order.js
@@ -132,26 +132,13 @@ ${data.receive_type == 1 ? '已收定金' : '已收全款'}
autocomplete: false
},
{
- field: 'is_timeout',
+ field: 'is_overtime',
title: '是否超时',
- formatter: function (value, row) {
- value = row.create_time;
-
- if (row.status !== 10 || !value) {
- return '';
- }
- // 解析 create_time 时间戳或字符串为时间对象
- var createTime = typeof value === 'string' ? new Date(value.replace(/-/g, '/')) : new Date(value * 1000); // 兼容时间戳和时间字符串
- var now = new Date();
- var diffMinutes = (now - createTime) / (1000 * 60); // 计算分钟差
-
- return diffMinutes > 20 ? '超时' : '未超时';
- ;
- },
searchList: {
"1": '超时',
"0": '未超时',
},
+ formatter: Table.api.formatter.label,
searchable: true,
custom: {
'1': 'danger',
@@ -159,6 +146,7 @@ ${data.receive_type == 1 ? '已收定金' : '已收全款'}
},
operate: '=',
},
+ {field: 'dispatch_admin_user', title: '派单员',operate: 'LIKE'},
{
field: 'dispatch_type',
title: '派单方式',
diff --git a/public/assets/js/backend/orders/auditorder.js b/public/assets/js/backend/orders/auditorder.js
index c5f7502..11151be 100755
--- a/public/assets/js/backend/orders/auditorder.js
+++ b/public/assets/js/backend/orders/auditorder.js
@@ -102,6 +102,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
// {field: 'audit_admin_id', title: __('Audit_admin_id')},
{field: 'create_time', title: __('Create_time'), operate:'RANGE', addclass:'datetimerange', autocomplete:false},
{field: 'update_time', title: __('Update_time'), operate:false, addclass:'datetimerange', autocomplete:false,sortable: true},
+ {field: 'audit_time', title: '完成时间', operate:'RANGE', addclass:'datetimerange', autocomplete:false},
//{field: 'auditadmin.username', title: __('Admin.username'), operate: 'LIKE'},
{field: 'auditadmin.nickname', title: __('Admin.nickname'), operate: '='},
{field: 'audit_remark', title: __('Audit_remark'), operate: false, table: table, class: 'autocontent', formatter: Table.api.formatter.content},