Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
杨树贤
/
liexin_supplier
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
33d99783
authored
Jun 25, 2024
by
杨树贤
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
修复事务时机的问题
parent
7fbb0f0d
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
4 deletions
app/Http/Controllers/Api/SupplierApiController.php
app/Http/Services/SupplierService.php
app/Http/Controllers/Api/SupplierApiController.php
View file @
33d99783
...
...
@@ -183,11 +183,13 @@ class SupplierApiController extends Controller
if
(
checkPerm
(
'IgnoreCompanyCheck'
))
{
$channel
[
'is_standard_add'
]
=
-
1
;
}
if
(
SupplierChannelModel
::
where
(
'supplier_name'
,
trim
(
$channel
[
'supplier_name'
]))
->
exists
())
{
$this
->
response
(
0
,
'操作成功'
);
}
$service
=
new
SupplierService
();
$supplierId
=
$service
->
saveSupplier
(
$channel
);
dd
(
123
);
if
(
!
$supplierId
)
{
$this
->
response
(
-
1
,
'操作失败'
);
}
...
...
app/Http/Services/SupplierService.php
View file @
33d99783
...
...
@@ -220,10 +220,7 @@ class SupplierService
$supplierAddressService
=
new
SupplierAddressService
();
$supplierAddressService
->
saveShippingAddress
(
$supplierId
,
$shippingAddress
);
//一体化新流程,如果是新建,新建完了以后还要去请求一次验证实体名单的接口,因为只有新建完才有具体的地址source_id这些东西
if
(
empty
(
$channel
[
'supplier_id'
]))
{
(
new
CompanyService
())
->
checkSupplierCompanyAndAddress
(
$supplierId
);
}
}
else
{
/**这里的是更新供应商的操作**/
...
...
@@ -340,6 +337,12 @@ class SupplierService
$logContent
=
'确认新增供应商'
;
}
//一体化新流程,如果是新建,新建完了以后还要去请求一次验证实体名单的接口,因为只有新建完才有具体的地址source_id这些东西,为什么不放到数据库事务里面,因为校验完
//但是供应商还没有插入db的时候,可能会提前广播到,导致没法操作供应商的状态(因为供应商都还没有生成)
if
(
empty
(
$channel
[
'supplier_id'
]))
{
(
new
CompanyService
())
->
checkSupplierCompanyAndAddress
(
$supplierId
);
}
$contentChange
=
true
;
//过滤掉没有修改的操作,但是需要记录一条更新记录(用于判断是否可以审核)
if
(
!
empty
(
$oldSupplier
)
&&
!
empty
(
$newSupplier
))
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment