From 45d1fe48586f0cede24f2c8893e18d01cd492772 Mon Sep 17 00:00:00 2001 From: denghy Date: Fri, 16 Aug 2019 16:00:11 +0800 Subject: [PATCH] =?UTF-8?q?=E6=93=8D=E4=BD=9C=E5=A4=B1=E8=B4=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Domains/Virtual/Services/OrderService.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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']);