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
b2e90804
Commit
b2e90804
authored
Jul 26, 2022
by
谢永靖
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
#18188 子任务 后台 运营管理/频道管理/贷款列表配置
parent
6e28c3ad
Pipeline
#38663
passed with stage
in 9 seconds
Changes
3
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
130 additions
and
1 deletion
+130
-1
product.js
app/controller/gjj/product.js
+34
-1
product.js
app/router/product.js
+2
-0
productNew.js
app/service/gjj/productNew.js
+94
-0
No files found.
app/controller/gjj/product.js
View file @
b2e90804
...
...
@@ -34,10 +34,43 @@ class ProductController extends Controller {
ctx
.
success
({
results
,
credit_loans
,
common_loans
,
common_credits
,
credit_cards
});
}
async
getOptionProductsNew
()
{
const
{
ctx
}
=
this
;
const
type
=
ctx
.
params
.
type
||
'credit'
;
const
keys
=
ctx
.
query
.
keys
?
ctx
.
query
.
keys
.
split
(
','
)
:
[];
const
results
=
await
ctx
.
service
.
gjj
.
product
.
getRecommendOptions
(
type
,
keys
);
let
suit_options
;
let
credit_loans
=
[];
let
common_loans
=
[];
let
common_credits
=
[];
let
credit_cards
=
[];
let
result_loans
=
[];
if
(
type
===
'loan'
)
{
suit_options
=
await
ctx
.
service
.
gjj
.
productNew
.
getLoanChannelSuitOptions
();
if
(
suit_options
)
{
results
.
unshift
(
suit_options
);
}
credit_loans
=
await
ctx
.
service
.
gjj
.
product
.
getAllProductsByType
(
1
);
credit_loans
=
ctx
.
service
.
gjj
.
product
.
getLoanList
(
credit_loans
);
common_loans
=
await
ctx
.
service
.
gjj
.
product
.
getAllProductsByType
(
4
);
common_loans
=
ctx
.
service
.
gjj
.
product
.
getLoanList
(
common_loans
);
result_loans
=
credit_loans
.
concat
(
credit_loans
,
common_loans
);
}
else
{
credit_cards
=
await
ctx
.
service
.
gjj
.
product
.
getAllProductsByType
(
2
);
common_credits
=
await
ctx
.
service
.
gjj
.
product
.
getAllProductsByType
(
3
);
result_loans
=
credit_loans
.
concat
(
credit_cards
,
common_credits
);
}
ctx
.
success
({
results
,
result_loans
});
}
// 贷款频道首页热门推荐
async
getLoanHomeRecommendList
()
{
const
{
ctx
}
=
this
;
const
ret
=
await
ctx
.
service
.
gjj
.
product
.
getLoanHomeList
();
const
ret
=
await
ctx
.
service
.
gjj
.
product
New
.
getLoanHomeList
();
ctx
.
success
({
results
:
ret
,
count
:
ret
.
length
});
}
...
...
app/router/product.js
View file @
b2e90804
...
...
@@ -6,5 +6,7 @@ module.exports = app => {
router
.
get
(
'/recommend/channel/options/:type'
,
'gjj.product.getOptionProducts'
);
// 筛选项
router
.
get
(
'/recommend/channel/home'
,
'gjj.product.getLoanHomeRecommendList'
);
// 贷款频道首页
// #18188 新版贷款列表 按配置排序
router
.
get
(
'/recommend_new/channel/options/:type'
,
'gjj.product.getOptionProductsNew'
);
};
app/service/gjj/productNew.js
0 → 100644
View file @
b2e90804
'use strict'
;
const
Service
=
require
(
'egg'
).
Service
;
const
R
=
require
(
'ramda'
);
class
ProductNewService
extends
Service
{
//
async
getLoanChannelSuitOptions
()
{
const
{
ctx
}
=
this
;
const
user_id
=
ctx
.
userId
;
const
app_user_id
=
ctx
.
appUserId
;
const
recommendSort
=
function
(
a
,
b
)
{
if
(
a
.
recommend_sorter
===
b
.
recommend_sorter
)
{
return
b
.
business_id
-
a
.
business_id
;
}
return
a
.
recommend_sorter
-
b
.
recommend_sorter
;
};
const
credit_loans
=
await
ctx
.
service
.
gjj
.
product
.
getAllProductsByType
(
1
);
const
common_loans
=
await
ctx
.
service
.
gjj
.
product
.
getAllProductsByType
(
4
);
const
result_loans
=
R
.
sort
(
recommendSort
)(
credit_loans
.
concat
(
common_loans
));
const
credit_loans_ids
=
R
.
pluck
(
'business_id'
,
credit_loans
);
const
common_loans_ids
=
R
.
pluck
(
'business_id'
,
common_loans
);
const
result_loans_ids
=
R
.
pluck
(
'business_id'
,
result_loans
);
const
default_options
=
{
id
:
-
1
,
key
:
'loan_all'
,
title
:
'全部'
,
description
:
'全部'
,
_children
:
[],
};
const
children
=
[
{
id
:
-
2
,
title
:
'全部'
,
quality
:
result_loans_ids
,
},
];
if
(
app_user_id
)
{
const
userGjj
=
await
ctx
.
helper
.
send_request
(
this
.
config
.
NODE_BASE_URL
+
'/cassandra-server/gjj/list/'
+
user_id
,
{},
{
method
:
'GET'
}
);
if
(
userGjj
.
status
===
200
&&
!
ctx
.
isEmpty
(
userGjj
.
data
.
ret
))
{
children
.
push
({
id
:
-
3
,
title
:
'最适合您的'
,
quality
:
await
ctx
.
service
.
gjj
.
product
.
getSuitLoans
(),
});
}
else
{
children
.
push
({
id
:
-
4
,
title
:
'51公积金贷'
,
quality
:
credit_loans_ids
.
concat
(
common_loans_ids
),
});
children
.
push
({
id
:
-
5
,
title
:
'普通贷'
,
quality
:
common_loans_ids
,
});
}
}
else
{
children
.
push
({
id
:
-
4
,
title
:
'51公积金贷'
,
quality
:
credit_loans_ids
.
concat
(
common_loans_ids
),
});
children
.
push
({
id
:
-
5
,
title
:
'普通贷'
,
quality
:
common_loans_ids
,
});
}
default_options
.
_children
=
children
;
return
default_options
;
}
// 贷款频道首页热门推荐
async
getLoanHomeList
()
{
const
{
ctx
}
=
this
;
const
recommendSort
=
function
(
a
,
b
)
{
if
(
a
.
recommend_sorter
===
b
.
recommend_sorter
)
{
return
b
.
business_id
-
a
.
business_id
;
}
return
a
.
recommend_sorter
-
b
.
recommend_sorter
;
};
const
credit_loans
=
await
ctx
.
service
.
gjj
.
product
.
getAllProductsByType
(
1
);
const
common_loans
=
await
ctx
.
service
.
gjj
.
product
.
getAllProductsByType
(
4
);
const
ret
=
R
.
take
(
6
)(
R
.
sort
(
recommendSort
)(
credit_loans
.
concat
(
common_loans
)));
return
ret
;
}
}
module
.
exports
=
ProductNewService
;
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