Commit 522573a9 authored by 任国军's avatar 任国军

add loan sort

parent 68e33aa7
Pipeline #11636 passed with stage
in 5 seconds
...@@ -73,7 +73,7 @@ class ProductService extends Service { ...@@ -73,7 +73,7 @@ class ProductService extends Service {
const user_id = ctx.userId; const user_id = ctx.userId;
const app_user_id = ctx.appUserId; const app_user_id = ctx.appUserId;
const recommendSort = function(a, b) { const recommendSort = function(a, b) {
return a.recommend_sorter - b.recommend_sorter; return Number(a.recommend_sorter) - Number(b.recommend_sorter);
}; };
const credit_loans = R.sort(recommendSort)(await this.getAllProductsByType(1)); const credit_loans = R.sort(recommendSort)(await this.getAllProductsByType(1));
const common_loans = R.sort(recommendSort)(await this.getAllProductsByType(4)); const common_loans = R.sort(recommendSort)(await this.getAllProductsByType(4));
...@@ -219,7 +219,7 @@ class ProductService extends Service { ...@@ -219,7 +219,7 @@ class ProductService extends Service {
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 Number(a.recommend_sorter) - Number(b.recommend_sorter);
}; };
let ret = []; let ret = [];
// 如果未登录,则推荐授信贷 // 如果未登录,则推荐授信贷
...@@ -344,6 +344,9 @@ class ProductService extends Service { ...@@ -344,6 +344,9 @@ class ProductService extends Service {
} }
// 根据通过率降序排序 // 根据通过率降序排序
const passRateSort = function(a, b) { const passRateSort = function(a, b) {
if (a.pass_rate === b.pass_rate) {
return Number(a.recommend_sorter) - Number(b.recommend_sorter);
}
return b.pass_rate - a.pass_rate; return b.pass_rate - a.pass_rate;
}; };
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment