Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
pay
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
pay
Commits
9fe7b281
Commit
9fe7b281
authored
Aug 30, 2021
by
wanjilong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add: 支付优化临时提交
parent
f4803cf1
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
14 additions
and
11 deletions
+14
-11
PayException.php
application/exception/custom/PayException.php
+1
-0
PayOrder.php
application/models/order/mysql/PayOrder.php
+1
-2
PayService.php
application/services/pay/PayService.php
+12
-9
No files found.
application/exception/custom/PayException.php
View file @
9fe7b281
...
...
@@ -29,6 +29,7 @@ class PayException extends BaseException
14
=>
'订单缺少商品信息,请联系管理员'
,
15
=>
'订单存在过期商品,不能支付'
,
16
=>
'订单过期,不允许支付'
,
17
=>
'订单缺少过期时间,请联系管理员'
,
];
}
application/models/order/mysql/PayOrder.php
View file @
9fe7b281
...
...
@@ -18,8 +18,7 @@ class PayOrder extends MysqlBase
self
::
beginTransaction
();
try
{
$_date
=
date
(
'Y-m-d H:i:s'
);
$order
=
self
::
getMaster
(
'*'
,
[
'order_id'
=>
$order_id
,
'expire_time[>]'
=>
$_date
]);
$order
=
self
::
getMaster
(
'*'
,
[
'order_id'
=>
$order_id
,
'pay_channel'
=>
$pay_order
[
'pay_channel'
]]);
if
(
empty
(
$order
))
{
$cnt
=
self
::
insert
(
$pay_order
,
[
'rowCount'
=>
true
]);
if
(
$cnt
)
{
...
...
application/services/pay/PayService.php
View file @
9fe7b281
...
...
@@ -50,12 +50,13 @@ class PayService
throw
new
PayException
([
'cus'
=>
3
]);
}
if
(
!
empty
(
$order_info
[
'pay_expiration_time'
]))
{
if
(
empty
(
$order_info
[
'pay_expiration_time'
]))
{
throw
new
PayException
([
'cus'
=>
17
]);
}
$pay_expiration_time
=
strtotime
(
$order_info
[
'pay_expiration_time'
]);
if
(
$pay_expiration_time
<
time
())
{
throw
new
PayException
([
'cus'
=>
16
]);
}
$pay_expiration_time
=
strtotime
(
$order_info
[
'pay_expiration_time'
]);
if
(
$pay_expiration_time
<
time
())
{
throw
new
PayException
([
'cus'
=>
16
]);
}
if
(
empty
(
$data
[
'result'
][
'order_item_list'
]))
{
...
...
@@ -93,9 +94,11 @@ class PayService
throw
new
PayException
([
'cus'
=>
15
]);
}
// 判断是否存在有效订单
$max_expire_time
=
config
(
'pay'
,
'pay.expire_time'
)
??
1800
;
$expire_time
=
time
()
+
$max_expire_time
;
//订单过期时间必须满足 70s+
if
(
$pay_expiration_time
-
$now
<
70
)
{
$pay_expiration_time
=
$now
+
70
;
}
$pay_order_id
=
$this
->
gen_pay_order_id
(
$user_id
);
$new_pay_order
=
[
'pay_order_id'
=>
$pay_order_id
,
...
...
@@ -107,7 +110,7 @@ class PayService
'pay_amount'
=>
$order_info
[
'payment'
],
'pay_channel'
=>
$pay_method_id
,
'third_order_id'
=>
''
,
'expire_time'
=>
date
(
'Y-m-d H:i:s'
,
$
expire
_time
),
'expire_time'
=>
date
(
'Y-m-d H:i:s'
,
$
pay_expiration
_time
),
'source_name'
=>
10
,
'service_name'
=>
1
,
'extra'
=>
json_encode
([]),
...
...
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