mirror of
https://gitee.com/zoujingli/ThinkAdmin.git
synced 2025-04-23 18:00:29 +08:00
Update OrderClear.php
This commit is contained in:
parent
27a6affcd3
commit
edd7fbfbb9
@ -42,15 +42,15 @@ class OrderClear extends Command
|
|||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
$map = [];
|
$map = [];
|
||||||
$map[] = ['status', '=', '1'];
|
$map[] = ['status', '<', 3];
|
||||||
$map[] = ['payment_status', '=', '0'];
|
$map[] = ['payment_status', '=', 0];
|
||||||
$map[] = ['create_at', '<', date('Y-m-d H:i:s', strtotime('-30 minutes'))];
|
$map[] = ['create_at', '<', date('Y-m-d H:i:s', strtotime('-30 minutes'))];
|
||||||
[$total, $count] = [$this->app->db->name('ShopOrder')->where($map)->count(), 0];
|
[$total, $count] = [$this->app->db->name('ShopOrder')->where($map)->count(), 0];
|
||||||
$this->app->db->name('ShopOrder')->where($map)->select()->map(function ($item) use ($total, &$count) {
|
$this->app->db->name('ShopOrder')->where($map)->select()->map(function ($item) use ($total, &$count) {
|
||||||
$this->queue->message($total, ++$count, "开始取消未支付的订单 {$item['order_no']}");
|
$this->queue->message($total, ++$count, "开始取消未支付的订单 {$item['order_no']}");
|
||||||
$this->app->db->name('ShopOrder')->where(['order_no' => $item['order_no']])->update([
|
$this->app->db->name('ShopOrder')->where(['order_no' => $item['order_no']])->update([
|
||||||
'status' => '0',
|
'status' => 0,
|
||||||
'cancel_status' => '1',
|
'cancel_status' => 1,
|
||||||
'cancel_datetime' => date('Y-m-d H:i:s'),
|
'cancel_datetime' => date('Y-m-d H:i:s'),
|
||||||
'cancel_remark' => '30分钟未完成支付已自动取消',
|
'cancel_remark' => '30分钟未完成支付已自动取消',
|
||||||
]);
|
]);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user