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
d20641ab
Commit
d20641ab
authored
Jul 02, 2021
by
jianghaiming
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'develop' of
https://gitlab.yidian-inc.com/bp/goods
into develop
parents
72b640d1
523222ef
Changes
5
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
413 additions
and
158 deletions
+413
-158
GoodsException.php
application/exception/custom/GoodsException.php
+1
-0
GoodsTccCancelValidate.php
application/library/Validate/GoodsTccCancelValidate.php
+25
-0
GoodsTccIsFinishValidate.php
application/library/Validate/GoodsTccIsFinishValidate.php
+23
-0
Tcc.php
application/modules/Tcc/controllers/Tcc.php
+44
-11
TccService.php
application/services/tcc/TccService.php
+320
-147
No files found.
application/exception/custom/GoodsException.php
View file @
d20641ab
...
...
@@ -38,5 +38,6 @@ class GoodsException extends BaseException
24
=>
'当前商品库存不足'
,
25
=>
'开始时间格式不对'
,
26
=>
'结束时间格式不对'
,
27
=>
'TCC调用失败'
,
];
}
\ No newline at end of file
application/library/Validate/GoodsTccCancelValidate.php
0 → 100644
View file @
d20641ab
<?php
namespace
Validate
;
/**
* Class GoodsTccCancelValidate
*
* @package Validate
*/
class
GoodsTccCancelValidate
extends
BaseValidate
{
protected
$rule
=
[
'tid'
=>
'require'
,
'keys'
=>
'require'
,
'type'
=>
'require'
,
];
protected
$message
=
[
"tid"
=>
"tcc事务id不能为空"
,
"keys"
=>
"商品信息不能为空"
,
"type"
=>
"类型字段不能为空"
,
];
}
\ No newline at end of file
application/library/Validate/GoodsTccIsFinishValidate.php
0 → 100644
View file @
d20641ab
<?php
namespace
Validate
;
/**
* Class GoodsTccIsFinishValidate
*
* @package Validate
*/
class
GoodsTccIsFinishValidate
extends
BaseValidate
{
protected
$rule
=
[
'tid'
=>
'require'
,
'goods_sku_id_str'
=>
'require'
,
];
protected
$message
=
[
"tid"
=>
"tcc事务id不能为空"
,
"goods_sku_id_str"
=>
"商品sku_id不能为空"
,
];
}
\ No newline at end of file
application/modules/Tcc/controllers/Tcc.php
View file @
d20641ab
<?php
use
App\Base\Base
;
use
App\Exception\custom\GoodsException
;
use
\Validate\GoodsTccValidate
;
use
\Validate\GoodsTccIsFinishValidate
;
use
\Validate\GoodsTccCancelValidate
;
use
\App\Services\tcc\TccService
;
...
...
@@ -9,6 +12,7 @@ class TccController extends Base
{
/**
* 下单商品 tcc try
* @throws GoodsException
* @throws \App\Exception\custom\ParamException
*/
public
function
place_an_order_tryAction
()
...
...
@@ -16,67 +20,96 @@ class TccController extends Base
(
new
GoodsTccValidate
())
->
validate
();
$res
=
TccService
::
placeAnOrderTry
(
$this
->
params
[
"keys"
],
$this
->
params
[
"tid"
]);
$this
->
success
([
"result"
=>
$res
]);
if
(
$res
)
{
$this
->
success
();
}
else
{
throw
new
GoodsException
([
"cus"
=>
27
]);
}
}
/**
* 下单商品 tcc confirm
* @throws \App\Exception\custom\ParamException
* @throws \App\Exception\custom\ParamException
*/
public
function
place_an_order_confirmAction
()
{
(
new
GoodsTccValidate
())
->
validate
();
$res
=
TccService
::
placeAnOrderConfirm
(
$this
->
params
[
"keys"
],
$this
->
params
[
"tid"
]);
$this
->
success
([
"result"
=>
$res
]);
if
(
$res
)
{
$this
->
success
();
}
else
{
throw
new
GoodsException
([
"cus"
=>
27
]);
}
}
/**
* 下单商品 tcc cancel
* @throws \App\Exception\custom\ParamException
* @throws \App\Exception\custom\ParamException
*/
public
function
place_an_order_cancelAction
()
{
(
new
GoodsTccValidate
())
->
validate
();
$res
=
TccService
::
placeAnOrderCancel
(
$this
->
params
[
"keys"
],
$this
->
params
[
"tid"
]);
$this
->
success
([
"result"
=>
$res
]);
if
(
$res
)
{
$this
->
success
();
}
else
{
throw
new
GoodsException
([
"cus"
=>
27
]);
}
}
/**
* 取消订单单 商品tcc try
* @throws \App\Exception\custom\ParamException
* @throws \App\Exception\custom\ParamException
*/
public
function
cancel_order_tryAction
()
{
(
new
GoodsTccValidate
())
->
validate
();
$res
=
TccService
::
cancelOrderTry
(
$this
->
params
[
"keys"
],
$this
->
params
[
"tid"
]);
$this
->
success
([
"result"
=>
$res
]);
if
(
$res
)
{
$this
->
success
();
}
else
{
throw
new
GoodsException
([
"cus"
=>
27
]);
}
}
/**
* 取消订单单 商品tcc confirm
* @throws \App\Exception\custom\ParamException
* @throws \App\Exception\custom\ParamException
*/
public
function
cancel_order_confirmAction
()
{
(
new
GoodsTccValidate
())
->
validate
();
$res
=
TccService
::
cancelOrderConfirm
(
$this
->
params
[
"keys"
],
$this
->
params
[
"tid"
]);
$this
->
success
([
"result"
=>
$res
]);
(
new
GoodsTccCancelValidate
())
->
validate
();
$res
=
TccService
::
cancelOrderConfirm
(
$this
->
params
[
"keys"
],
$this
->
params
[
"tid"
],
$this
->
params
[
"type"
]);
if
(
$res
)
{
$this
->
success
();
}
else
{
throw
new
GoodsException
([
"cus"
=>
27
]);
}
}
/**
* 取消订单单 商品tcc cancel
* @throws \App\Exception\custom\ParamException
* @throws \App\Exception\custom\ParamException
*/
public
function
cancel_order_cancelAction
()
{
(
new
GoodsTccValidate
())
->
validate
();
$res
=
TccService
::
cancelOrderCancel
(
$this
->
params
[
"keys"
],
$this
->
params
[
"tid"
]);
$this
->
success
([
"result"
=>
$res
]);
if
(
$res
)
{
$this
->
success
();
}
else
{
throw
new
GoodsException
([
"cus"
=>
27
]);
}
}
/**
...
...
@@ -85,9 +118,9 @@ class TccController extends Base
*/
public
function
tcc_is_finishAction
()
{
(
new
GoodsTccValidate
())
->
validate
();
(
new
GoodsTcc
IsFinish
Validate
())
->
validate
();
$res
=
TccService
::
tccIsFinish
(
$this
->
params
[
"
keys
"
],
$this
->
params
[
"tid"
]);
$res
=
TccService
::
tccIsFinish
(
$this
->
params
[
"
goods_sku_id_str
"
],
$this
->
params
[
"tid"
]);
$this
->
success
([
"result"
=>
$res
]);
}
}
\ No newline at end of file
application/services/tcc/TccService.php
View file @
d20641ab
This diff is collapsed.
Click to expand it.
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