修改
This commit is contained in:
parent
c24cdef115
commit
5b9c70ab43
|
|
@ -194,15 +194,7 @@ class Order extends Backend
|
||||||
$build->whereIn('item_id', $item_ids);
|
$build->whereIn('item_id', $item_ids);
|
||||||
}
|
}
|
||||||
if (!is_null($is_timeout)) {
|
if (!is_null($is_timeout)) {
|
||||||
if ($is_timeout == 1) {
|
$build->where('is_overtime',$is_timeout);
|
||||||
$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'));
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -22,13 +22,13 @@ class FixOrderOvertime extends Command
|
||||||
|
|
||||||
// 取出可能未超时标记的订单
|
// 取出可能未超时标记的订单
|
||||||
$orders = Db::name('order')
|
$orders = Db::name('order')
|
||||||
->where('is_overtime', 0)
|
// ->where('id','4126')
|
||||||
->field('id, create_time, dispatch_time')
|
->field('id, create_time, dispatch_time')
|
||||||
->select();
|
->select();
|
||||||
|
|
||||||
foreach ($orders as $order) {
|
foreach ($orders as $order) {
|
||||||
$createTime = (int)$order['create_time'];
|
$createTime = strtotime($order['create_time']);
|
||||||
$dispatchTime = $order['dispatch_time'] ? strtotime($order['dispatch_time']) : strtotime($now);
|
$dispatchTime = $order['dispatch_time'] ? strtotime($order['dispatch_time']) : $now;
|
||||||
|
|
||||||
$diffMinutes = ($dispatchTime - $createTime) / 60;
|
$diffMinutes = ($dispatchTime - $createTime) / 60;
|
||||||
|
|
||||||
|
|
@ -37,6 +37,10 @@ class FixOrderOvertime extends Command
|
||||||
->where('id', $order['id'])
|
->where('id', $order['id'])
|
||||||
->update(['is_overtime' => 1]);
|
->update(['is_overtime' => 1]);
|
||||||
$count++;
|
$count++;
|
||||||
|
}else{
|
||||||
|
Db::name('order')
|
||||||
|
->where('id', $order['id'])
|
||||||
|
->update(['is_overtime' => 0]);
|
||||||
}
|
}
|
||||||
echo 'deal' . $count . PHP_EOL;
|
echo 'deal' . $count . PHP_EOL;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user