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
589d067a
Commit
589d067a
authored
Sep 06, 2019
by
李尚科
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add order
parent
131655bb
Pipeline
#13456
passed with stage
in 4 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
89 additions
and
0 deletions
+89
-0
order.js
app/controller/credit/order.js
+33
-0
order.js
app/service/credit/order.js
+56
-0
No files found.
app/controller/credit/order.js
0 → 100644
View file @
589d067a
'use strict'
;
const
Controller
=
require
(
'egg'
).
Controller
;
class
OrderController
extends
Controller
{
/**
* 我的信用首页
*/
async
getMyCredit
()
{
const
{
ctx
}
=
this
;
ctx
.
success
(
ret
);
}
//我的历史首页
async
getRecord
()
{
const
{
ctx
}
=
this
;
const
type
=
ctx
.
params
.
type
;
const
results
=
await
ctx
.
service
.
credit
.
order
.
getHistoryOrders
(
type
);
ctx
.
success
({
results
});
}
}
module
.
exports
=
OrderController
;
app/service/credit/order.js
0 → 100644
View file @
589d067a
'use strict'
;
const
Service
=
require
(
'egg'
).
Service
;
const
moment
=
require
(
'moment'
);
const
_
=
require
(
'lodash'
);
class
OrderService
extends
Service
{
//历史订单
async
getHistoryOrders
(
order_type
)
{
const
{
ctx
}
=
this
;
const
type_obj
=
{
'blacklist'
:
1
,
'callrisk'
:
2
,
}
const
type
=
type_obj
[
order_type
];
const
order_records
=
await
ctx
.
prometheusModel
.
CreditOrder
.
all
({
where
:
{
type
}
});
const
worth_h
=
[];
const
worth_l
=
[];
const
worth_time
=
type
===
1
?
15
:
30
;
const
now_time
=
moment
().
format
(
'X'
);
for
(
let
i
in
order_records
)
{
const
order
=
order_records
[
i
];
const
expire_time
=
moment
(
state_time
).
format
(
'X'
)
+
worth_time
*
86400
;
const
apply
=
{
phone
:
'15968762898'
,
report_no
:
'51gjj201909050100001'
};
const
item
=
{
order_no
:
order
.
order_no
,
report_no
:
apply
.
report_no
,
type
:
order_type
,
created_time
,
phone
:
apply
.
phone
.
replace
(
apply
.
phone
.
substring
(
3
,
7
),
"****"
),
state
:
order
.
state
,
state_text
:
order
.
state
===
'已支付'
?
''
:
order
.
state
,
};
if
(
order
.
pay_status
===
1
&&
order
.
state
===
'已支付'
&&
expire_time
>
now_time
)
{
worth_h
.
push
(
item
);
}
else
{
worth_l
.
push
(
item
);
}
}
return
{
worth_h
,
worth_l
}
}
}
module
.
exports
=
OrderService
;
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