diff --git a/app/Domains/Virtual/Services/OrderService.php b/app/Domains/Virtual/Services/OrderService.php index c181c5f4..7dc03dd9 100644 --- a/app/Domains/Virtual/Services/OrderService.php +++ b/app/Domains/Virtual/Services/OrderService.php @@ -954,6 +954,7 @@ class OrderService extends Service app(RealOrderCardPartitionRepository::class)->forgetCached(); } catch (\Exception $e) { DB::rollBack(); + Log::error('操作失败 #:' . $e->getMessage()); throw new HttpException('操作失败'); } @@ -1009,7 +1010,9 @@ class OrderService extends Service foreach (array_chunk($data, 1000) as $value) { if ($table === 'virtual_order_cards') { $exists = DB::table($table)->whereIn('sim', array_pluck($value, 'sim'))->whereNull('deleted_at')->get()->pluck('sim')->toArray(); - throw new ExistedException('出现重复销售卡 #:' . implode(',', $exists)); + if (!empty($exists)) { + throw new ExistedException('出现重复销售卡 #:' . implode(',', $exists)); + } } DB::table($table)->upsert($value, ['sim', 'order_id', 'refunded_at', 'deleted_at']);