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
4e4c6a2f
Commit
4e4c6a2f
authored
Jul 26, 2019
by
任国军
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
loan recommend change abtest
parent
0ccaaa4e
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
8 deletions
+12
-8
product.js
app/service/gjj/product.js
+12
-8
No files found.
app/service/gjj/product.js
View file @
4e4c6a2f
...
@@ -157,7 +157,7 @@ class ProductService extends Service {
...
@@ -157,7 +157,7 @@ class ProductService extends Service {
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
)(
await
this
.
getAllProductsByType
(
1
));
const
creditLoan
=
R
.
take
(
6
-
ret
.
length
)(
await
this
.
getAllProductsByType
(
4
));
ret
=
R
.
insertAll
(
ret
.
length
,
creditLoan
)(
ret
);
ret
=
R
.
insertAll
(
ret
.
length
,
creditLoan
)(
ret
);
}
}
return
ret
;
return
ret
;
...
@@ -213,18 +213,18 @@ class ProductService extends Service {
...
@@ -213,18 +213,18 @@ class ProductService extends Service {
// 获取推荐列表,按照ABC分组顺序推荐
// 获取推荐列表,按照ABC分组顺序推荐
async
getBusinessRecommendList
(
limit
,
location
=
'list'
)
{
async
getBusinessRecommendList
(
limit
,
location
=
'list'
)
{
const
{
ctx
}
=
this
;
const
{
ctx
,
service
}
=
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
)
{
return
a
.
recommend_sorter
-
b
.
recommend_sorter
;
return
a
.
recommend_sorter
-
b
.
recommend_sorter
;
};
};
let
ret
=
[];
let
ret
=
[];
// 如果未登录,则推荐
普通贷款
// 如果未登录,则推荐
授信贷
if
(
ctx
.
isEmpty
(
userId
))
{
if
(
ctx
.
isEmpty
(
userId
))
{
const
commonLoanList
=
await
this
.
getCommonBusinessList
();
//
const commonLoanList = await this.getCommonBusinessList();
ret
=
this
.
formatLoanList
(
R
.
take
(
limit
)(
R
.
sort
(
recommendSort
)(
commonLoanList
))
);
const
loanList
=
await
this
.
getAllProductsByType
(
1
);
console
.
log
(
'未登录'
);
ret
=
R
.
take
(
limit
)(
R
.
sort
(
recommendSort
)(
loanList
)
);
}
else
{
}
else
{
// 日志
// 日志
const
log
=
{
const
log
=
{
...
@@ -251,6 +251,7 @@ class ProductService extends Service {
...
@@ -251,6 +251,7 @@ class ProductService extends Service {
console
.
log
(
'rule: '
+
String
(
rule
));
console
.
log
(
'rule: '
+
String
(
rule
));
// 是否需要计算模型
// 是否需要计算模型
let
isNeedCalc
=
false
;
let
isNeedCalc
=
false
;
let
userInfo
=
{};
switch
(
rule
)
{
switch
(
rule
)
{
case
1
:
case
1
:
isNeedCalc
=
true
;
isNeedCalc
=
true
;
...
@@ -266,8 +267,11 @@ class ProductService extends Service {
...
@@ -266,8 +267,11 @@ class ProductService extends Service {
})(
classList
.
class_C
);
})(
classList
.
class_C
);
break
;
break
;
case
3
:
case
3
:
// 根据时间戳毫秒来判断,偶数为A,奇数为B
// 获取不到手机号则默认使用手动推荐
if
(
Number
(
moment
().
milliseconds
())
%
2
===
0
)
{
isNeedCalc
=
false
;
// 获取用户手机号,根据手机号末尾判断是否自动推荐
userInfo
=
await
service
.
user
.
get_user
(
ctx
.
appUserId
);
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
{
classList
.
class_C
=
R
.
map
(
function
(
e
)
{
classList
.
class_C
=
R
.
map
(
function
(
e
)
{
...
...
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