Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
5
51business
Project
Project
Details
Activity
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
方斌
51business
Commits
96eda6c2
Commit
96eda6c2
authored
Sep 27, 2019
by
李尚科
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix
parent
a6eaeb12
Pipeline
#14341
passed with stage
in 12 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
4 deletions
+4
-4
order.js
app/service/credit/order.js
+4
-4
No files found.
app/service/credit/order.js
View file @
96eda6c2
...
...
@@ -61,18 +61,18 @@ class OrderService extends Service {
async
updateOrderStateToOverdue
(
order
)
{
const
{
ctx
}
=
this
;
const
{
id
,
order_time
,
state
,
pay_status
}
=
order
;
let
{
id
,
order_time
,
state
,
pay_status
,
state_time
}
=
order
;
if
(
!
id
||
!
order_time
||
!
state
||
typeof
(
pay_status
)
===
'undefined'
)
{
return
order
;
}
const
expire_time
=
moment
(
order_time
).
valueOf
()
+
24
*
3600
*
1000
;
const
now_time
=
moment
().
valueOf
();
const
state_time
=
moment
().
format
(
'YYYY-MM-DD HH:mm:ss'
);
if
(
state
===
'支付中'
&&
pay_status
===
0
&&
moment
(
order_time
).
valueOf
()
*
300
<
now_time
)
{
if
([
'支付中'
].
includes
(
state
)
&&
moment
(
state_time
).
valueOf
()
+
300
<
now_time
)
{
await
this
.
logOrder
(
id
);
await
ctx
.
prometheusModel
.
CreditOrder
.
update
({
state
:
'待支付'
,
state_time
:
state_time
},
{
where
:
{
id
}
});
}
if
(
expire_time
<
now_time
&&
(
state
===
'待支付'
||
state
===
'已取消'
||
state
===
'支付中'
)
&&
pay_status
===
0
)
{
state_time
=
moment
().
format
(
'YYYY-MM-DD HH:mm:ss'
);
if
(
expire_time
<
now_time
&&
[
'待支付'
,
'已取消'
,
'支付中'
].
includes
(
state
))
{
await
this
.
logOrder
(
id
);
const
ret
=
await
ctx
.
prometheusModel
.
CreditOrder
.
update
({
state
:
'已失效'
,
state_time
:
state_time
},
{
where
:
{
id
}
});
if
(
ret
&&
ret
[
0
])
{
...
...
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