This commit is contained in:
邓皓元 2019-04-12 15:11:35 +08:00
parent 887292689f
commit 8011981e0c
2 changed files with 6 additions and 2 deletions

View File

@ -147,6 +147,8 @@ class OrderService extends Service
$attributes['custom_price'] = $attributes['unit_price'] * $attributes['counts'];
}
DB::beginTransaction();
if (!$attributes['id']) {
$attributes['sn'] = $attributes['sn'] ?: $this->generateSn();
$attributes['transaction_no'] = $attributes['transaction_no'] ?: $this->generateTransactionNo($attributes['pay_channel']);
@ -180,7 +182,7 @@ class OrderService extends Service
throw new InvalidArgumentException('请选择卡');
}
DB::beginTransaction();
try {
// 改企业的卡新增一批虚拟卡,并替换原有订单里的卡

View File

@ -157,8 +157,9 @@ class ProductService extends Service
$attributes['created_at'] = date('Y-m-d H:i:s');
$attributes['updated_at'] = date('Y-m-d H:i:s');
$node = $this->productRepository->upsert($attributes, ['sn', 'deleted_at']);
$this->productRepository->upsert($attributes, ['sn', 'deleted_at']);
$this->productRepository->forgetCached();
$node = $this->productRepository->where('sn', $attributes['sn'])->first();
}
DB::commit();
} catch (\Exception $e) {
@ -222,6 +223,7 @@ class ProductService extends Service
if (!$product || $product[$field] !== $price) {
$product = app(ProductService::class)->store([
'type' => $type === 1 ? 0 : $type,
'name' => $package['name'],
'company_id' => $companyId,
'package_id' => $package['id'],