Toggle navigation
Toggle navigation
This project
Loading...
Sign in
fe
/
yohobuy-node
·
Commits
Go to a project
GitLab
Go to group
Project
Activity
Files
Commits
Pipelines
0
Builds
0
Graphs
Milestones
Issues
1
Merge Requests
0
Members
Labels
Wiki
Forks
Network
Create a new issue
Download as
Email Patches
Plain Diff
Browse Files
Authored by
陈峰
6 years ago
Commit
1d87ac2d048991c0fa0e774bece2837ee711ee2d
1 parent
ea48ef99
fix pay api pay_expire
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
36 additions
and
9 deletions
apps/home/models/orders-api.js
apps/shopping/controllers/pay.js
apps/shopping/models/pay-api.js
apps/home/models/orders-api.js
View file @
1d87ac2
...
...
@@ -2,6 +2,7 @@
* @author: weiqingting<qingting.wei@yoho.cn>
*/
'use strict'
;
const
moment
=
require
(
'moment'
);
module
.
exports
=
class
extends
global
.
yoho
.
BaseModel
{
constructor
(
ctx
)
{
...
...
@@ -41,7 +42,23 @@ module.exports = class extends global.yoho.BaseModel {
order_code
:
orderCode
};
return
this
.
get
({
data
:
options
});
return
this
.
get
({
data
:
options
}).
then
(
result
=>
{
if
(
result
.
code
===
200
&&
result
.
data
)
{
if
(
result
.
data
.
pay_lefttime
)
{
result
.
data
.
pay_lefttime
=
+
result
.
data
.
pay_lefttime
-
3600
;
if
(
result
.
data
.
pay_lefttime
<
0
)
{
result
.
data
.
pay_lefttime
=
0
;
}
}
if
(
result
.
data
.
pay_expire
)
{
result
.
data
.
pay_expire
=
moment
(
result
.
data
.
pay_expire
)
.
subtract
(
1
,
'hour'
)
.
format
(
'YYYY-MM-DD HH:mm:ss'
);
}
}
return
result
;
});
}
/**
...
...
apps/shopping/controllers/pay.js
View file @
1d87ac2
...
...
@@ -39,13 +39,6 @@ const online = (req, res, next) => {
return
next
();
}
if
(
order
.
pay_lefttime
)
{
order
.
pay_lefttime
=
+
order
.
pay_lefttime
-
3600
;
if
(
order
.
pay_lefttime
<
0
)
{
order
.
pay_lefttime
=
0
;
}
}
order
.
payment_type
=
parseInt
(
order
.
payment_type
,
10
);
...
...
apps/shopping/models/pay-api.js
View file @
1d87ac2
...
...
@@ -5,6 +5,7 @@
*/
'use strict'
;
const
moment
=
require
(
'moment'
);
module
.
exports
=
class
extends
global
.
yoho
.
BaseModel
{
constructor
(
ctx
)
{
...
...
@@ -100,7 +101,23 @@ module.exports = class extends global.yoho.BaseModel {
order_code
:
orderCode
};
return
this
.
get
({
data
:
options
});
return
this
.
get
({
data
:
options
}).
then
(
result
=>
{
if
(
result
.
code
===
200
&&
result
.
data
)
{
if
(
result
.
data
.
pay_lefttime
)
{
result
.
data
.
pay_lefttime
=
+
result
.
data
.
pay_lefttime
-
3600
;
if
(
result
.
data
.
pay_lefttime
<
0
)
{
result
.
data
.
pay_lefttime
=
0
;
}
}
if
(
result
.
data
.
pay_expire
)
{
result
.
data
.
pay_expire
=
moment
(
result
.
data
.
pay_expire
)
.
subtract
(
1
,
'hour'
)
.
format
(
'YYYY-MM-DD HH:mm:ss'
);
}
}
return
result
;
});
}
/**
...
...
Please
register
or
login
to post a comment