Commit 3c993191 by 朱继来

自营订单定时取消

parent 41a94eab
......@@ -1335,4 +1335,35 @@ Class OrderController extends Controller
}
}
// 自营订单到达48小时后自动取消订单
public function selfOrderCancel()
{
$order = DB::connection('order')
->table('lie_order')
->whereNotIn('user_id', $this->testMobile())
->where('status', '=', 2)
->where('order_goods_type', '=', 2)
->where('is_type', '=', 0)
->select('order_id', 'create_time')
->orderBy('create_time', 'DESC')
->get();
if (!empty($order)) {
foreach ($order as $v) {
$limit_time = $v->create_time + 2*86400;
if ($limit_time <= time()) {
$update = DB::connection('order')
->table('lie_order')
->where('order_id', '=', $v->order_id)
->update(['status' => -1, 'cancel_time' => time()]);
if ($update) {
continue;
}
}
}
}
}
}
\ No newline at end of file
......@@ -65,5 +65,6 @@ Route::group(['middleware' => 'web'], function () {
Route::group(['middleware' => 'api'], function () {
Route::get ('/api/check/sendsms', 'OrderController@checkOrderSendSms');
Route::get ('/api/check/cancelorder', 'OrderController@checkOrderCancel');
Route::get ('/api/check/cancelselforder', 'OrderController@selfOrderCancel');
});
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment