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
caf63a04
Commit
caf63a04
authored
Mar 02, 2022
by
谢永靖
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1
parent
deb341bb
Pipeline
#36070
passed with stage
in 4 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
145 additions
and
139 deletions
+145
-139
product.js
app/service/gjj/product.js
+145
-139
No files found.
app/service/gjj/product.js
View file @
caf63a04
"use strict"
;
'use strict'
;
const
Service
=
require
(
"egg"
).
Service
;
const
Service
=
require
(
'egg'
).
Service
;
const
R
=
require
(
"ramda"
);
const
R
=
require
(
'ramda'
);
const
moment
=
require
(
"moment"
);
const
moment
=
require
(
'moment'
);
class
ProductService
extends
Service
{
class
ProductService
extends
Service
{
// 通过 type=loan/credit 频道 option_ids 筛选项数组 all_product_ids
// 通过 type=loan/credit 频道 option_ids 筛选项数组 all_product_ids
// async getProductsByOptions(option_ids, all_product_ids = []) {
// async getProductsByOptions(option_ids, all_product_ids = []) {
...
@@ -26,29 +26,29 @@ class ProductService extends Service {
...
@@ -26,29 +26,29 @@ class ProductService extends Service {
// 获取筛选项列表 带 product_id
// 获取筛选项列表 带 product_id
// return : [{"id":3,"title":"银行分类","description":"信用卡银行分类","_children":[{"id":12,"title":"招商银行","quality":["1"],"normal":["1"]},{"id":16,"title":"广发银行","quality":[],"normal":[]}]},{"id":4,"title":"主题分类","description":"信用卡主题分类","_children":[]},{"id":5,"title":"信用卡筛选项","description":"信用卡筛选项","_children":[]}]
// return : [{"id":3,"title":"银行分类","description":"信用卡银行分类","_children":[{"id":12,"title":"招商银行","quality":["1"],"normal":["1"]},{"id":16,"title":"广发银行","quality":[],"normal":[]}]},{"id":4,"title":"主题分类","description":"信用卡主题分类","_children":[]},{"id":5,"title":"信用卡筛选项","description":"信用卡筛选项","_children":[]}]
async
getRecommendOptions
(
type
=
"credit"
,
keys
=
[])
{
async
getRecommendOptions
(
type
=
'credit'
,
keys
=
[])
{
const
{
ctx
}
=
this
;
const
{
ctx
}
=
this
;
// const type = 'credit';
// const type = 'credit';
// keys = ['loan_organization', 'loan_filter', 'credit_bank', 'credit_theme', 'credit_filter'];
// keys = ['loan_organization', 'loan_filter', 'credit_bank', 'credit_theme', 'credit_filter'];
// console.info(keys);
// console.info(keys);
let
classifies
=
await
ctx
.
blockModel
.
RecommendChannelClassify
.
findAll
({
let
classifies
=
await
ctx
.
blockModel
.
RecommendChannelClassify
.
findAll
({
where
:
{
type
,
valid
:
1
,
key
:
{
$in
:
keys
}
},
where
:
{
type
,
valid
:
1
,
key
:
{
$in
:
keys
}
},
order
:
[[
"sort"
,
"asc"
]],
order
:
[[
'sort'
,
'asc'
]],
});
});
// return classifies;
// return classifies;
classifies
=
R
.
project
([
"id"
,
"key"
,
"title"
,
"description"
])(
classifies
);
classifies
=
R
.
project
([
'id'
,
'key'
,
'title'
,
'description'
])(
classifies
);
const
classify_ids
=
R
.
pluck
(
"id"
,
classifies
);
const
classify_ids
=
R
.
pluck
(
'id'
,
classifies
);
let
options
=
await
ctx
.
blockModel
.
RecommendChannelOption
.
all
({
let
options
=
await
ctx
.
blockModel
.
RecommendChannelOption
.
all
({
where
:
{
classify_id
:
{
$in
:
classify_ids
},
status
:
"online"
,
valid
:
1
},
where
:
{
classify_id
:
{
$in
:
classify_ids
},
status
:
'online'
,
valid
:
1
},
order
:
[[
"order"
,
"asc"
]],
order
:
[[
'order'
,
'asc'
]],
});
});
options
=
R
.
project
([
"id"
,
"title"
,
"classify_id"
])(
options
);
options
=
R
.
project
([
'id'
,
'title'
,
'classify_id'
])(
options
);
const
option_ids
=
R
.
pluck
(
"id"
,
options
);
const
option_ids
=
R
.
pluck
(
'id'
,
options
);
let
option_products
=
await
ctx
.
blockModel
.
RecommendChannelProduct
.
all
({
let
option_products
=
await
ctx
.
blockModel
.
RecommendChannelProduct
.
all
({
where
:
{
option_id
:
{
$in
:
option_ids
},
valid
:
1
},
where
:
{
option_id
:
{
$in
:
option_ids
},
valid
:
1
},
order
:
[[
"order"
,
"asc"
]],
order
:
[[
'order'
,
'asc'
]],
});
});
option_products
=
R
.
project
([
"option_id"
,
"product_id"
,
"type"
])(
option_products
=
R
.
project
([
'option_id'
,
'product_id'
,
'type'
])(
option_products
option_products
);
);
const
ret
=
[];
const
ret
=
[];
...
@@ -56,24 +56,24 @@ class ProductService extends Service {
...
@@ -56,24 +56,24 @@ class ProductService extends Service {
const
classify
=
classifies
[
i
];
const
classify
=
classifies
[
i
];
const
classify_id
=
classify
.
id
;
const
classify_id
=
classify
.
id
;
let
temp_options
=
options
.
filter
(
let
temp_options
=
options
.
filter
(
(
option
)
=>
parseInt
(
option
.
classify_id
)
===
parseInt
(
classify_id
)
option
=>
parseInt
(
option
.
classify_id
)
===
parseInt
(
classify_id
)
);
);
temp_options
=
R
.
project
([
"id"
,
"title"
])(
temp_options
);
temp_options
=
R
.
project
([
'id'
,
'title'
])(
temp_options
);
for
(
const
j
in
temp_options
)
{
for
(
const
j
in
temp_options
)
{
const
temp_option
=
temp_options
[
j
];
const
temp_option
=
temp_options
[
j
];
const
temp_option_id
=
temp_option
.
id
;
const
temp_option_id
=
temp_option
.
id
;
let
temp_option_products
=
option_products
.
filter
(
let
temp_option_products
=
option_products
.
filter
(
(
v
)
=>
parseInt
(
v
.
option_id
)
===
parseInt
(
temp_option_id
)
v
=>
parseInt
(
v
.
option_id
)
===
parseInt
(
temp_option_id
)
);
);
temp_option_products
=
R
.
groupBy
(
(
v
)
=>
{
temp_option_products
=
R
.
groupBy
(
v
=>
{
return
v
.
type
===
"quality"
?
"quality"
:
"normal"
;
return
v
.
type
===
'quality'
?
'quality'
:
'normal'
;
})(
temp_option_products
);
})(
temp_option_products
);
const
quality_product_ids
=
R
.
pluck
(
const
quality_product_ids
=
R
.
pluck
(
"product_id"
,
'product_id'
,
temp_option_products
.
quality
?
temp_option_products
.
quality
:
[]
temp_option_products
.
quality
?
temp_option_products
.
quality
:
[]
);
);
const
normal_product_ids
=
R
.
pluck
(
const
normal_product_ids
=
R
.
pluck
(
"product_id"
,
'product_id'
,
temp_option_products
.
normal
?
temp_option_products
.
normal
:
[]
temp_option_products
.
normal
?
temp_option_products
.
normal
:
[]
);
);
temp_options
[
j
].
quality
=
quality_product_ids
;
temp_options
[
j
].
quality
=
quality_product_ids
;
...
@@ -94,46 +94,46 @@ class ProductService extends Service {
...
@@ -94,46 +94,46 @@ class ProductService extends Service {
const
app_user_id
=
ctx
.
appUserId
;
const
app_user_id
=
ctx
.
appUserId
;
const
credit_loans
=
await
this
.
getAllProductsByType
(
1
);
const
credit_loans
=
await
this
.
getAllProductsByType
(
1
);
const
common_loans
=
await
this
.
getAllProductsByType
(
4
);
const
common_loans
=
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
=
{
id
:
-
1
,
id
:
-
1
,
key
:
"loan_all"
,
key
:
'loan_all'
,
title
:
"全部"
,
title
:
'全部'
,
description
:
"全部"
,
description
:
'全部'
,
_children
:
[],
_children
:
[],
};
};
const
children
=
[
const
children
=
[
{
{
id
:
-
2
,
id
:
-
2
,
title
:
"全部"
,
title
:
'全部'
,
quality
:
credit_loans_ids
,
quality
:
credit_loans_ids
,
normal
:
common_loans_ids
,
normal
:
common_loans_ids
,
},
},
];
];
if
(
app_user_id
)
{
if
(
app_user_id
)
{
const
userGjj
=
await
ctx
.
helper
.
send_request
(
const
userGjj
=
await
ctx
.
helper
.
send_request
(
this
.
config
.
NODE_BASE_URL
+
"/cassandra-server/gjj/list/"
+
user_id
,
this
.
config
.
NODE_BASE_URL
+
'/cassandra-server/gjj/list/'
+
user_id
,
{},
{},
{
method
:
"GET"
}
{
method
:
'GET'
}
);
);
if
(
userGjj
.
status
===
200
&&
!
ctx
.
isEmpty
(
userGjj
.
data
.
ret
))
{
if
(
userGjj
.
status
===
200
&&
!
ctx
.
isEmpty
(
userGjj
.
data
.
ret
))
{
children
.
push
({
children
.
push
({
id
:
-
3
,
id
:
-
3
,
title
:
"最适合您的"
,
title
:
'最适合您的'
,
quality
:
await
this
.
getSuitLoans
(),
quality
:
await
this
.
getSuitLoans
(),
normal
:
[],
normal
:
[],
});
});
}
else
{
}
else
{
children
.
push
({
children
.
push
({
id
:
-
4
,
id
:
-
4
,
title
:
"51公积金贷"
,
title
:
'51公积金贷'
,
quality
:
credit_loans_ids
,
quality
:
credit_loans_ids
,
normal
:
common_loans_ids
,
normal
:
common_loans_ids
,
});
});
children
.
push
({
children
.
push
({
id
:
-
5
,
id
:
-
5
,
title
:
"普通贷"
,
title
:
'普通贷'
,
quality
:
[],
quality
:
[],
normal
:
common_loans_ids
,
normal
:
common_loans_ids
,
});
});
...
@@ -141,13 +141,13 @@ class ProductService extends Service {
...
@@ -141,13 +141,13 @@ class ProductService extends Service {
}
else
{
}
else
{
children
.
push
({
children
.
push
({
id
:
-
4
,
id
:
-
4
,
title
:
"51公积金贷"
,
title
:
'51公积金贷'
,
quality
:
credit_loans_ids
,
quality
:
credit_loans_ids
,
normal
:
common_loans_ids
,
normal
:
common_loans_ids
,
});
});
children
.
push
({
children
.
push
({
id
:
-
5
,
id
:
-
5
,
title
:
"普通贷"
,
title
:
'普通贷'
,
quality
:
[],
quality
:
[],
normal
:
common_loans_ids
,
normal
:
common_loans_ids
,
});
});
...
@@ -160,12 +160,12 @@ class ProductService extends Service {
...
@@ -160,12 +160,12 @@ class ProductService extends Service {
// 1 授信贷;2 信用卡;3 普通信用卡;4 普通贷款
// 1 授信贷;2 信用卡;3 普通信用卡;4 普通贷款
async
getAllProductsByType
(
type
)
{
async
getAllProductsByType
(
type
)
{
const
{
ctx
}
=
this
;
const
{
ctx
}
=
this
;
const
url
=
this
.
config
.
NODE_BASE_URL
+
"/cassandra-server/bu_basic/list"
;
const
url
=
this
.
config
.
NODE_BASE_URL
+
'/cassandra-server/bu_basic/list'
;
const
products_results
=
await
ctx
.
helper
.
send_request
(
const
products_results
=
await
ctx
.
helper
.
send_request
(
url
,
url
,
{
type
,
app_id
:
ctx
.
appId
},
{
type
,
app_id
:
ctx
.
appId
},
{
method
:
"GET"
}
{
method
:
'GET'
}
);
);
// ctx.logger.info(JSON.stringify({ url, products_results }));
// ctx.logger.info(JSON.stringify({ url, products_results }));
let
products
=
[];
let
products
=
[];
...
@@ -178,7 +178,7 @@ class ProductService extends Service {
...
@@ -178,7 +178,7 @@ class ProductService extends Service {
}
}
products
=
products_results
.
data
.
ret
;
products
=
products_results
.
data
.
ret
;
const
sort
=
function
(
a
,
b
)
{
const
sort
=
function
(
a
,
b
)
{
if
(
a
.
recommend_sorter
===
b
.
recommend_sorter
)
{
if
(
a
.
recommend_sorter
===
b
.
recommend_sorter
)
{
return
b
.
business_id
-
a
.
business_id
;
return
b
.
business_id
-
a
.
business_id
;
}
}
...
@@ -193,13 +193,13 @@ class ProductService extends Service {
...
@@ -193,13 +193,13 @@ class ProductService extends Service {
// 最适合您的(推荐)贷款
// 最适合您的(推荐)贷款
async
getSuitLoans
()
{
async
getSuitLoans
()
{
const
results
=
await
this
.
getBusinessRecommendList
(
9999
);
const
results
=
await
this
.
getBusinessRecommendList
(
9999
);
const
ret
=
R
.
pluck
(
"business_id"
,
results
);
const
ret
=
R
.
pluck
(
'business_id'
,
results
);
return
ret
;
return
ret
;
}
}
// 贷款频道首页热门推荐
// 贷款频道首页热门推荐
async
getLoanHomeList
()
{
async
getLoanHomeList
()
{
let
ret
=
await
this
.
getBusinessRecommendList
(
6
,
"home"
);
let
ret
=
await
this
.
getBusinessRecommendList
(
6
,
'home'
);
if
(
ret
.
length
<
6
)
{
if
(
ret
.
length
<
6
)
{
const
creditLoan
=
R
.
take
(
6
-
ret
.
length
)(
const
creditLoan
=
R
.
take
(
6
-
ret
.
length
)(
await
this
.
getAllProductsByType
(
4
)
await
this
.
getAllProductsByType
(
4
)
...
@@ -216,11 +216,11 @@ class ProductService extends Service {
...
@@ -216,11 +216,11 @@ class ProductService extends Service {
const
appUserId
=
ctx
.
appUserId
;
const
appUserId
=
ctx
.
appUserId
;
const
url
=
const
url
=
ctx
.
app
.
config
.
NODE_BASE_URL
+
ctx
.
app
.
config
.
NODE_BASE_URL
+
"/cassandra-server/loan_list/bu_class/list"
;
'/cassandra-server/loan_list/bu_class/list'
;
const
param
=
{
uid
:
userId
,
app_uid
:
appUserId
,
app_id
:
ctx
.
appId
};
const
param
=
{
uid
:
userId
,
app_uid
:
appUserId
,
app_id
:
ctx
.
appId
};
const
resp
=
await
ctx
.
helper
.
send_request
(
url
,
param
,
{
method
:
"GET"
});
const
resp
=
await
ctx
.
helper
.
send_request
(
url
,
param
,
{
method
:
'GET'
});
if
(
resp
.
status
!==
200
)
{
if
(
resp
.
status
!==
200
)
{
ctx
.
failed
(
"[bu_class]内部接口错误"
);
ctx
.
failed
(
'[bu_class]内部接口错误'
);
}
}
return
resp
.
data
.
ret
;
return
resp
.
data
.
ret
;
}
}
...
@@ -232,7 +232,7 @@ class ProductService extends Service {
...
@@ -232,7 +232,7 @@ class ProductService extends Service {
const
appUserId
=
ctx
.
appUserId
;
const
appUserId
=
ctx
.
appUserId
;
const
url
=
const
url
=
ctx
.
app
.
config
.
NODE_BASE_URL
+
ctx
.
app
.
config
.
NODE_BASE_URL
+
"/cassandra-server/loan_list/recommend_sort/list"
;
'/cassandra-server/loan_list/recommend_sort/list'
;
const
param
=
{
const
param
=
{
uid
:
userId
,
uid
:
userId
,
app_uid
:
appUserId
,
app_uid
:
appUserId
,
...
@@ -244,9 +244,9 @@ class ProductService extends Service {
...
@@ -244,9 +244,9 @@ class ProductService extends Service {
return
[];
return
[];
}
}
const
resp
=
await
ctx
.
helper
.
send_request
(
url
,
param
,
{
method
:
"POST"
});
const
resp
=
await
ctx
.
helper
.
send_request
(
url
,
param
,
{
method
:
'POST'
});
if
(
resp
.
status
!==
201
)
{
if
(
resp
.
status
!==
201
)
{
ctx
.
failed
(
"[recommend_sort]内部接口错误"
);
ctx
.
failed
(
'[recommend_sort]内部接口错误'
);
}
}
return
resp
.
data
.
ret
;
return
resp
.
data
.
ret
;
...
@@ -259,11 +259,11 @@ class ProductService extends Service {
...
@@ -259,11 +259,11 @@ class ProductService extends Service {
}
}
// 获取推荐列表,按照ABC分组顺序推荐
// 获取推荐列表,按照ABC分组顺序推荐
async
getBusinessRecommendList
(
limit
,
location
=
"list"
)
{
async
getBusinessRecommendList
(
limit
,
location
=
'list'
)
{
const
{
ctx
}
=
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
)
{
if
(
a
.
recommend_sorter
===
b
.
recommend_sorter
)
{
if
(
a
.
recommend_sorter
===
b
.
recommend_sorter
)
{
return
b
.
business_id
-
a
.
business_id
;
return
b
.
business_id
-
a
.
business_id
;
}
}
...
@@ -277,9 +277,9 @@ class ProductService extends Service {
...
@@ -277,9 +277,9 @@ class ProductService extends Service {
ret
=
R
.
take
(
limit
)(
loanList
);
ret
=
R
.
take
(
limit
)(
loanList
);
}
else
{
}
else
{
const
userGjj
=
await
ctx
.
helper
.
send_request
(
const
userGjj
=
await
ctx
.
helper
.
send_request
(
this
.
config
.
NODE_BASE_URL
+
"/cassandra-server/gjj/list/"
+
userId
,
this
.
config
.
NODE_BASE_URL
+
'/cassandra-server/gjj/list/'
+
userId
,
{},
{},
{
method
:
"GET"
}
{
method
:
'GET'
}
);
);
if
(
userGjj
.
status
!==
200
||
ctx
.
isEmpty
(
userGjj
.
data
.
ret
))
{
if
(
userGjj
.
status
!==
200
||
ctx
.
isEmpty
(
userGjj
.
data
.
ret
))
{
const
loanList
=
await
this
.
getAllProductsByType
(
1
);
const
loanList
=
await
this
.
getAllProductsByType
(
1
);
...
@@ -293,13 +293,13 @@ class ProductService extends Service {
...
@@ -293,13 +293,13 @@ class ProductService extends Service {
type
:
2
,
type
:
2
,
need_smart_recommend
:
0
,
need_smart_recommend
:
0
,
is_smart_recommend
:
0
,
is_smart_recommend
:
0
,
pass_rate_list
:
""
,
pass_rate_list
:
''
,
business_list
:
""
,
business_list
:
''
,
c_class_list
:
""
,
c_class_list
:
''
,
common_loan_list
:
""
,
common_loan_list
:
''
,
page_type
:
location
===
"list"
?
2
:
1
,
page_type
:
location
===
'list'
?
2
:
1
,
is_run_pass_rate
:
0
,
is_run_pass_rate
:
0
,
created_time
:
moment
().
format
(
"YYYY-MM-DD HH:mm:ss"
),
created_time
:
moment
().
format
(
'YYYY-MM-DD HH:mm:ss'
),
};
};
// 先获取分组
// 先获取分组
...
@@ -307,9 +307,9 @@ class ProductService extends Service {
...
@@ -307,9 +307,9 @@ class ProductService extends Service {
// 获取开关状态,判断是自动推荐or手动推荐orABTest
// 获取开关状态,判断是自动推荐or手动推荐orABTest
const
keyword
=
const
keyword
=
location
===
"list"
location
===
'list'
?
"config_list_smart_recommend"
?
'config_list_smart_recommend'
:
"config_loan_smart_recommend"
;
:
'config_loan_smart_recommend'
;
const
ruleSetting
=
await
this
.
app
.
huodongModel
.
Setting
.
findOne
({
const
ruleSetting
=
await
this
.
app
.
huodongModel
.
Setting
.
findOne
({
where
:
{
keyword
},
where
:
{
keyword
},
});
});
...
@@ -324,8 +324,8 @@ class ProductService extends Service {
...
@@ -324,8 +324,8 @@ class ProductService extends Service {
break
;
break
;
case
2
:
case
2
:
isNeedCalc
=
false
;
isNeedCalc
=
false
;
classList
.
class_C
=
R
.
map
(
function
(
e
)
{
classList
.
class_C
=
R
.
map
(
function
(
e
)
{
e
.
class
=
"C"
;
e
.
class
=
'C'
;
e
.
rule
=
rule
;
e
.
rule
=
rule
;
e
.
hasPassRate
=
0
;
e
.
hasPassRate
=
0
;
e
.
needCalc
=
0
;
e
.
needCalc
=
0
;
...
@@ -337,10 +337,10 @@ class ProductService extends Service {
...
@@ -337,10 +337,10 @@ class ProductService extends Service {
isNeedCalc
=
false
;
isNeedCalc
=
false
;
// 获取用户手机号,根据手机号末尾判断是否自动推荐
// 获取用户手机号,根据手机号末尾判断是否自动推荐
userResult
=
await
ctx
.
helper
.
send_request
(
userResult
=
await
ctx
.
helper
.
send_request
(
this
.
config
.
USER_CENTER_API_URI
+
"/v1/appusers/"
+
ctx
.
appUserId
,
this
.
config
.
USER_CENTER_API_URI
+
'/v1/appusers/'
+
ctx
.
appUserId
,
{},
{},
{
{
method
:
"GET"
,
method
:
'GET'
,
}
}
);
);
userInfo
=
userResult
.
status
===
200
?
userResult
.
data
:
{};
userInfo
=
userResult
.
status
===
200
?
userResult
.
data
:
{};
...
@@ -352,8 +352,8 @@ class ProductService extends Service {
...
@@ -352,8 +352,8 @@ class ProductService extends Service {
)
{
)
{
isNeedCalc
=
true
;
isNeedCalc
=
true
;
}
else
{
}
else
{
classList
.
class_C
=
R
.
map
(
function
(
e
)
{
classList
.
class_C
=
R
.
map
(
function
(
e
)
{
e
.
class
=
"C"
;
e
.
class
=
'C'
;
e
.
rule
=
rule
;
e
.
rule
=
rule
;
e
.
hasPassRate
=
0
;
e
.
hasPassRate
=
0
;
e
.
needCalc
=
0
;
e
.
needCalc
=
0
;
...
@@ -370,26 +370,26 @@ class ProductService extends Service {
...
@@ -370,26 +370,26 @@ class ProductService extends Service {
let
result
=
[];
let
result
=
[];
// 先取A
// 先取A
if
(
if
(
classList
.
hasOwnProperty
(
"class_A"
)
&&
classList
.
hasOwnProperty
(
'class_A'
)
&&
!
ctx
.
isEmpty
(
classList
.
class_A
)
!
ctx
.
isEmpty
(
classList
.
class_A
)
)
{
)
{
result
=
R
.
take
(
limit
)(
R
.
sort
(
recommendSort
)(
classList
.
class_A
));
result
=
R
.
take
(
limit
)(
R
.
sort
(
recommendSort
)(
classList
.
class_A
));
result
=
R
.
map
(
function
(
e
)
{
result
=
R
.
map
(
function
(
e
)
{
e
.
class
=
"A"
;
e
.
class
=
'A'
;
e
.
rule
=
2
;
e
.
rule
=
2
;
return
e
;
return
e
;
})(
result
);
})(
result
);
}
}
// 再取B
// 再取B
if
(
if
(
classList
.
hasOwnProperty
(
"class_B"
)
&&
classList
.
hasOwnProperty
(
'class_B'
)
&&
!
ctx
.
isEmpty
(
classList
.
class_B
)
!
ctx
.
isEmpty
(
classList
.
class_B
)
)
{
)
{
let
classB
=
R
.
take
(
limit
-
result
.
length
)(
let
classB
=
R
.
take
(
limit
-
result
.
length
)(
R
.
sort
(
recommendSort
)(
classList
.
class_B
)
R
.
sort
(
recommendSort
)(
classList
.
class_B
)
);
);
classB
=
R
.
map
(
function
(
e
)
{
classB
=
R
.
map
(
function
(
e
)
{
e
.
class
=
"B"
;
e
.
class
=
'B'
;
e
.
rule
=
2
;
e
.
rule
=
2
;
return
e
;
return
e
;
})(
classB
);
})(
classB
);
...
@@ -400,15 +400,15 @@ class ProductService extends Service {
...
@@ -400,15 +400,15 @@ class ProductService extends Service {
if
(
result
.
length
<
limit
)
{
if
(
result
.
length
<
limit
)
{
// 判断C组是否有值
// 判断C组是否有值
if
(
if
(
classList
.
hasOwnProperty
(
"class_C"
)
&&
classList
.
hasOwnProperty
(
'class_C'
)
&&
!
ctx
.
isEmpty
(
classList
.
class_C
)
!
ctx
.
isEmpty
(
classList
.
class_C
)
)
{
)
{
if
(
isNeedCalc
||
rule
===
3
)
{
if
(
isNeedCalc
||
rule
===
3
)
{
const
businessArr
=
R
.
pluck
(
"business_id"
)(
classList
.
class_C
);
const
businessArr
=
R
.
pluck
(
'business_id'
)(
classList
.
class_C
);
const
passRateList
=
await
this
.
getBusinessPassRate
(
businessArr
);
const
passRateList
=
await
this
.
getBusinessPassRate
(
businessArr
);
if
(
!
ctx
.
isEmpty
(
passRateList
))
{
if
(
!
ctx
.
isEmpty
(
passRateList
))
{
classList
.
class_C
=
R
.
map
(
function
(
e
)
{
classList
.
class_C
=
R
.
map
(
function
(
e
)
{
e
.
class
=
"C"
;
e
.
class
=
'C'
;
e
.
rule
=
rule
;
e
.
rule
=
rule
;
e
.
hasPassRate
=
0
;
e
.
hasPassRate
=
0
;
e
.
needCalc
=
isNeedCalc
||
(
isNeedCalc
&&
rule
===
3
)
?
1
:
0
;
e
.
needCalc
=
isNeedCalc
||
(
isNeedCalc
&&
rule
===
3
)
?
1
:
0
;
...
@@ -428,7 +428,7 @@ class ProductService extends Service {
...
@@ -428,7 +428,7 @@ class ProductService extends Service {
}
}
}
}
// 根据通过率降序排序
// 根据通过率降序排序
const
passRateSort
=
function
(
a
,
b
)
{
const
passRateSort
=
function
(
a
,
b
)
{
if
(
a
.
pass_rate
===
b
.
pass_rate
)
{
if
(
a
.
pass_rate
===
b
.
pass_rate
)
{
return
(
return
(
Number
(
a
.
recommend_sorter
)
-
Number
(
b
.
recommend_sorter
)
Number
(
a
.
recommend_sorter
)
-
Number
(
b
.
recommend_sorter
)
...
@@ -443,29 +443,29 @@ class ProductService extends Service {
...
@@ -443,29 +443,29 @@ class ProductService extends Service {
}
else
{
}
else
{
classList
.
class_C
=
R
.
sort
(
recommendSort
)(
classList
.
class_C
);
classList
.
class_C
=
R
.
sort
(
recommendSort
)(
classList
.
class_C
);
}
}
log
.
c_class_list
=
R
.
pluck
(
"business_id"
)(
classList
.
class_C
).
join
(
log
.
c_class_list
=
R
.
pluck
(
'business_id'
)(
classList
.
class_C
).
join
(
","
','
);
);
log
.
is_run_pass_rate
=
1
;
log
.
is_run_pass_rate
=
1
;
log
.
pass_rate_list
=
JSON
.
stringify
(
passRateList
);
log
.
pass_rate_list
=
JSON
.
stringify
(
passRateList
);
}
else
{
}
else
{
// 模型计算参数不够,仍然采用手动推荐
// 模型计算参数不够,仍然采用手动推荐
classList
.
class_C
=
R
.
sort
(
recommendSort
)(
classList
.
class_C
);
classList
.
class_C
=
R
.
sort
(
recommendSort
)(
classList
.
class_C
);
classList
.
class_C
=
R
.
map
(
function
(
e
)
{
classList
.
class_C
=
R
.
map
(
function
(
e
)
{
e
.
class
=
"C"
;
e
.
class
=
'C'
;
e
.
rule
=
rule
;
e
.
rule
=
rule
;
e
.
hasPassRate
=
0
;
e
.
hasPassRate
=
0
;
e
.
needCalc
=
isNeedCalc
||
(
isNeedCalc
&&
rule
===
3
)
?
1
:
0
;
e
.
needCalc
=
isNeedCalc
||
(
isNeedCalc
&&
rule
===
3
)
?
1
:
0
;
return
e
;
return
e
;
})(
classList
.
class_C
);
})(
classList
.
class_C
);
log
.
c_class_list
=
R
.
pluck
(
"business_id"
)(
classList
.
class_C
).
join
(
log
.
c_class_list
=
R
.
pluck
(
'business_id'
)(
classList
.
class_C
).
join
(
","
','
);
);
}
}
}
else
{
}
else
{
classList
.
class_C
=
R
.
sort
(
recommendSort
)(
classList
.
class_C
);
classList
.
class_C
=
R
.
sort
(
recommendSort
)(
classList
.
class_C
);
log
.
c_class_list
=
R
.
pluck
(
"business_id"
)(
classList
.
class_C
).
join
(
log
.
c_class_list
=
R
.
pluck
(
'business_id'
)(
classList
.
class_C
).
join
(
","
','
);
);
}
}
}
}
...
@@ -479,7 +479,7 @@ class ProductService extends Service {
...
@@ -479,7 +479,7 @@ class ProductService extends Service {
// 处理log
// 处理log
log
.
need_smart_recommend
=
isNeedCalc
?
1
:
0
;
log
.
need_smart_recommend
=
isNeedCalc
?
1
:
0
;
log
.
business_list
=
R
.
pluck
(
"business_id"
)(
result
).
join
(
","
);
log
.
business_list
=
R
.
pluck
(
'business_id'
)(
result
).
join
(
','
);
await
this
.
app
.
huodongModel
.
LogLoanRecommend
.
create
(
log
);
await
this
.
app
.
huodongModel
.
LogLoanRecommend
.
create
(
log
);
}
}
...
@@ -490,7 +490,7 @@ class ProductService extends Service {
...
@@ -490,7 +490,7 @@ class ProductService extends Service {
// 以下代码是为了处理渠道包下不展示特殊的4个业务
// 以下代码是为了处理渠道包下不展示特殊的4个业务
// start
// start
const
{
ctx
}
=
this
;
const
{
ctx
}
=
this
;
const
channel
=
ctx
.
cookies
.
get
(
"channel"
,
{
signed
:
false
});
const
channel
=
ctx
.
cookies
.
get
(
'channel'
,
{
signed
:
false
});
const
user_sid
=
isNaN
(
ctx
.
oldUserId
)
const
user_sid
=
isNaN
(
ctx
.
oldUserId
)
?
ctx
.
helper
.
decodeUserSid
(
ctx
.
oldUserId
)
?
ctx
.
helper
.
decodeUserSid
(
ctx
.
oldUserId
)
:
ctx
.
oldUserId
;
:
ctx
.
oldUserId
;
...
@@ -502,13 +502,13 @@ class ProductService extends Service {
...
@@ -502,13 +502,13 @@ class ProductService extends Service {
userInfo
=
await
ctx
.
gjjModel
.
SysGuest
.
one
(
filter
);
userInfo
=
await
ctx
.
gjjModel
.
SysGuest
.
one
(
filter
);
}
}
ctx
.
logger
.
info
(
"get_phone_by_user_sid:"
+
JSON
.
stringify
(
userInfo
));
ctx
.
logger
.
info
(
'get_phone_by_user_sid:'
+
JSON
.
stringify
(
userInfo
));
let
place_cid
=
0
;
let
place_cid
=
0
;
if
(
userInfo
!==
null
)
{
if
(
userInfo
!==
null
)
{
place_cid
=
userInfo
.
place_cid
;
place_cid
=
userInfo
.
place_cid
;
}
else
{
}
else
{
let
jianbing_guest_customer_id
=
ctx
.
cookies
.
get
(
let
jianbing_guest_customer_id
=
ctx
.
cookies
.
get
(
"jianbing_guest_customer_id"
,
'jianbing_guest_customer_id'
,
{
signed
:
false
}
{
signed
:
false
}
);
);
jianbing_guest_customer_id
=
isNaN
(
jianbing_guest_customer_id
)
jianbing_guest_customer_id
=
isNaN
(
jianbing_guest_customer_id
)
...
@@ -522,35 +522,41 @@ class ProductService extends Service {
...
@@ -522,35 +522,41 @@ class ProductService extends Service {
userInfo
=
await
ctx
.
gjjModel
.
SysGuest
.
one
(
filter
);
userInfo
=
await
ctx
.
gjjModel
.
SysGuest
.
one
(
filter
);
}
}
ctx
.
logger
.
info
(
"jianbing_guest_customer_id:"
+
JSON
.
stringify
(
userInfo
));
ctx
.
logger
.
info
(
'jianbing_guest_customer_id:'
+
JSON
.
stringify
(
userInfo
));
if
(
userInfo
!==
null
)
{
if
(
userInfo
!==
null
)
{
place_cid
=
userInfo
.
place_cid
;
place_cid
=
userInfo
.
place_cid
;
}
}
}
}
if
(
channel
==
"n_1_10000_tencent1"
)
{
if
(
channel
==
'n_1_10000_tencent1'
)
{
place_cid
=
5492
;
place_cid
=
5492
;
}
else
if
(
channel
==
"n_1_10000_51gjjyyb"
)
{
}
else
if
(
channel
==
'n_1_10000_51gjjyyb'
)
{
place_cid
=
5719
;
place_cid
=
5719
;
}
}
ctx
.
logger
.
info
(
"get_phone_by_user_place:"
+
place_cid
);
ctx
.
logger
.
info
(
'get_phone_by_user_place:'
+
place_cid
);
// end
// end
ctx
.
logger
.
info
(
ctx
.
logger
.
info
(
"filter_ua_business: "
+
'filter_ua_business: '
+
ctx
.
request
.
header
[
'user-agent'
]
ctx
.
request
.
header
[
'user-agent'
]
);
);
const
ret
=
[];
const
ret
=
[];
for
(
const
v
of
loanList
)
{
for
(
const
v
of
loanList
)
{
// preg_match('/ios|iphone/i', $user_agent)
// preg_match('/ios|iphone/i', $user_agent)
if
([
1012
,
1013
].
includes
(
ctx
.
helper
.
toInt
(
v
.
business_id
))
&&
/ios|iphone/i
.
test
(
ctx
.
request
.
header
[
'user-agent'
]))
{
ctx
.
logger
.
info
(
v
.
business_id
+
'filter_ua_business22222: '
);
if
([
1012
,
1013
].
includes
(
ctx
.
helper
.
toInt
(
v
.
business_id
))
&&
/ios|iphone/i
.
test
(
ctx
.
request
.
header
[
'user-agent'
]))
{
ctx
.
logger
.
info
(
'filter_ua_business11111: '
);
continue
;
continue
;
}
}
// 以下代码是为了处理渠道包下不展示特殊的4个业务
// 以下代码是为了处理渠道包下不展示特殊的4个业务
// start
// start
const
sepecial_business_ids
=
[
109
];
const
sepecial_business_ids
=
[
109
];
// const place_cids = [ 6046 ];
// const place_cids = [ 6046 ];
const
channelList
=
[
"n_1_10000_14038"
];
const
channelList
=
[
'n_1_10000_14038'
];
// if (ctx.helper.toInt(place_cid) > 0 && place_cids.includes(ctx.helper.toInt(place_cid)) && sepecial_business_ids.includes(ctx.helper.toInt(v.business_id))) {
// if (ctx.helper.toInt(place_cid) > 0 && place_cids.includes(ctx.helper.toInt(place_cid)) && sepecial_business_ids.includes(ctx.helper.toInt(v.business_id))) {
// ctx.logger.info('get_phone_by_user_place_business:' + place_cid + '--business_id--' + v.business_id);
// ctx.logger.info('get_phone_by_user_place_business:' + place_cid + '--business_id--' + v.business_id);
// continue;
// continue;
...
@@ -561,9 +567,9 @@ class ProductService extends Service {
...
@@ -561,9 +567,9 @@ class ProductService extends Service {
sepecial_business_ids
.
includes
(
ctx
.
helper
.
toInt
(
v
.
business_id
))
sepecial_business_ids
.
includes
(
ctx
.
helper
.
toInt
(
v
.
business_id
))
)
{
)
{
ctx
.
logger
.
info
(
ctx
.
logger
.
info
(
"filter_channel_business: "
+
'filter_channel_business: '
+
channel
+
channel
+
"--business_id--"
+
'--business_id--'
+
v
.
business_id
v
.
business_id
);
);
continue
;
continue
;
...
@@ -572,20 +578,20 @@ class ProductService extends Service {
...
@@ -572,20 +578,20 @@ class ProductService extends Service {
// 处理C组
// 处理C组
let
url
=
v
.
url
;
let
url
=
v
.
url
;
if
(
v
.
hasOwnProperty
(
"class"
))
{
if
(
v
.
hasOwnProperty
(
'class'
))
{
if
(
url
.
includes
(
"?"
))
{
if
(
url
.
includes
(
'?'
))
{
url
=
url
+
"&class="
+
v
.
class
+
"&rule="
+
String
(
v
.
rule
);
url
=
url
+
'&class='
+
v
.
class
+
'&rule='
+
String
(
v
.
rule
);
}
else
{
}
else
{
url
=
url
+
"?class="
+
v
.
class
+
"&rule="
+
String
(
v
.
rule
);
url
=
url
+
'?class='
+
v
.
class
+
'&rule='
+
String
(
v
.
rule
);
}
}
if
(
v
.
class
===
"C"
)
{
if
(
v
.
class
===
'C'
)
{
url
=
url
=
url
+
url
+
"&hasPassRate="
+
'&hasPassRate='
+
String
(
v
.
hasPassRate
)
+
String
(
v
.
hasPassRate
)
+
"&needCalc="
+
'&needCalc='
+
String
(
v
.
needCalc
)
+
String
(
v
.
needCalc
)
+
"&passRate="
+
'&passRate='
+
String
(
v
.
pass_rate
);
String
(
v
.
pass_rate
);
}
}
}
}
...
@@ -607,7 +613,7 @@ class ProductService extends Service {
...
@@ -607,7 +613,7 @@ class ProductService extends Service {
abridge_desc
:
v
.
abridge_desc
,
abridge_desc
:
v
.
abridge_desc
,
front_image
:
v
.
front_image
,
front_image
:
v
.
front_image
,
back_image
:
v
.
back_image
,
back_image
:
v
.
back_image
,
percent
:
v
.
percent
?
v
.
percent
:
"0"
,
percent
:
v
.
percent
?
v
.
percent
:
'0'
,
};
};
if
(
!
ctx
.
isEmpty
(
v
.
partner_alias
))
{
if
(
!
ctx
.
isEmpty
(
v
.
partner_alias
))
{
tmp
.
partner
=
v
.
partner_alias
;
tmp
.
partner
=
v
.
partner_alias
;
...
@@ -621,9 +627,9 @@ class ProductService extends Service {
...
@@ -621,9 +627,9 @@ class ProductService extends Service {
async
formatProducts
(
products
,
type
)
{
async
formatProducts
(
products
,
type
)
{
const
{
ctx
}
=
this
;
const
{
ctx
}
=
this
;
const
ret
=
[];
const
ret
=
[];
const
channel
=
ctx
.
cookies
.
get
(
"channel"
,
{
signed
:
false
});
const
channel
=
ctx
.
cookies
.
get
(
'channel'
,
{
signed
:
false
});
let
location
=
"loan_channel"
;
let
location
=
'loan_channel'
;
let
city
=
""
;
let
city
=
''
;
// 以下代码是为了处理渠道包下不展示特殊的4个业务
// 以下代码是为了处理渠道包下不展示特殊的4个业务
// start
// start
...
@@ -638,13 +644,13 @@ class ProductService extends Service {
...
@@ -638,13 +644,13 @@ class ProductService extends Service {
userInfo
=
await
ctx
.
gjjModel
.
SysGuest
.
one
(
filter
);
userInfo
=
await
ctx
.
gjjModel
.
SysGuest
.
one
(
filter
);
}
}
ctx
.
logger
.
info
(
"get_phone_by_user_sid:"
+
JSON
.
stringify
(
userInfo
));
ctx
.
logger
.
info
(
'get_phone_by_user_sid:'
+
JSON
.
stringify
(
userInfo
));
let
place_cid
=
0
;
let
place_cid
=
0
;
if
(
userInfo
!==
null
)
{
if
(
userInfo
!==
null
)
{
place_cid
=
userInfo
.
place_cid
;
place_cid
=
userInfo
.
place_cid
;
}
else
{
}
else
{
let
jianbing_guest_customer_id
=
ctx
.
cookies
.
get
(
let
jianbing_guest_customer_id
=
ctx
.
cookies
.
get
(
"jianbing_guest_customer_id"
,
'jianbing_guest_customer_id'
,
{
signed
:
false
}
{
signed
:
false
}
);
);
jianbing_guest_customer_id
=
isNaN
(
jianbing_guest_customer_id
)
jianbing_guest_customer_id
=
isNaN
(
jianbing_guest_customer_id
)
...
@@ -657,17 +663,17 @@ class ProductService extends Service {
...
@@ -657,17 +663,17 @@ class ProductService extends Service {
userInfo
=
await
ctx
.
gjjModel
.
SysGuest
.
one
(
filter
);
userInfo
=
await
ctx
.
gjjModel
.
SysGuest
.
one
(
filter
);
}
}
ctx
.
logger
.
info
(
"jianbing_guest_customer_id:"
+
JSON
.
stringify
(
userInfo
));
ctx
.
logger
.
info
(
'jianbing_guest_customer_id:'
+
JSON
.
stringify
(
userInfo
));
if
(
userInfo
!==
null
)
{
if
(
userInfo
!==
null
)
{
place_cid
=
userInfo
.
place_cid
;
place_cid
=
userInfo
.
place_cid
;
}
}
}
}
if
(
channel
==
"n_1_10000_tencent1"
)
{
if
(
channel
==
'n_1_10000_tencent1'
)
{
place_cid
=
5492
;
place_cid
=
5492
;
}
else
if
(
channel
==
"n_1_10000_51gjjyyb"
)
{
}
else
if
(
channel
==
'n_1_10000_51gjjyyb'
)
{
place_cid
=
5719
;
place_cid
=
5719
;
}
}
ctx
.
logger
.
info
(
"get_phone_by_user_place:"
+
place_cid
);
ctx
.
logger
.
info
(
'get_phone_by_user_place:'
+
place_cid
);
// end
// end
if
(
type
==
4
)
{
if
(
type
==
4
)
{
...
@@ -678,20 +684,20 @@ class ProductService extends Service {
...
@@ -678,20 +684,20 @@ class ProductService extends Service {
city_res
.
content
.
address_detail
&&
city_res
.
content
.
address_detail
&&
city_res
.
content
.
address_detail
.
city
city_res
.
content
.
address_detail
.
city
)
{
)
{
city
=
city_res
.
content
.
address_detail
.
city
.
replace
(
"市"
,
""
);
city
=
city_res
.
content
.
address_detail
.
city
.
replace
(
'市'
,
''
);
}
}
ctx
.
logger
.
info
(
JSON
.
stringify
(
city_res
));
ctx
.
logger
.
info
(
JSON
.
stringify
(
city_res
));
}
}
ctx
.
logger
.
info
(
"check loan city:"
+
city
);
ctx
.
logger
.
info
(
'check loan city:'
+
city
);
for
(
const
v
of
products
)
{
for
(
const
v
of
products
)
{
// ctx.logger.info('imh------begin----------')
// ctx.logger.info('imh------begin----------')
// 以下代码是为了处理渠道包下不展示特殊的4个业务
// 以下代码是为了处理渠道包下不展示特殊的4个业务
// start
// start
const
sepecial_business_ids
=
[
109
];
const
sepecial_business_ids
=
[
109
];
// const place_cids = [ 6046 ];
// const place_cids = [ 6046 ];
const
channelList
=
[
"n_1_10000_14038"
];
const
channelList
=
[
'n_1_10000_14038'
];
// if (ctx.helper.toInt(place_cid) > 0 && place_cids.includes(ctx.helper.toInt(place_cid)) && sepecial_business_ids.includes(ctx.helper.toInt(v.business_id))) {
// if (ctx.helper.toInt(place_cid) > 0 && place_cids.includes(ctx.helper.toInt(place_cid)) && sepecial_business_ids.includes(ctx.helper.toInt(v.business_id))) {
// ctx.logger.info('get_phone_by_user_place_business:' + place_cid + '--business_id--' + v.business_id);
// ctx.logger.info('get_phone_by_user_place_business:' + place_cid + '--business_id--' + v.business_id);
// continue;
// continue;
...
@@ -702,9 +708,9 @@ class ProductService extends Service {
...
@@ -702,9 +708,9 @@ class ProductService extends Service {
sepecial_business_ids
.
includes
(
ctx
.
helper
.
toInt
(
v
.
business_id
))
sepecial_business_ids
.
includes
(
ctx
.
helper
.
toInt
(
v
.
business_id
))
)
{
)
{
ctx
.
logger
.
info
(
ctx
.
logger
.
info
(
"filter_channel_business: "
+
'filter_channel_business: '
+
channel
+
channel
+
"--business_id--"
+
'--business_id--'
+
v
.
business_id
v
.
business_id
);
);
continue
;
continue
;
...
@@ -712,24 +718,24 @@ class ProductService extends Service {
...
@@ -712,24 +718,24 @@ class ProductService extends Service {
// end
// end
if
(
Number
(
v
.
type
)
===
2
||
Number
(
v
.
type
)
===
3
)
{
if
(
Number
(
v
.
type
)
===
2
||
Number
(
v
.
type
)
===
3
)
{
v
.
rate
=
""
;
v
.
rate
=
''
;
v
.
rate_title
=
""
;
v
.
rate_title
=
''
;
location
=
"credit_channel"
;
location
=
'credit_channel'
;
}
}
const
channels
=
ctx
.
isEmpty
(
v
.
channel_rate_id
)
const
channels
=
ctx
.
isEmpty
(
v
.
channel_rate_id
)
?
[]
?
[]
:
v
.
channel_rate_id
.
split
(
","
);
:
v
.
channel_rate_id
.
split
(
','
);
// const rate = channels.includes(channel) ? (v.channel_rate.includes('元') || v.channel_rate.includes('%') ? v.channel_rate : v.channel_rate + '%') : (!ctx.isEmpty(v.rate) ? (v.rate.includes('元') || v.rate.includes('%') ? v.rate : v.rate + '%') : '');
// const rate = channels.includes(channel) ? (v.channel_rate.includes('元') || v.channel_rate.includes('%') ? v.channel_rate : v.channel_rate + '%') : (!ctx.isEmpty(v.rate) ? (v.rate.includes('元') || v.rate.includes('%') ? v.rate : v.rate + '%') : '');
const
rate
=
channels
.
includes
(
channel
)
?
v
.
channel_rate
:
v
.
rate
;
const
rate
=
channels
.
includes
(
channel
)
?
v
.
channel_rate
:
v
.
rate
;
const
rateTitle
=
channels
.
includes
(
channel
)
const
rateTitle
=
channels
.
includes
(
channel
)
?
v
.
channel_rate_title
?
v
.
channel_rate_title
:
v
.
rate_title
;
:
v
.
rate_title
;
let
url
=
v
.
url
;
let
url
=
v
.
url
;
if
(
Number
(
v
.
type
)
===
4
&&
!
url
.
includes
(
"51yhd"
))
{
if
(
Number
(
v
.
type
)
===
4
&&
!
url
.
includes
(
'51yhd'
))
{
if
(
!
url
.
includes
(
"www.huaguxin.com"
))
{
if
(
!
url
.
includes
(
'www.huaguxin.com'
))
{
url
=
url
.
includes
(
"?"
)
url
=
url
.
includes
(
'?'
)
?
url
+
"&from=51gjj_loan_channel"
?
url
+
'&from=51gjj_loan_channel'
:
url
+
"?from=51gjj_loan_channel"
;
:
url
+
'?from=51gjj_loan_channel'
;
}
}
}
}
let
isLogin
=
false
;
let
isLogin
=
false
;
...
@@ -738,16 +744,16 @@ class ProductService extends Service {
...
@@ -738,16 +744,16 @@ class ProductService extends Service {
}
}
url
=
url
=
this
.
config
.
PHP_URL
+
this
.
config
.
PHP_URL
+
"/app/track/url?url="
+
'/app/track/url?url='
+
encodeURIComponent
(
url
)
+
encodeURIComponent
(
url
)
+
"&source=51gjj&location="
+
'&source=51gjj&location='
+
location
;
location
;
if
(
isLogin
)
{
if
(
isLogin
)
{
url
=
url
+
'#partner'
;
url
=
url
+
'#partner'
;
}
}
// ctx.logger.info(v.cities)
// ctx.logger.info(v.cities)
// ctx.logger.info(city)
// ctx.logger.info(city)
if
(
v
.
cities
&&
v
.
cities
.
length
>
0
&&
city
!=
""
)
{
if
(
v
.
cities
&&
v
.
cities
.
length
>
0
&&
city
!=
''
)
{
// ctx.logger.info('imh------222----------')
// ctx.logger.info('imh------222----------')
if
(
if
(
(
v
.
cities
.
includes
(
city
)
&&
Number
(
v
.
city_state
)
===
1
)
||
(
v
.
cities
.
includes
(
city
)
&&
Number
(
v
.
city_state
)
===
1
)
||
...
@@ -772,7 +778,7 @@ class ProductService extends Service {
...
@@ -772,7 +778,7 @@ class ProductService extends Service {
abridge_desc
:
v
.
abridge_desc
,
abridge_desc
:
v
.
abridge_desc
,
front_image
:
v
.
front_image
,
front_image
:
v
.
front_image
,
back_image
:
v
.
back_image
,
back_image
:
v
.
back_image
,
percent
:
v
.
percent
?
v
.
percent
:
"0"
,
percent
:
v
.
percent
?
v
.
percent
:
'0'
,
};
};
if
(
!
ctx
.
isEmpty
(
v
.
partner_alias
))
{
if
(
!
ctx
.
isEmpty
(
v
.
partner_alias
))
{
tmp
.
partner
=
v
.
partner_alias
;
tmp
.
partner
=
v
.
partner_alias
;
...
@@ -780,9 +786,9 @@ class ProductService extends Service {
...
@@ -780,9 +786,9 @@ class ProductService extends Service {
ret
.
push
(
tmp
);
ret
.
push
(
tmp
);
}
}
}
else
if
(
}
else
if
(
city
===
""
&&
city
===
''
&&
Number
(
v
.
type
)
===
4
&&
Number
(
v
.
type
)
===
4
&&
url
.
includes
(
"51yhdai"
)
url
.
includes
(
'51yhdai'
)
)
{
)
{
}
else
{
}
else
{
const
tmp
=
{
const
tmp
=
{
...
@@ -803,7 +809,7 @@ class ProductService extends Service {
...
@@ -803,7 +809,7 @@ class ProductService extends Service {
abridge_desc
:
v
.
abridge_desc
,
abridge_desc
:
v
.
abridge_desc
,
front_image
:
v
.
front_image
,
front_image
:
v
.
front_image
,
back_image
:
v
.
back_image
,
back_image
:
v
.
back_image
,
percent
:
v
.
percent
?
v
.
percent
:
"0"
,
percent
:
v
.
percent
?
v
.
percent
:
'0'
,
};
};
if
(
!
ctx
.
isEmpty
(
v
.
partner_alias
))
{
if
(
!
ctx
.
isEmpty
(
v
.
partner_alias
))
{
tmp
.
partner
=
v
.
partner_alias
;
tmp
.
partner
=
v
.
partner_alias
;
...
@@ -811,7 +817,7 @@ class ProductService extends Service {
...
@@ -811,7 +817,7 @@ class ProductService extends Service {
ret
.
push
(
tmp
);
ret
.
push
(
tmp
);
}
}
}
}
ctx
.
logger
.
info
(
"check city end"
);
ctx
.
logger
.
info
(
'check city end'
);
return
ret
;
return
ret
;
}
}
...
...
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