Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
G
goods
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
bp
goods
Commits
e2af1318
Commit
e2af1318
authored
Aug 13, 2021
by
cuiweifeng
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update tcc goods rollback fix
parent
1f5ca56c
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
5 additions
and
9 deletions
+5
-9
GoodsException.php
application/exception/custom/GoodsException.php
+1
-0
Tcc2Service.php
application/services/tcc/Tcc2Service.php
+4
-9
No files found.
application/exception/custom/GoodsException.php
View file @
e2af1318
...
@@ -63,5 +63,6 @@ class GoodsException extends BaseException
...
@@ -63,5 +63,6 @@ class GoodsException extends BaseException
44
=>
'事务commit失败'
,
44
=>
'事务commit失败'
,
45
=>
'还没有try,就去执行confirm'
,
45
=>
'还没有try,就去执行confirm'
,
46
=>
'已经执行过cancel'
,
46
=>
'已经执行过cancel'
,
47
=>
'sku rollback error'
,
];
];
}
}
\ No newline at end of file
application/services/tcc/Tcc2Service.php
View file @
e2af1318
...
@@ -545,20 +545,15 @@ class Tcc2Service
...
@@ -545,20 +545,15 @@ class Tcc2Service
if
(
!
empty
(
$goodsInfoList
))
{
if
(
!
empty
(
$goodsInfoList
))
{
PindanGoodsSku
::
beginTransaction
();
PindanGoodsSku
::
beginTransaction
();
foreach
(
$goodsInfoList
as
$item
)
{
foreach
(
$goodsInfoList
as
$item
)
{
$goodsSkuId
=
$item
[
"goods_sku_id"
];
$num
=
$item
[
"num"
];
$num
=
$item
[
"num"
];
$sku
=
PindanGoodsSku
::
getRecord
([
"goods_sku_id"
=>
$goodsSkuId
]
,
[
"goods_sku_id"
,
"total_amount_order"
,
"inventory_rest"
,
"inventory_lock"
,
"online_status"
]);
$params
=
[
$params
=
[
"inventory_rest
"
=>
$sku
[
"inventory_rest"
]
+
$num
,
"inventory_rest
[+]"
=>
$num
,
"total_amount_order
"
=>
$sku
[
"total_amount_order"
]
-
$num
,
"total_amount_order
[-]"
=>
$num
,
];
];
$rowCount
=
PindanGoodsSku
::
save
(
$params
,
[
"goods_sku_id"
=>
$
goodsSkuId
,
"total_amount_order[>=]"
=>
$num
]);
$rowCount
=
PindanGoodsSku
::
save
(
$params
,
[
"goods_sku_id"
=>
$
item
[
"goods_sku_id"
]
]);
if
(
$rowCount
<=
0
)
{
if
(
$rowCount
<=
0
)
{
PindanGoodsSku
::
rollback
();
PindanGoodsSku
::
rollback
();
throw
new
GoodsException
([
"cus"
=>
32
]);
throw
new
GoodsException
([
"cus"
=>
47
]);
}
}
}
}
...
...
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