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
7d34f5e9
Commit
7d34f5e9
authored
Aug 26, 2019
by
任国军
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix sort
parent
1f46d615
Pipeline
#13004
passed with stage
in 5 seconds
Changes
1
Pipelines
3
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
13 deletions
+17
-13
product.js
app/service/gjj/product.js
+17
-13
No files found.
app/service/gjj/product.js
View file @
7d34f5e9
...
...
@@ -72,11 +72,8 @@ class ProductService extends Service {
const
{
ctx
}
=
this
;
const
user_id
=
ctx
.
userId
;
const
app_user_id
=
ctx
.
appUserId
;
const
recommendSort
=
function
(
a
,
b
)
{
return
Number
(
a
.
recommend_sorter
)
-
Number
(
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
=
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
=
{
...
...
@@ -101,7 +98,7 @@ class ProductService extends Service {
id
:
-
4
,
title
:
'51公积金贷'
,
quality
:
credit_loans_ids
,
normal
:
[]
,
normal
:
common_loans_ids
,
});
children
.
push
({
id
:
-
5
,
...
...
@@ -115,7 +112,7 @@ class ProductService extends Service {
id
:
-
4
,
title
:
'51公积金贷'
,
quality
:
credit_loans_ids
,
normal
:
[]
,
normal
:
common_loans_ids
,
});
children
.
push
({
id
:
-
5
,
...
...
@@ -141,7 +138,13 @@ class ProductService extends Service {
return
products
;
}
products
=
products_results
.
data
.
ret
;
products
.
sort
(
function
(
x
,
y
)
{
return
x
.
recommend_sorter
-
y
.
recommend_sorter
;
});
const
sort
=
function
(
a
,
b
)
{
if
(
a
.
recommend_sorter
===
b
.
recommend_sorter
)
{
return
b
.
business_id
-
a
.
business_id
;
}
return
a
.
recommend_sorter
-
b
.
recommend_sorter
;
};
products
=
R
.
sort
(
sort
)(
products
);
products
=
await
this
.
formatProducts
(
products
);
return
products
;
...
...
@@ -172,8 +175,6 @@ class ProductService extends Service {
const
url
=
ctx
.
app
.
config
.
NODE_BASE_URL
+
'/cassandra-server/loan_list/bu_class/list'
;
const
param
=
{
uid
:
userId
,
app_uid
:
appUserId
,
app_id
:
ctx
.
appId
};
const
resp
=
await
ctx
.
helper
.
send_request
(
url
,
param
,
{
method
:
'GET'
});
console
.
log
(
param
);
console
.
log
(
resp
);
if
(
resp
.
status
!==
200
)
{
ctx
.
failed
(
'[bu_class]内部接口错误'
);
}
...
...
@@ -220,19 +221,22 @@ class ProductService extends Service {
const
userId
=
ctx
.
userId
;
const
R
=
require
(
'ramda'
);
const
recommendSort
=
function
(
a
,
b
)
{
return
Number
(
a
.
recommend_sorter
)
-
Number
(
b
.
recommend_sorter
);
if
(
a
.
recommend_sorter
===
b
.
recommend_sorter
)
{
return
b
.
business_id
-
a
.
business_id
;
}
return
a
.
recommend_sorter
-
b
.
recommend_sorter
;
};
let
ret
=
[];
// 如果未登录或者没有导入公积金,则推荐授信贷
if
(
ctx
.
isEmpty
(
userId
))
{
// const commonLoanList = await this.getCommonBusinessList();
const
loanList
=
await
this
.
getAllProductsByType
(
1
);
ret
=
R
.
take
(
limit
)(
R
.
sort
(
recommendSort
)(
loanList
)
);
ret
=
R
.
take
(
limit
)(
loanList
);
}
else
{
const
userGjj
=
await
ctx
.
helper
.
send_request
(
this
.
config
.
NODE_BASE_URL
+
'/cassandra-server/gjj/list/'
+
userId
,
{},
{
method
:
'GET'
});
if
(
userGjj
.
status
!==
200
||
ctx
.
isEmpty
(
userGjj
.
data
.
ret
))
{
const
loanList
=
await
this
.
getAllProductsByType
(
1
);
ret
=
R
.
take
(
limit
)(
R
.
sort
(
recommendSort
)(
loanList
)
);
ret
=
R
.
take
(
limit
)(
loanList
);
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