Commit 33d99783 by 杨树贤

修复事务时机的问题

parent 7fbb0f0d
...@@ -183,11 +183,13 @@ class SupplierApiController extends Controller ...@@ -183,11 +183,13 @@ class SupplierApiController extends Controller
if (checkPerm('IgnoreCompanyCheck')) { if (checkPerm('IgnoreCompanyCheck')) {
$channel['is_standard_add'] = -1; $channel['is_standard_add'] = -1;
} }
if (SupplierChannelModel::where('supplier_name', trim($channel['supplier_name']))->exists()) { if (SupplierChannelModel::where('supplier_name', trim($channel['supplier_name']))->exists()) {
$this->response(0, '操作成功'); $this->response(0, '操作成功');
} }
$service = new SupplierService(); $service = new SupplierService();
$supplierId = $service->saveSupplier($channel); $supplierId = $service->saveSupplier($channel);
dd(123);
if (!$supplierId) { if (!$supplierId) {
$this->response(-1, '操作失败'); $this->response(-1, '操作失败');
} }
......
...@@ -220,10 +220,7 @@ class SupplierService ...@@ -220,10 +220,7 @@ class SupplierService
$supplierAddressService = new SupplierAddressService(); $supplierAddressService = new SupplierAddressService();
$supplierAddressService->saveShippingAddress($supplierId, $shippingAddress); $supplierAddressService->saveShippingAddress($supplierId, $shippingAddress);
//一体化新流程,如果是新建,新建完了以后还要去请求一次验证实体名单的接口,因为只有新建完才有具体的地址source_id这些东西
if (empty($channel['supplier_id'])) {
(new CompanyService())->checkSupplierCompanyAndAddress($supplierId);
}
} else { } else {
/**这里的是更新供应商的操作**/ /**这里的是更新供应商的操作**/
...@@ -340,6 +337,12 @@ class SupplierService ...@@ -340,6 +337,12 @@ class SupplierService
$logContent = '确认新增供应商'; $logContent = '确认新增供应商';
} }
//一体化新流程,如果是新建,新建完了以后还要去请求一次验证实体名单的接口,因为只有新建完才有具体的地址source_id这些东西,为什么不放到数据库事务里面,因为校验完
//但是供应商还没有插入db的时候,可能会提前广播到,导致没法操作供应商的状态(因为供应商都还没有生成)
if (empty($channel['supplier_id'])) {
(new CompanyService())->checkSupplierCompanyAndAddress($supplierId);
}
$contentChange = true; $contentChange = true;
//过滤掉没有修改的操作,但是需要记录一条更新记录(用于判断是否可以审核) //过滤掉没有修改的操作,但是需要记录一条更新记录(用于判断是否可以审核)
if (!empty($oldSupplier) && !empty($newSupplier)) { if (!empty($oldSupplier) && !empty($newSupplier)) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment