|
|
@@ -29,16 +29,21 @@ class OrderRejectingStatusService
|
|
|
$rejecting_status = $this->getOrderRejectingStatus($order);
|
|
|
$query = OrderDetail::query()->where('order_id', $order->id);
|
|
|
$order_detail = $query->first();
|
|
|
+ $is_new_rejecting = in_array($rejecting_status,['无','未退回']) ? '无':'有';
|
|
|
if (!$order_detail) {
|
|
|
- OrderDetail::query()->create(
|
|
|
- ['order_id' => $order->id, 'is_new_rejecting' =>$rejecting_status === '无' ? '无' : '有', 'rejecting_status' => $rejecting_status ]
|
|
|
- );
|
|
|
+ try {
|
|
|
+ OrderDetail::query()->create(
|
|
|
+ ['order_id' => $order->id, 'is_new_rejecting' => $is_new_rejecting, 'rejecting_status' => $rejecting_status]
|
|
|
+ );
|
|
|
+ } catch (\Exception $e) {
|
|
|
+ LogService::log(__CLASS__,__METHOD__,$e->getMessage());
|
|
|
+ }
|
|
|
return;
|
|
|
}
|
|
|
if (in_array($order_detail->is_new_rejecting, ['有', '已处理']) && $rejecting_status != '无') {
|
|
|
$query->update(['rejecting_status' => $rejecting_status]);
|
|
|
} else {
|
|
|
- $query->update(['rejecting_status' => $rejecting_status, 'is_new_rejecting' =>$rejecting_status === '无' ? '无' : '有']);
|
|
|
+ $query->update(['rejecting_status' => $rejecting_status, 'is_new_rejecting' =>$is_new_rejecting]);
|
|
|
}
|
|
|
}
|
|
|
|