定价
This commit is contained in:
parent
887292689f
commit
8011981e0c
@ -147,6 +147,8 @@ class OrderService extends Service
|
|||||||
$attributes['custom_price'] = $attributes['unit_price'] * $attributes['counts'];
|
$attributes['custom_price'] = $attributes['unit_price'] * $attributes['counts'];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
DB::beginTransaction();
|
||||||
|
|
||||||
if (!$attributes['id']) {
|
if (!$attributes['id']) {
|
||||||
$attributes['sn'] = $attributes['sn'] ?: $this->generateSn();
|
$attributes['sn'] = $attributes['sn'] ?: $this->generateSn();
|
||||||
$attributes['transaction_no'] = $attributes['transaction_no'] ?: $this->generateTransactionNo($attributes['pay_channel']);
|
$attributes['transaction_no'] = $attributes['transaction_no'] ?: $this->generateTransactionNo($attributes['pay_channel']);
|
||||||
@ -180,7 +182,7 @@ class OrderService extends Service
|
|||||||
throw new InvalidArgumentException('请选择卡');
|
throw new InvalidArgumentException('请选择卡');
|
||||||
}
|
}
|
||||||
|
|
||||||
DB::beginTransaction();
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
// 改企业的卡新增一批虚拟卡,并替换原有订单里的卡
|
// 改企业的卡新增一批虚拟卡,并替换原有订单里的卡
|
||||||
|
@ -157,8 +157,9 @@ class ProductService extends Service
|
|||||||
$attributes['created_at'] = date('Y-m-d H:i:s');
|
$attributes['created_at'] = date('Y-m-d H:i:s');
|
||||||
$attributes['updated_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();
|
$this->productRepository->forgetCached();
|
||||||
|
$node = $this->productRepository->where('sn', $attributes['sn'])->first();
|
||||||
}
|
}
|
||||||
DB::commit();
|
DB::commit();
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
@ -222,6 +223,7 @@ class ProductService extends Service
|
|||||||
|
|
||||||
if (!$product || $product[$field] !== $price) {
|
if (!$product || $product[$field] !== $price) {
|
||||||
$product = app(ProductService::class)->store([
|
$product = app(ProductService::class)->store([
|
||||||
|
'type' => $type === 1 ? 0 : $type,
|
||||||
'name' => $package['name'],
|
'name' => $package['name'],
|
||||||
'company_id' => $companyId,
|
'company_id' => $companyId,
|
||||||
'package_id' => $package['id'],
|
'package_id' => $package['id'],
|
||||||
|
Loading…
x
Reference in New Issue
Block a user