transaction

This commit is contained in:
邓皓元 2019-11-15 13:03:40 +08:00
parent c755199298
commit 027f5ef85e

View File

@ -695,11 +695,18 @@ class OrderService extends Service
};
$table = $this->tables[$order['type']];
DB::table($table)->upsert($orderCards, ['sim', 'order_id', 'refunded_at', 'deleted_at']);
$fixSimArray = implode(',', $simArray);
DB::statement("select fix_timelines('{{$fixSimArray}}'::INT8[]);");
DB::transaction(function() use($table, $orderCards, $simArray) {
foreach ($orderCards as $value) {
DB::table($table)->upsert($value, ['sim', 'order_id', 'refunded_at', 'deleted_at']);
$fixSimArray = implode(',', $simArray);
DB::statement("select fix_timelines('{{$fixSimArray}}'::INT8[]);");
}
});
app(OrderCardPartitionRepository::class)->forgetCached();
return $order;
}