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
e2a3db60
Commit
e2a3db60
authored
Aug 13, 2021
by
cuiweifeng
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'jielong' into test
parents
e926986f
bff570d0
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
15 deletions
+9
-15
GoodsException.php
application/exception/custom/GoodsException.php
+1
-0
Tcc2Service.php
application/services/tcc/Tcc2Service.php
+8
-15
No files found.
application/exception/custom/GoodsException.php
View file @
e2a3db60
...
...
@@ -63,5 +63,6 @@ class GoodsException extends BaseException
44
=>
'事务commit失败'
,
45
=>
'还没有try,就去执行confirm'
,
46
=>
'已经执行过cancel'
,
47
=>
'sku rollback error'
,
];
}
\ No newline at end of file
application/services/tcc/Tcc2Service.php
View file @
e2a3db60
...
...
@@ -545,24 +545,17 @@ class Tcc2Service
if
(
!
empty
(
$goodsInfoList
))
{
PindanGoodsSku
::
beginTransaction
();
foreach
(
$goodsInfoList
as
$item
)
{
$goodsSkuId
=
$item
[
"goods_sku_id"
];
$num
=
$item
[
"num"
];
$sku
=
PindanGoodsSku
::
getRecordMaster
([
"goods_sku_id"
=>
$goodsSkuId
]
,
[
"goods_sku_id"
,
"total_amount_order"
,
"inventory_rest"
,
"inventory_lock"
,
"online_status"
]);
if
(
!
empty
(
$sku
[
0
]))
{
$params
=
[
"inventory_rest"
=>
$sku
[
0
][
"inventory_rest"
]
+
$num
,
"total_amount_order"
=>
$sku
[
0
][
"total_amount_order"
]
-
$num
,
];
$rowCount
=
PindanGoodsSku
::
save
(
$params
,
[
"goods_sku_id"
=>
$goodsSkuId
,
"total_amount_order[>=]"
=>
$num
]);
if
(
$rowCount
<=
0
)
{
PindanGoodsSku
::
rollback
();
throw
new
GoodsException
([
"cus"
=>
32
]);
}
$params
=
[
"inventory_rest[+]"
=>
$num
,
"total_amount_order[-]"
=>
$num
,
];
$rowCount
=
PindanGoodsSku
::
save
(
$params
,
[
"goods_sku_id"
=>
$item
[
"goods_sku_id"
]]);
if
(
$rowCount
<=
0
)
{
PindanGoodsSku
::
rollback
();
throw
new
GoodsException
([
"cus"
=>
47
]);
}
}
if
(
!
PindanGoodsSku
::
commit
())
{
PindanGoodsSku
::
rollback
();
}
...
...
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