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

Merge Request: 修改

Created By: @todayswind
Accepted By: @todayswind
URL: https://g-bcrc3009.coding.net/p/allocatr/d/allocatr/git/merge/209?initial=true
This commit is contained in:
todayswind 2025-07-02 16:39:48 +08:00 committed by Coding
commit c25812e644
2 changed files with 8 additions and 12 deletions

View File

@ -194,15 +194,7 @@ class Order extends Backend
$build->whereIn('item_id', $item_ids);
}
if (!is_null($is_timeout)) {
if ($is_timeout == 1) {
$build->where('status', '>=', \app\admin\model\Order::STATUS_DISPATCHING)
->where('create_time', '<=', (new Carbon())->subMinutes(20)
->format('Y-m-d H:i:s'));
} else {
$build->where('status', '>=', \app\admin\model\Order::STATUS_DISPATCHING)
->where('create_time', '>', (new Carbon())->subMinutes(20)
->format('Y-m-d H:i:s'));
}
$build->where('is_overtime',$is_timeout);
}

View File

@ -22,13 +22,13 @@ class FixOrderOvertime extends Command
// 取出可能未超时标记的订单
$orders = Db::name('order')
->where('is_overtime', 0)
// ->where('id','4126')
->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);
$createTime = strtotime($order['create_time']);
$dispatchTime = $order['dispatch_time'] ? strtotime($order['dispatch_time']) : $now;
$diffMinutes = ($dispatchTime - $createTime) / 60;
@ -37,6 +37,10 @@ class FixOrderOvertime extends Command
->where('id', $order['id'])
->update(['is_overtime' => 1]);
$count++;
}else{
Db::name('order')
->where('id', $order['id'])
->update(['is_overtime' => 0]);
}
echo 'deal' . $count . PHP_EOL;
}