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
68e33aa7
Commit
68e33aa7
authored
Jul 29, 2019
by
任国军
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add loan sort
parent
7cd7f1b4
Pipeline
#11634
passed with stage
in 20 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
7 deletions
+14
-7
product.js
app/service/gjj/product.js
+13
-6
config.local.js
config/config.local.js
+1
-1
No files found.
app/service/gjj/product.js
View file @
68e33aa7
...
@@ -69,12 +69,14 @@ class ProductService extends Service {
...
@@ -69,12 +69,14 @@ class ProductService extends Service {
//
//
async
getLoanChannelSuitOptions
()
{
async
getLoanChannelSuitOptions
()
{
const
{
ctx
}
=
this
;
const
{
ctx
}
=
this
;
const
user_id
=
ctx
.
userId
;
const
user_id
=
ctx
.
userId
;
const
app_user_id
=
ctx
.
appUserId
;
const
app_user_id
=
ctx
.
appUserId
;
const
credit_loans
=
await
this
.
getAllProductsByType
(
1
);
const
recommendSort
=
function
(
a
,
b
)
{
const
common_loans
=
await
this
.
getAllProductsByType
(
4
);
return
a
.
recommend_sorter
-
b
.
recommend_sorter
;
};
const
credit_loans
=
R
.
sort
(
recommendSort
)(
await
this
.
getAllProductsByType
(
1
));
const
common_loans
=
R
.
sort
(
recommendSort
)(
await
this
.
getAllProductsByType
(
4
));
const
credit_loans_ids
=
R
.
pluck
(
'business_id'
,
credit_loans
);
const
credit_loans_ids
=
R
.
pluck
(
'business_id'
,
credit_loans
);
const
common_loans_ids
=
R
.
pluck
(
'business_id'
,
common_loans
);
const
common_loans_ids
=
R
.
pluck
(
'business_id'
,
common_loans
);
const
default_options
=
{
const
default_options
=
{
...
@@ -213,7 +215,7 @@ class ProductService extends Service {
...
@@ -213,7 +215,7 @@ class ProductService extends Service {
// 获取推荐列表,按照ABC分组顺序推荐
// 获取推荐列表,按照ABC分组顺序推荐
async
getBusinessRecommendList
(
limit
,
location
=
'list'
)
{
async
getBusinessRecommendList
(
limit
,
location
=
'list'
)
{
const
{
ctx
,
service
}
=
this
;
const
{
ctx
}
=
this
;
const
userId
=
ctx
.
userId
;
const
userId
=
ctx
.
userId
;
const
R
=
require
(
'ramda'
);
const
R
=
require
(
'ramda'
);
const
recommendSort
=
function
(
a
,
b
)
{
const
recommendSort
=
function
(
a
,
b
)
{
...
@@ -247,11 +249,13 @@ class ProductService extends Service {
...
@@ -247,11 +249,13 @@ class ProductService extends Service {
// 获取开关状态,判断是自动推荐or手动推荐orABTest
// 获取开关状态,判断是自动推荐or手动推荐orABTest
const
keyword
=
location
===
'list'
?
'config_list_smart_recommend'
:
'config_loan_smart_recommend'
;
const
keyword
=
location
===
'list'
?
'config_list_smart_recommend'
:
'config_loan_smart_recommend'
;
const
ruleSetting
=
await
this
.
app
.
huodongModel
.
Setting
.
findOne
({
where
:
{
keyword
}
});
const
ruleSetting
=
await
this
.
app
.
huodongModel
.
Setting
.
findOne
({
where
:
{
keyword
}
});
cons
t
rule
=
Number
(
ruleSetting
.
value
);
le
t
rule
=
Number
(
ruleSetting
.
value
);
console
.
log
(
'rule: '
+
String
(
rule
));
console
.
log
(
'rule: '
+
String
(
rule
));
rule
=
3
;
// 是否需要计算模型
// 是否需要计算模型
let
isNeedCalc
=
false
;
let
isNeedCalc
=
false
;
let
userInfo
=
{};
let
userInfo
=
{};
let
userResult
=
{};
switch
(
rule
)
{
switch
(
rule
)
{
case
1
:
case
1
:
isNeedCalc
=
true
;
isNeedCalc
=
true
;
...
@@ -270,7 +274,10 @@ class ProductService extends Service {
...
@@ -270,7 +274,10 @@ class ProductService extends Service {
// 获取不到手机号则默认使用手动推荐
// 获取不到手机号则默认使用手动推荐
isNeedCalc
=
false
;
isNeedCalc
=
false
;
// 获取用户手机号,根据手机号末尾判断是否自动推荐
// 获取用户手机号,根据手机号末尾判断是否自动推荐
userInfo
=
await
service
.
user
.
get_user
(
ctx
.
appUserId
);
userResult
=
await
ctx
.
helper
.
send_request
(
this
.
config
.
USER_CENTER_API_URI
+
'/v1/appusers/'
+
ctx
.
appUserId
,
{},
{
method
:
'GET'
,
});
userInfo
=
userResult
.
status
===
200
?
userResult
.
data
:
{};
if
(
!
ctx
.
isEmpty
(
userInfo
)
&&
!
ctx
.
isEmpty
(
userInfo
.
user
)
&&
!
ctx
.
isEmpty
(
userInfo
.
user
.
phone
)
&&
(
Number
(
userInfo
.
user
.
phone
)
%
2
===
0
))
{
if
(
!
ctx
.
isEmpty
(
userInfo
)
&&
!
ctx
.
isEmpty
(
userInfo
.
user
)
&&
!
ctx
.
isEmpty
(
userInfo
.
user
.
phone
)
&&
(
Number
(
userInfo
.
user
.
phone
)
%
2
===
0
))
{
isNeedCalc
=
true
;
isNeedCalc
=
true
;
}
else
{
}
else
{
...
...
config/config.local.js
View file @
68e33aa7
...
@@ -50,7 +50,7 @@ module.exports = appInfo => {
...
@@ -50,7 +50,7 @@ module.exports = appInfo => {
// other sequelize configurations
// other sequelize configurations
dialect
:
'mysql'
,
dialect
:
'mysql'
,
host
:
'rm-bp1mnwmta5778y0d3jo.mysql.rds.aliyuncs.com'
,
host
:
'rm-bp1mnwmta5778y0d3jo.mysql.rds.aliyuncs.com'
,
database
:
'poseidon_
dev
'
,
database
:
'poseidon_
uat
'
,
username
:
'kf_liuhaihua'
,
username
:
'kf_liuhaihua'
,
password
:
'24u1GaFh96khR31T7zs2y'
,
password
:
'24u1GaFh96khR31T7zs2y'
,
port
:
3306
,
port
:
3306
,
...
...
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