Accept Merge Request #208: (feature/hant -> develop)

Merge Request: 修改

Created By: @todayswind
Accepted By: @todayswind
URL: https://g-bcrc3009.coding.net/p/allocatr/d/allocatr/git/merge/208?initial=true
This commit is contained in:
todayswind 2025-07-02 16:29:58 +08:00 committed by Coding
commit 4e3394ab02
7 changed files with 60 additions and 16 deletions

View File

@ -166,6 +166,8 @@ class Order extends Backend
'receive_type',
'plan_time',
'coupon_id',
'is_overtime',
'dispatch_admin_user',
'create_time',
'audit_time',
'total',

View File

@ -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');
}

View File

@ -30,4 +30,5 @@ return [
'app\common\command\CheckTTSOverTimeCommand',
'app\common\command\CheckTTSTaskCommand',
'app\common\command\CheckTTSPlantCommand',
'app\common\command\FixOrderOvertime',
];

View File

@ -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);
}

View File

@ -0,0 +1,47 @@
<?php
namespace app\common\command;
use think\console\Command;
use think\console\Input;
use think\console\Output;
use think\Db;
class FixOrderOvertime extends Command
{
protected function configure()
{
$this->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');
}
}

View File

@ -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 ? '<span style="color: red;">超时</span>' : '<span class="label label-success">未超时</span>';
;
},
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: '派单方式',

View File

@ -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},