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
4c78d434
Commit
4c78d434
authored
Jun 11, 2019
by
李尚科
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
gjj product fix
parent
a2a0b8c0
Pipeline
#8686
passed with stage
in 13 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
62 additions
and
3 deletions
+62
-3
product.js
app/controller/gjj/product.js
+8
-2
product.js
app/service/gjj/product.js
+54
-1
No files found.
app/controller/gjj/product.js
View file @
4c78d434
...
...
@@ -8,12 +8,18 @@ class ProductController extends Controller {
const
{
ctx
}
=
this
;
const
type
=
ctx
.
params
.
type
||
'credit'
;
let
suit_options
;
if
(
type
==
'loan'
){
suit_options
=
await
ctx
.
service
.
gjj
.
product
.
getLoanChannelSuitOptions
();
}
const
keys
=
ctx
.
query
.
keys
?
eval
(
ctx
.
query
.
keys
)
:
[];
const
results
=
await
ctx
.
service
.
gjj
.
product
.
getRecommendOptions
(
type
,
keys
);
ctx
.
success
({
results
});
if
(
suit_options
){
results
.
unshift
(
suit_options
);
}
const
credit_loans
=
await
ctx
.
service
.
gjj
.
product
.
getAllProductsByType
(
1
);
const
common_loans
=
await
ctx
.
service
.
gjj
.
product
.
getAllProductsByType
(
4
);
ctx
.
success
({
results
:
results
,
credit_loans
:
credit_loans
,
common_loans
:
common_loans
});
}
}
module
.
exports
=
ProductController
;
app/service/gjj/product.js
View file @
4c78d434
...
...
@@ -71,10 +71,63 @@ class ProductService extends Service {
const
{
ctx
}
=
this
;
const
user_id
=
ctx
.
userId
;
if
(
user_id
)
{
const
app_user_id
=
ctx
.
appUserId
;
const
credit_loans
=
await
this
.
getAllProductsByType
(
1
);
const
common_loans
=
await
this
.
getAllProductsByType
(
4
);
const
credit_loans_ids
=
R
.
pluck
(
'business_id'
,
credit_loans
);
const
common_loans_ids
=
R
.
pluck
(
'business_id'
,
common_loans
);
const
default_options
=
{
id
:
-
1
,
key
:
'loan_all'
,
title
:
'全部'
,
description
:
'全部'
,
_children
:
[],
}
let
children
=
[{
id
:
-
2
,
title
:
'全部'
,
quality
:
credit_loans_ids
,
normal
:
common_loans_ids
,
}];
if
(
user_id
&&
app_user_id
)
{
children
.
push
({
id
:
-
3
,
title
:
'最适合您的'
,
quality
:
[
7
,
8
,
29
],
//TODO
normal
:
[],
});
}
else
{
children
.
push
({
id
:
-
4
,
title
:
'51公积金贷'
,
quality
:
credit_loans_ids
,
normal
:
[],
});
children
.
push
({
id
:
-
5
,
title
:
'普通贷'
,
quality
:
[],
normal
:
common_loans_ids
,
});
}
default_options
.
_children
=
children
;
return
default_options
;
}
//1 授信贷;2 信用卡;3 普通信用卡;4 普通贷款
async
getAllProductsByType
(
type
,
elements
=
[])
{
const
{
ctx
}
=
this
;
const
url
=
this
.
config
.
NODE_BASE_URL
+
'/cassandra-server/bu_basic/list?type='
+
type
;
let
products_results
=
await
ctx
.
helper
.
send_request
(
url
,
{},
{
method
:
'GET'
});
ctx
.
logger
.
info
(
JSON
.
stringify
({
url
:
url
,
products_results
:
products_results
}));
let
products
=
[];
if
(
products_results
.
status
!==
200
||
!
products_results
.
data
||
!
products_results
.
data
.
ret
)
{
return
products
;
}
products
=
products_results
.
data
.
ret
;
if
(
elements
&&
elements
.
length
!==
0
)
{
products
=
R
.
project
(
elements
)(
products
);
}
return
products
;
}
}
...
...
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