Commit caf63a04 authored by 谢永靖's avatar 谢永靖

1

parent deb341bb
Pipeline #36070 passed with stage
in 4 seconds
"use strict";
const Service = require("egg").Service;
const R = require("ramda");
const moment = require("moment");
'use strict';
const Service = require('egg').Service;
const R = require('ramda');
const moment = require('moment');
class ProductService extends Service {
// 通过 type=loan/credit 频道 option_ids 筛选项数组 all_product_ids
// async getProductsByOptions(option_ids, all_product_ids = []) {
......@@ -26,29 +26,29 @@ class ProductService extends Service {
// 获取筛选项列表 带 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":[]}]
async getRecommendOptions(type = "credit", keys = []) {
async getRecommendOptions(type = 'credit', keys = []) {
const { ctx } = this;
// const type = 'credit';
// keys = ['loan_organization', 'loan_filter', 'credit_bank', 'credit_theme', 'credit_filter'];
// console.info(keys);
let classifies = await ctx.blockModel.RecommendChannelClassify.findAll({
where: { type, valid: 1, key: { $in: keys } },
order: [["sort", "asc"]],
order: [[ 'sort', 'asc' ]],
});
// return classifies;
classifies = R.project(["id", "key", "title", "description"])(classifies);
const classify_ids = R.pluck("id", classifies);
classifies = R.project([ 'id', 'key', 'title', 'description' ])(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"]],
where: { classify_id: { $in: classify_ids }, status: 'online', valid: 1 },
order: [[ 'order', 'asc' ]],
});
options = R.project(["id", "title", "classify_id"])(options);
const option_ids = R.pluck("id", options);
options = R.project([ 'id', 'title', 'classify_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"]],
order: [[ 'order', 'asc' ]],
});
option_products = R.project(["option_id", "product_id", "type"])(
option_products = R.project([ 'option_id', 'product_id', 'type' ])(
option_products
);
const ret = [];
......@@ -56,24 +56,24 @@ class ProductService extends Service {
const classify = classifies[i];
const classify_id = classify.id;
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) {
const temp_option = temp_options[j];
const temp_option_id = temp_option.id;
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) => {
return v.type === "quality" ? "quality" : "normal";
temp_option_products = R.groupBy(v => {
return v.type === 'quality' ? 'quality' : 'normal';
})(temp_option_products);
const quality_product_ids = R.pluck(
"product_id",
'product_id',
temp_option_products.quality ? temp_option_products.quality : []
);
const normal_product_ids = R.pluck(
"product_id",
'product_id',
temp_option_products.normal ? temp_option_products.normal : []
);
temp_options[j].quality = quality_product_ids;
......@@ -94,46 +94,46 @@ class ProductService extends Service {
const app_user_id = ctx.appUserId;
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 credit_loans_ids = R.pluck('business_id', credit_loans);
const common_loans_ids = R.pluck('business_id', common_loans);
const default_options = {
id: -1,
key: "loan_all",
title: "全部",
description: "全部",
key: 'loan_all',
title: '全部',
description: '全部',
_children: [],
};
const children = [
{
id: -2,
title: "全部",
title: '全部',
quality: credit_loans_ids,
normal: common_loans_ids,
},
];
if (app_user_id) {
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)) {
children.push({
id: -3,
title: "最适合您的",
title: '最适合您的',
quality: await this.getSuitLoans(),
normal: [],
});
} else {
children.push({
id: -4,
title: "51公积金贷",
title: '51公积金贷',
quality: credit_loans_ids,
normal: common_loans_ids,
});
children.push({
id: -5,
title: "普通贷",
title: '普通贷',
quality: [],
normal: common_loans_ids,
});
......@@ -141,13 +141,13 @@ class ProductService extends Service {
} else {
children.push({
id: -4,
title: "51公积金贷",
title: '51公积金贷',
quality: credit_loans_ids,
normal: common_loans_ids,
});
children.push({
id: -5,
title: "普通贷",
title: '普通贷',
quality: [],
normal: common_loans_ids,
});
......@@ -160,12 +160,12 @@ class ProductService extends Service {
// 1 授信贷;2 信用卡;3 普通信用卡;4 普通贷款
async getAllProductsByType(type) {
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(
url,
{ type, app_id: ctx.appId },
{ method: "GET" }
{ method: 'GET' }
);
// ctx.logger.info(JSON.stringify({ url, products_results }));
let products = [];
......@@ -178,7 +178,7 @@ class ProductService extends Service {
}
products = products_results.data.ret;
const sort = function (a, b) {
const sort = function(a, b) {
if (a.recommend_sorter === b.recommend_sorter) {
return b.business_id - a.business_id;
}
......@@ -193,13 +193,13 @@ class ProductService extends Service {
// 最适合您的(推荐)贷款
async getSuitLoans() {
const results = await this.getBusinessRecommendList(9999);
const ret = R.pluck("business_id", results);
const ret = R.pluck('business_id', results);
return ret;
}
// 贷款频道首页热门推荐
async getLoanHomeList() {
let ret = await this.getBusinessRecommendList(6, "home");
let ret = await this.getBusinessRecommendList(6, 'home');
if (ret.length < 6) {
const creditLoan = R.take(6 - ret.length)(
await this.getAllProductsByType(4)
......@@ -216,11 +216,11 @@ class ProductService extends Service {
const appUserId = ctx.appUserId;
const 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 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) {
ctx.failed("[bu_class]内部接口错误");
ctx.failed('[bu_class]内部接口错误');
}
return resp.data.ret;
}
......@@ -232,7 +232,7 @@ class ProductService extends Service {
const appUserId = ctx.appUserId;
const url =
ctx.app.config.NODE_BASE_URL +
"/cassandra-server/loan_list/recommend_sort/list";
'/cassandra-server/loan_list/recommend_sort/list';
const param = {
uid: userId,
app_uid: appUserId,
......@@ -244,9 +244,9 @@ class ProductService extends Service {
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) {
ctx.failed("[recommend_sort]内部接口错误");
ctx.failed('[recommend_sort]内部接口错误');
}
return resp.data.ret;
......@@ -259,11 +259,11 @@ class ProductService extends Service {
}
// 获取推荐列表,按照ABC分组顺序推荐
async getBusinessRecommendList(limit, location = "list") {
async getBusinessRecommendList(limit, location = 'list') {
const { ctx } = this;
const userId = ctx.userId;
const R = require("ramda");
const recommendSort = function (a, b) {
const R = require('ramda');
const recommendSort = function(a, b) {
if (a.recommend_sorter === b.recommend_sorter) {
return b.business_id - a.business_id;
}
......@@ -277,9 +277,9 @@ class ProductService extends Service {
ret = R.take(limit)(loanList);
} else {
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)) {
const loanList = await this.getAllProductsByType(1);
......@@ -293,13 +293,13 @@ class ProductService extends Service {
type: 2,
need_smart_recommend: 0,
is_smart_recommend: 0,
pass_rate_list: "",
business_list: "",
c_class_list: "",
common_loan_list: "",
page_type: location === "list" ? 2 : 1,
pass_rate_list: '',
business_list: '',
c_class_list: '',
common_loan_list: '',
page_type: location === 'list' ? 2 : 1,
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 {
// 获取开关状态,判断是自动推荐or手动推荐orABTest
const keyword =
location === "list"
? "config_list_smart_recommend"
: "config_loan_smart_recommend";
location === 'list'
? 'config_list_smart_recommend'
: 'config_loan_smart_recommend';
const ruleSetting = await this.app.huodongModel.Setting.findOne({
where: { keyword },
});
......@@ -324,8 +324,8 @@ class ProductService extends Service {
break;
case 2:
isNeedCalc = false;
classList.class_C = R.map(function (e) {
e.class = "C";
classList.class_C = R.map(function(e) {
e.class = 'C';
e.rule = rule;
e.hasPassRate = 0;
e.needCalc = 0;
......@@ -337,10 +337,10 @@ class ProductService extends Service {
isNeedCalc = false;
// 获取用户手机号,根据手机号末尾判断是否自动推荐
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 : {};
......@@ -352,8 +352,8 @@ class ProductService extends Service {
) {
isNeedCalc = true;
} else {
classList.class_C = R.map(function (e) {
e.class = "C";
classList.class_C = R.map(function(e) {
e.class = 'C';
e.rule = rule;
e.hasPassRate = 0;
e.needCalc = 0;
......@@ -370,26 +370,26 @@ class ProductService extends Service {
let result = [];
// 先取A
if (
classList.hasOwnProperty("class_A") &&
classList.hasOwnProperty('class_A') &&
!ctx.isEmpty(classList.class_A)
) {
result = R.take(limit)(R.sort(recommendSort)(classList.class_A));
result = R.map(function (e) {
e.class = "A";
result = R.map(function(e) {
e.class = 'A';
e.rule = 2;
return e;
})(result);
}
// 再取B
if (
classList.hasOwnProperty("class_B") &&
classList.hasOwnProperty('class_B') &&
!ctx.isEmpty(classList.class_B)
) {
let classB = R.take(limit - result.length)(
R.sort(recommendSort)(classList.class_B)
);
classB = R.map(function (e) {
e.class = "B";
classB = R.map(function(e) {
e.class = 'B';
e.rule = 2;
return e;
})(classB);
......@@ -400,15 +400,15 @@ class ProductService extends Service {
if (result.length < limit) {
// 判断C组是否有值
if (
classList.hasOwnProperty("class_C") &&
classList.hasOwnProperty('class_C') &&
!ctx.isEmpty(classList.class_C)
) {
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);
if (!ctx.isEmpty(passRateList)) {
classList.class_C = R.map(function (e) {
e.class = "C";
classList.class_C = R.map(function(e) {
e.class = 'C';
e.rule = rule;
e.hasPassRate = 0;
e.needCalc = isNeedCalc || (isNeedCalc && rule === 3) ? 1 : 0;
......@@ -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) {
return (
Number(a.recommend_sorter) - Number(b.recommend_sorter)
......@@ -443,29 +443,29 @@ class ProductService extends Service {
} else {
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.pass_rate_list = JSON.stringify(passRateList);
} else {
// 模型计算参数不够,仍然采用手动推荐
classList.class_C = R.sort(recommendSort)(classList.class_C);
classList.class_C = R.map(function (e) {
e.class = "C";
classList.class_C = R.map(function(e) {
e.class = 'C';
e.rule = rule;
e.hasPassRate = 0;
e.needCalc = isNeedCalc || (isNeedCalc && rule === 3) ? 1 : 0;
return e;
})(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 {
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 {
// 处理log
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);
}
......@@ -490,7 +490,7 @@ class ProductService extends Service {
// 以下代码是为了处理渠道包下不展示特殊的4个业务
// start
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)
? ctx.helper.decodeUserSid(ctx.oldUserId)
: ctx.oldUserId;
......@@ -502,13 +502,13 @@ class ProductService extends Service {
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;
if (userInfo !== null) {
place_cid = userInfo.place_cid;
} else {
let jianbing_guest_customer_id = ctx.cookies.get(
"jianbing_guest_customer_id",
'jianbing_guest_customer_id',
{ signed: false }
);
jianbing_guest_customer_id = isNaN(jianbing_guest_customer_id)
......@@ -522,35 +522,41 @@ class ProductService extends Service {
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) {
place_cid = userInfo.place_cid;
}
}
if (channel == "n_1_10000_tencent1") {
if (channel == 'n_1_10000_tencent1') {
place_cid = 5492;
} else if (channel == "n_1_10000_51gjjyyb") {
} else if (channel == 'n_1_10000_51gjjyyb') {
place_cid = 5719;
}
ctx.logger.info("get_phone_by_user_place:" + place_cid);
ctx.logger.info('get_phone_by_user_place:' + place_cid);
// end
ctx.logger.info(
"filter_ua_business: " +
'filter_ua_business: ' +
ctx.request.header['user-agent']
);
const ret = [];
for (const v of loanList) {
// 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;
}
// 以下代码是为了处理渠道包下不展示特殊的4个业务
// start
const sepecial_business_ids = [109];
const sepecial_business_ids = [ 109 ];
// 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))) {
// ctx.logger.info('get_phone_by_user_place_business:' + place_cid + '--business_id--' + v.business_id);
// continue;
......@@ -561,9 +567,9 @@ class ProductService extends Service {
sepecial_business_ids.includes(ctx.helper.toInt(v.business_id))
) {
ctx.logger.info(
"filter_channel_business: " +
'filter_channel_business: ' +
channel +
"--business_id--" +
'--business_id--' +
v.business_id
);
continue;
......@@ -572,20 +578,20 @@ class ProductService extends Service {
// 处理C组
let url = v.url;
if (v.hasOwnProperty("class")) {
if (url.includes("?")) {
url = url + "&class=" + v.class + "&rule=" + String(v.rule);
if (v.hasOwnProperty('class')) {
if (url.includes('?')) {
url = url + '&class=' + v.class + '&rule=' + String(v.rule);
} 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 +
"&hasPassRate=" +
'&hasPassRate=' +
String(v.hasPassRate) +
"&needCalc=" +
'&needCalc=' +
String(v.needCalc) +
"&passRate=" +
'&passRate=' +
String(v.pass_rate);
}
}
......@@ -607,7 +613,7 @@ class ProductService extends Service {
abridge_desc: v.abridge_desc,
front_image: v.front_image,
back_image: v.back_image,
percent: v.percent ? v.percent : "0",
percent: v.percent ? v.percent : '0',
};
if (!ctx.isEmpty(v.partner_alias)) {
tmp.partner = v.partner_alias;
......@@ -621,9 +627,9 @@ class ProductService extends Service {
async formatProducts(products, type) {
const { ctx } = this;
const ret = [];
const channel = ctx.cookies.get("channel", { signed: false });
let location = "loan_channel";
let city = "";
const channel = ctx.cookies.get('channel', { signed: false });
let location = 'loan_channel';
let city = '';
// 以下代码是为了处理渠道包下不展示特殊的4个业务
// start
......@@ -638,13 +644,13 @@ class ProductService extends Service {
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;
if (userInfo !== null) {
place_cid = userInfo.place_cid;
} else {
let jianbing_guest_customer_id = ctx.cookies.get(
"jianbing_guest_customer_id",
'jianbing_guest_customer_id',
{ signed: false }
);
jianbing_guest_customer_id = isNaN(jianbing_guest_customer_id)
......@@ -657,17 +663,17 @@ class ProductService extends Service {
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) {
place_cid = userInfo.place_cid;
}
}
if (channel == "n_1_10000_tencent1") {
if (channel == 'n_1_10000_tencent1') {
place_cid = 5492;
} else if (channel == "n_1_10000_51gjjyyb") {
} else if (channel == 'n_1_10000_51gjjyyb') {
place_cid = 5719;
}
ctx.logger.info("get_phone_by_user_place:" + place_cid);
ctx.logger.info('get_phone_by_user_place:' + place_cid);
// end
if (type == 4) {
......@@ -678,20 +684,20 @@ class ProductService extends Service {
city_res.content.address_detail &&
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("check loan city:" + city);
ctx.logger.info('check loan city:' + city);
for (const v of products) {
// ctx.logger.info('imh------begin----------')
// 以下代码是为了处理渠道包下不展示特殊的4个业务
// start
const sepecial_business_ids = [109];
const sepecial_business_ids = [ 109 ];
// 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))) {
// ctx.logger.info('get_phone_by_user_place_business:' + place_cid + '--business_id--' + v.business_id);
// continue;
......@@ -702,9 +708,9 @@ class ProductService extends Service {
sepecial_business_ids.includes(ctx.helper.toInt(v.business_id))
) {
ctx.logger.info(
"filter_channel_business: " +
'filter_channel_business: ' +
channel +
"--business_id--" +
'--business_id--' +
v.business_id
);
continue;
......@@ -712,24 +718,24 @@ class ProductService extends Service {
// end
if (Number(v.type) === 2 || Number(v.type) === 3) {
v.rate = "";
v.rate_title = "";
location = "credit_channel";
v.rate = '';
v.rate_title = '';
location = 'credit_channel';
}
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 : v.rate;
const rateTitle = channels.includes(channel)
? v.channel_rate_title
: v.rate_title;
let url = v.url;
if (Number(v.type) === 4 && !url.includes("51yhd")) {
if (!url.includes("www.huaguxin.com")) {
url = url.includes("?")
? url + "&from=51gjj_loan_channel"
: url + "?from=51gjj_loan_channel";
if (Number(v.type) === 4 && !url.includes('51yhd')) {
if (!url.includes('www.huaguxin.com')) {
url = url.includes('?')
? url + '&from=51gjj_loan_channel'
: url + '?from=51gjj_loan_channel';
}
}
let isLogin = false;
......@@ -738,16 +744,16 @@ class ProductService extends Service {
}
url =
this.config.PHP_URL +
"/app/track/url?url=" +
'/app/track/url?url=' +
encodeURIComponent(url) +
"&source=51gjj&location=" +
'&source=51gjj&location=' +
location;
if (isLogin) {
url = url + '#partner';
}
// ctx.logger.info(v.cities)
// 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----------')
if (
(v.cities.includes(city) && Number(v.city_state) === 1) ||
......@@ -772,7 +778,7 @@ class ProductService extends Service {
abridge_desc: v.abridge_desc,
front_image: v.front_image,
back_image: v.back_image,
percent: v.percent ? v.percent : "0",
percent: v.percent ? v.percent : '0',
};
if (!ctx.isEmpty(v.partner_alias)) {
tmp.partner = v.partner_alias;
......@@ -780,9 +786,9 @@ class ProductService extends Service {
ret.push(tmp);
}
} else if (
city === "" &&
city === '' &&
Number(v.type) === 4 &&
url.includes("51yhdai")
url.includes('51yhdai')
) {
} else {
const tmp = {
......@@ -803,7 +809,7 @@ class ProductService extends Service {
abridge_desc: v.abridge_desc,
front_image: v.front_image,
back_image: v.back_image,
percent: v.percent ? v.percent : "0",
percent: v.percent ? v.percent : '0',
};
if (!ctx.isEmpty(v.partner_alias)) {
tmp.partner = v.partner_alias;
......@@ -811,7 +817,7 @@ class ProductService extends Service {
ret.push(tmp);
}
}
ctx.logger.info("check city end");
ctx.logger.info('check city end');
return ret;
}
......
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