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
91c7b16c
Commit
91c7b16c
authored
Jul 22, 2021
by
jianghaiming
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'develop' into test
parents
8f2a6787
12d5d538
Changes
6
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
330 additions
and
68 deletions
+330
-68
GoodsException.php
application/exception/custom/GoodsException.php
+1
-0
Tcc.php
application/models/goods/mysql/Tcc.php
+4
-7
Tcc.php
application/modules/Tcc/controllers/Tcc.php
+6
-60
ElasticGoodService.php
application/services/goods/ElasticGoodService.php
+1
-1
GoodsService.php
application/services/goods/GoodsService.php
+3
-0
Tcc2Service.php
application/services/tcc/Tcc2Service.php
+315
-0
No files found.
application/exception/custom/GoodsException.php
View file @
91c7b16c
...
@@ -44,5 +44,6 @@ class GoodsException extends BaseException
...
@@ -44,5 +44,6 @@ class GoodsException extends BaseException
30
=>
'当前商品已过期'
,
30
=>
'当前商品已过期'
,
31
=>
'当前商品锁定库存不足'
,
31
=>
'当前商品锁定库存不足'
,
32
=>
'当前商品已下单数量不足'
,
32
=>
'当前商品已下单数量不足'
,
33
=>
'售价不能为0'
,
];
];
}
}
\ No newline at end of file
application/models/goods/mysql/Tcc.php
View file @
91c7b16c
...
@@ -11,16 +11,13 @@ use Api\PhpUtils\Mysql\MysqlBase;
...
@@ -11,16 +11,13 @@ use Api\PhpUtils\Mysql\MysqlBase;
*/
*/
class
Tcc
extends
MysqlBase
class
Tcc
extends
MysqlBase
{
{
const
STATUS_T_SUCCESS
=
1
;
const
STATUS_C1_SUCCESS
=
2
;
const
STATUS_C2_SUCCESS
=
3
;
const
TABLE_NAME
=
'inventory_tcc_record'
;
const
TABLE_NAME
=
'inventory_tcc_record'
;
const
CONFIG_INDEX
=
'goods'
;
const
CONFIG_INDEX
=
'goods'
;
const
STATUS_TRY
=
1
;
// try
const
STATUS_CONFIRM
=
2
;
// confirm
const
STATUS_CANCEL
=
3
;
// cancel
const
OPERATOR_RESULT_FAIL
=
0
;
// 失败
const
OPERATOR_RESULT_SUCCESS
=
1
;
// 成功
public
static
function
getRecord
(
$where
,
$columns
=
[])
public
static
function
getRecord
(
$where
,
$columns
=
[])
{
{
if
(
empty
(
$columns
))
{
if
(
empty
(
$columns
))
{
...
...
application/modules/Tcc/controllers/Tcc.php
View file @
91c7b16c
...
@@ -3,9 +3,7 @@
...
@@ -3,9 +3,7 @@
use
App\Base\Base
;
use
App\Base\Base
;
use
App\Exception\custom\GoodsException
;
use
App\Exception\custom\GoodsException
;
use
\Validate\GoodsTccValidate
;
use
\Validate\GoodsTccValidate
;
use
\Validate\GoodsTccIsFinishValidate
;
use
\App\Services\tcc\Tcc2Service
;
use
\Validate\GoodsTccCancelValidate
;
use
\App\Services\tcc\TccService
;
class
TccController
extends
Base
class
TccController
extends
Base
...
@@ -19,7 +17,7 @@ class TccController extends Base
...
@@ -19,7 +17,7 @@ class TccController extends Base
{
{
(
new
GoodsTccValidate
())
->
validate
();
(
new
GoodsTccValidate
())
->
validate
();
$res
=
TccService
::
placeAnOrderTry
(
$this
->
params
[
"keys"
],
$this
->
params
[
"tid"
]);
$res
=
Tcc
2
Service
::
placeAnOrderTry
(
$this
->
params
[
"keys"
],
$this
->
params
[
"tid"
]);
if
(
$res
)
{
if
(
$res
)
{
$this
->
success
();
$this
->
success
();
}
else
{
}
else
{
...
@@ -36,7 +34,7 @@ class TccController extends Base
...
@@ -36,7 +34,7 @@ class TccController extends Base
{
{
(
new
GoodsTccValidate
())
->
validate
();
(
new
GoodsTccValidate
())
->
validate
();
$res
=
TccService
::
placeAnOrderConfirm
(
$this
->
params
[
"keys"
],
$this
->
params
[
"tid"
]);
$res
=
Tcc
2
Service
::
placeAnOrderConfirm
(
$this
->
params
[
"keys"
],
$this
->
params
[
"tid"
]);
if
(
$res
)
{
if
(
$res
)
{
$this
->
success
();
$this
->
success
();
}
else
{
}
else
{
...
@@ -45,7 +43,7 @@ class TccController extends Base
...
@@ -45,7 +43,7 @@ class TccController extends Base
}
}
/**
/**
* 下单商品
tcc
cancel
* 下单商品 cancel
* @throws \App\Exception\custom\ParamException
* @throws \App\Exception\custom\ParamException
* @throws \App\Exception\custom\ParamException
* @throws \App\Exception\custom\ParamException
*/
*/
...
@@ -53,24 +51,7 @@ class TccController extends Base
...
@@ -53,24 +51,7 @@ class TccController extends Base
{
{
(
new
GoodsTccValidate
())
->
validate
();
(
new
GoodsTccValidate
())
->
validate
();
$res
=
TccService
::
placeAnOrderCancel
(
$this
->
params
[
"keys"
],
$this
->
params
[
"tid"
]);
$res
=
Tcc2Service
::
placeAnOrderCancel
(
$this
->
params
[
"keys"
],
$this
->
params
[
"tid"
]);
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"
]);
if
(
$res
)
{
if
(
$res
)
{
$this
->
success
();
$this
->
success
();
}
else
{
}
else
{
...
@@ -80,47 +61,12 @@ class TccController extends Base
...
@@ -80,47 +61,12 @@ class TccController extends Base
/**
/**
* 取消订单单 商品tcc confirm
* 取消订单单 商品tcc confirm
* @throws \App\Exception\custom\ParamException
* @throws \App\Exception\custom\ParamException
*/
*/
public
function
cancel_order_confirmAction
()
public
function
cancel_order_confirmAction
()
{
{
(
new
GoodsTccCancelValidate
())
->
validate
();
$res
=
Tcc2Service
::
cancelConfirm
(
$this
->
params
[
"keys"
]);
$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"
]);
if
(
$res
)
{
if
(
$res
)
{
$this
->
success
();
$this
->
success
();
}
else
{
throw
new
GoodsException
([
"cus"
=>
27
]);
}
}
}
}
/**
* 判断当前tcc是否执行完成
* @throws \App\Exception\custom\ParamException
*/
public
function
tcc_is_finishAction
()
{
(
new
GoodsTccIsFinishValidate
())
->
validate
();
$res
=
TccService
::
tccIsFinish
(
$this
->
params
[
"goods_sku_id_str"
],
$this
->
params
[
"tid"
]);
$this
->
success
([
"result"
=>
$res
]);
}
}
}
\ No newline at end of file
application/services/goods/ElasticGoodService.php
View file @
91c7b16c
...
@@ -153,7 +153,7 @@ class ElasticGoodService
...
@@ -153,7 +153,7 @@ class ElasticGoodService
$result
[
"list"
][
$key
][
"life_account_id"
]
=
$source
[
"_source"
][
"life_account_id"
];
$result
[
"list"
][
$key
][
"life_account_id"
]
=
$source
[
"_source"
][
"life_account_id"
];
$result
[
"list"
][
$key
][
"life_account_name"
]
=
$source
[
"_source"
][
"life_account_name"
];
$result
[
"list"
][
$key
][
"life_account_name"
]
=
$source
[
"_source"
][
"life_account_name"
];
$result
[
"list"
][
$key
][
"life_account_icon"
]
=
$source
[
"_source"
][
"life_account_icon"
];
$result
[
"list"
][
$key
][
"life_account_icon"
]
=
$source
[
"_source"
][
"life_account_icon"
];
$result
[
"list"
][
$key
][
"distance"
]
=
empty
(
$source
[
"sort"
][
0
])
?
""
:
round
(
$source
[
"sort"
][
0
]
,
2
)
.
"km"
;
$result
[
"list"
][
$key
][
"distance"
]
=
empty
(
end
(
$source
[
"sort"
]))
?
""
:
round
(
end
(
$source
[
"sort"
])
,
2
)
.
"km"
;
$result
[
"list"
][
$key
][
"update_time"
]
=
$source
[
"_source"
][
"update_time"
];
$result
[
"list"
][
$key
][
"update_time"
]
=
$source
[
"_source"
][
"update_time"
];
}
}
}
}
...
...
application/services/goods/GoodsService.php
View file @
91c7b16c
...
@@ -176,6 +176,9 @@ class GoodsService
...
@@ -176,6 +176,9 @@ class GoodsService
if
(
$skuData
[
"expiration_time"
]
<
date
(
"Y-m-d H:i:s"
))
{
if
(
$skuData
[
"expiration_time"
]
<
date
(
"Y-m-d H:i:s"
))
{
throw
new
GoodsException
([
'cus'
=>
16
]);
throw
new
GoodsException
([
'cus'
=>
16
]);
}
}
if
(
$skuData
[
"price"
]
<=
0
)
{
throw
new
GoodsException
([
'cus'
=>
33
]);
}
$checkGoodsName
=
self
::
isHaveSensitive
(
$skuData
[
"goods_name"
],
1
);
$checkGoodsName
=
self
::
isHaveSensitive
(
$skuData
[
"goods_name"
],
1
);
if
(
$checkGoodsName
)
{
if
(
$checkGoodsName
)
{
throw
new
GoodsException
([
'cus'
=>
19
]);
throw
new
GoodsException
([
'cus'
=>
19
]);
...
...
application/services/tcc/Tcc2Service.php
0 → 100644
View file @
91c7b16c
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