Commit 0feb6dcd authored by 任国军's avatar 任国军
parents 9317fa44 dea23b70
Pipeline #22500 passed with stage
in 3 seconds
...@@ -34,21 +34,21 @@ class ProductService extends Service { ...@@ -34,21 +34,21 @@ class ProductService extends Service {
// 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({ where: { type, valid: 1, key: { $in: keys } }, order: [[ 'sort', 'asc' ]] }); let classifies = await ctx.blockModel.RecommendChannelClassify.findAll({ where: { type, valid: 1, key: { $in: keys } }, 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({ where: { classify_id: { $in: classify_ids }, status: 'online', valid: 1 }, order: [[ 'order', 'asc' ]] }); let options = await ctx.blockModel.RecommendChannelOption.all({ where: { classify_id: { $in: classify_ids }, status: 'online', valid: 1 }, 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({ where: { option_id: { $in: option_ids }, valid: 1 }, order: [[ 'order', 'asc' ]] }); let option_products = await ctx.blockModel.RecommendChannelProduct.all({ where: { option_id: { $in: option_ids }, valid: 1 }, order: [['order', 'asc']] });
option_products = R.project([ 'option_id', 'product_id', 'type' ])(option_products); option_products = R.project(['option_id', 'product_id', 'type'])(option_products);
const ret = []; const ret = [];
for (const i in classifies) { for (const i in classifies) {
const classify = classifies[i]; const classify = classifies[i];
const classify_id = classify.id; const classify_id = classify.id;
let temp_options = options.filter(option => parseInt(option.classify_id) === parseInt(classify_id)); let temp_options = options.filter(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;
...@@ -140,7 +140,7 @@ class ProductService extends Service { ...@@ -140,7 +140,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;
} }
...@@ -215,7 +215,7 @@ class ProductService extends Service { ...@@ -215,7 +215,7 @@ class ProductService extends Service {
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;
} }
...@@ -267,7 +267,7 @@ class ProductService extends Service { ...@@ -267,7 +267,7 @@ 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;
...@@ -286,7 +286,7 @@ class ProductService extends Service { ...@@ -286,7 +286,7 @@ class ProductService extends Service {
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 {
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;
...@@ -305,7 +305,7 @@ class ProductService extends Service { ...@@ -305,7 +305,7 @@ class ProductService extends Service {
// 先取A // 先取A
if (classList.hasOwnProperty('class_A') && !ctx.isEmpty(classList.class_A)) { if (classList.hasOwnProperty('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;
...@@ -314,7 +314,7 @@ class ProductService extends Service { ...@@ -314,7 +314,7 @@ class ProductService extends Service {
// 再取B // 再取B
if (classList.hasOwnProperty('class_B') && !ctx.isEmpty(classList.class_B)) { if (classList.hasOwnProperty('class_B') && !ctx.isEmpty(classList.class_B)) {
let classB = R.take(limit - result.length)(R.sort(recommendSort)(classList.class_B)); let classB = R.take(limit - result.length)(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;
...@@ -330,7 +330,7 @@ class ProductService extends Service { ...@@ -330,7 +330,7 @@ class ProductService extends Service {
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;
...@@ -348,7 +348,7 @@ class ProductService extends Service { ...@@ -348,7 +348,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 Number(a.recommend_sorter) - Number(b.recommend_sorter); return Number(a.recommend_sorter) - Number(b.recommend_sorter);
} }
...@@ -367,7 +367,7 @@ class ProductService extends Service { ...@@ -367,7 +367,7 @@ class ProductService extends Service {
} 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;
...@@ -443,9 +443,9 @@ class ProductService extends Service { ...@@ -443,9 +443,9 @@ class ProductService extends Service {
for (const v of loanList) { for (const v of loanList) {
// 以下代码是为了处理渠道包下不展示特殊的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;
...@@ -557,9 +557,9 @@ class ProductService extends Service { ...@@ -557,9 +557,9 @@ class ProductService extends Service {
// 以下代码是为了处理渠道包下不展示特殊的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;
...@@ -616,6 +616,8 @@ class ProductService extends Service { ...@@ -616,6 +616,8 @@ class ProductService extends Service {
ret.push(tmp); ret.push(tmp);
} }
} else if (city === '' && Number(v.type) === 4 && url.includes('51yhdai')) {
} else { } else {
const tmp = { const tmp = {
type: v.type, type: v.type,
......
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