操作失败

This commit is contained in:
邓皓元 2019-08-16 16:00:11 +08:00
parent c6fce4c065
commit 45d1fe4858

View File

@ -954,6 +954,7 @@ class OrderService extends Service
app(RealOrderCardPartitionRepository::class)->forgetCached(); app(RealOrderCardPartitionRepository::class)->forgetCached();
} catch (\Exception $e) { } catch (\Exception $e) {
DB::rollBack(); DB::rollBack();
Log::error('操作失败 #:' . $e->getMessage());
throw new HttpException('操作失败'); throw new HttpException('操作失败');
} }
@ -1009,7 +1010,9 @@ class OrderService extends Service
foreach (array_chunk($data, 1000) as $value) { foreach (array_chunk($data, 1000) as $value) {
if ($table === 'virtual_order_cards') { if ($table === 'virtual_order_cards') {
$exists = DB::table($table)->whereIn('sim', array_pluck($value, 'sim'))->whereNull('deleted_at')->get()->pluck('sim')->toArray(); $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']); DB::table($table)->upsert($value, ['sim', 'order_id', 'refunded_at', 'deleted_at']);