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
f791a54f
Commit
f791a54f
authored
Aug 11, 2021
by
luhongguang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update:商品tcc confirm处理0元单
parent
9eca48be
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
27 additions
and
1 deletion
+27
-1
Tcc2Service.php
application/services/tcc/Tcc2Service.php
+27
-1
No files found.
application/services/tcc/Tcc2Service.php
View file @
f791a54f
...
@@ -7,6 +7,7 @@ use App\Models\goods\mysql\GoodsSku;
...
@@ -7,6 +7,7 @@ use App\Models\goods\mysql\GoodsSku;
use
App\Models\goods\mysql\PindanGoodsSku
;
use
App\Models\goods\mysql\PindanGoodsSku
;
use
App\Models\goods\mysql\Tcc
;
use
App\Models\goods\mysql\Tcc
;
use
App\Models\marketing\mysql\Marketing
;
use
App\Models\marketing\mysql\Marketing
;
use
App\Models\marketing\mysql\MarketingPindan
;
class
Tcc2Service
class
Tcc2Service
{
{
...
@@ -255,7 +256,7 @@ class Tcc2Service
...
@@ -255,7 +256,7 @@ class Tcc2Service
$goodsSkuId
=
$item
[
"goods_sku_id"
];
$goodsSkuId
=
$item
[
"goods_sku_id"
];
$num
=
$item
[
"num"
];
$num
=
$item
[
"num"
];
$sku
=
PindanGoodsSku
::
getRecord
([
"goods_sku_id"
=>
$goodsSkuId
]
$sku
=
PindanGoodsSku
::
getRecord
([
"goods_sku_id"
=>
$goodsSkuId
]
,
[
"goods_sku_id"
,
"inventory_rest"
,
"total_amount_order"
,
"
inventory_lock"
,
"online_status
"
]);
,
[
"goods_sku_id"
,
"inventory_rest"
,
"total_amount_order"
,
"
total_amount_sold"
,
"inventory_lock"
,
"online_status"
,
"price
"
]);
if
(
!
empty
(
$sku
[
"inventory_lock"
])
&&
$sku
[
"online_status"
]
==
PindanGoodsSku
::
ONLINE_STATUS_ONLINE
)
{
if
(
!
empty
(
$sku
[
"inventory_lock"
])
&&
$sku
[
"online_status"
]
==
PindanGoodsSku
::
ONLINE_STATUS_ONLINE
)
{
//条件加上乐观锁
//条件加上乐观锁
...
@@ -271,6 +272,10 @@ class Tcc2Service
...
@@ -271,6 +272,10 @@ class Tcc2Service
PindanGoodsSku
::
rollback
();
PindanGoodsSku
::
rollback
();
throw
new
GoodsException
([
"cus"
=>
43
]);
throw
new
GoodsException
([
"cus"
=>
43
]);
}
}
//0元单
if
(
empty
(
$sku
[
"price"
]))
{
self
::
zeroOrder
(
$item
[
"marketing_id"
],
$item
[
"num"
],
$sku
,
$goodsSkuId
);
}
}
}
Tcc
::
save
([
"status"
=>
Tcc
::
STATUS_C1_SUCCESS
,],
[
"tid"
=>
$tid
]);
Tcc
::
save
([
"status"
=>
Tcc
::
STATUS_C1_SUCCESS
,],
[
"tid"
=>
$tid
]);
...
@@ -283,6 +288,27 @@ class Tcc2Service
...
@@ -283,6 +288,27 @@ class Tcc2Service
return
self
::
TCC_RESULT_SUCCESS
;
return
self
::
TCC_RESULT_SUCCESS
;
}
}
/**
* 0元单处理
* @param $marketingId
* @param $num
* @param $goodsSku
* @param $goodsSkuId
*/
private
static
function
zeroOrder
(
$marketingId
,
$num
,
$goodsSku
,
$goodsSkuId
)
{
$marketing
=
Marketing
::
getRecord
([
"marketing_id"
=>
$marketingId
]);
if
(
!
empty
(
$marketing
)
&&
$marketing
[
"marketing_type"
]
==
Marketing
::
MARKETING_TYPE_PINDAN
)
{
$marketingPindan
=
MarketingPindan
::
getRecord
([
"marketing_id"
=>
$marketingId
]);
if
(
!
empty
(
$marketingPindan
))
{
MarketingPindan
::
save
([
"participate_number"
=>
$marketingPindan
[
"participate_number"
]
+
$num
]
,
[
"marketing_pindan_id"
=>
$marketingPindan
[
"marketing_pindan_id"
]]);
}
PindanGoodsSku
::
save
([
"total_amount_sold"
=>
$goodsSku
[
"total_amount_sold"
]
+
$num
],
[
"goods_sku_id"
=>
$goodsSkuId
]);
}
}
/**
/**
* 下单 商品tcc cancel
* 下单 商品tcc cancel
* @param $keys
* @param $keys
...
...
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