where('id', $order['id'])->find(); if ($order) { Db::transaction(function () use ($order, $data) { // 执行关闭 $order->status = Order::STATUS_CLOSED; $order->ext = array_merge($order->ext, ['closed_time' => time()]); // 取消时间 $order->save(); }); } // 删除 job $job->delete(); } catch (ShoproException $e) { // 自定义异常时删除 队列 $job->delete(); format_log_error($e, 'TradeOrderAutoOper.autoClose.ShoproException'); } catch (HttpResponseException $e) { $data = $e->getResponse()->getData(); $message = $data ? ($data['msg'] ?? '') : $e->getMessage(); format_log_error($e, 'TradeOrderAutoOper.autoClose.HttpResponseException', $message); } catch (\Exception $e) { // 队列执行失败 format_log_error($e, 'TradeOrderAutoOper.autoClose'); } } }