Commit d8779ce0 authored by 任国军's avatar 任国军

fix city_state bug

parent dedfeb5c
Pipeline #17855 passed with stage
in 53 seconds
...@@ -135,7 +135,6 @@ class ProductService extends Service { ...@@ -135,7 +135,6 @@ class ProductService extends Service {
const products_results = await ctx.helper.send_request(url, { type, app_id: ctx.appId }, { method: 'GET' }); const products_results = await ctx.helper.send_request(url, { type, app_id: ctx.appId }, { method: 'GET' });
// ctx.logger.info(JSON.stringify({ url, products_results })); // ctx.logger.info(JSON.stringify({ url, products_results }));
let products = []; let products = [];
console.log(products_results);
if (products_results.status !== 200 || !products_results.data || !products_results.data.ret) { if (products_results.status !== 200 || !products_results.data || !products_results.data.ret) {
return products; return products;
} }
...@@ -207,15 +206,8 @@ class ProductService extends Service { ...@@ -207,15 +206,8 @@ class ProductService extends Service {
// 获取普通贷款 // 获取普通贷款
async getCommonBusinessList() { async getCommonBusinessList() {
const { ctx } = this; const ret = await this.getAllProductsByType(4);
const url = ctx.app.config.NODE_BASE_URL + '/cassandra-server/bu_basic/list'; return ret;
const param = { type: 4, app_id: ctx.appId };
const resp = await ctx.helper.send_request(url, param, { method: 'GET' });
if (resp.status !== 200) {
ctx.failed('[bu_basic]内部接口错误');
}
return resp.data.ret;
} }
// 获取推荐列表,按照ABC分组顺序推荐 // 获取推荐列表,按照ABC分组顺序推荐
...@@ -485,11 +477,11 @@ class ProductService extends Service { ...@@ -485,11 +477,11 @@ class ProductService extends Service {
if (city_res && city_res.content && city_res.content.address_detail && city_res.content.address_detail.city) { if (city_res && city_res.content && 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(city_res); ctx.logger.info(JSON.stringify(city_res));
} }
ctx.logger.info('check loan city:' + city);
for (const v of products) { for (const v of products) {
ctx.logger.info('imh------begin----------');
if (Number(v.type) === 2 || Number(v.type) === 3) { if (Number(v.type) === 2 || Number(v.type) === 3) {
v.rate = ''; v.rate = '';
v.rate_title = ''; v.rate_title = '';
...@@ -504,12 +496,10 @@ class ProductService extends Service { ...@@ -504,12 +496,10 @@ class ProductService extends Service {
url = url.includes('?') ? url + '&from=51gjj_loan_channel' : url + '?from=51gjj_loan_channel'; url = url.includes('?') ? url + '&from=51gjj_loan_channel' : url + '?from=51gjj_loan_channel';
} }
url = this.config.PHP_URL + '/app/track/url?url=' + encodeURIComponent(url) + '&source=51gjj&location=' + location; url = this.config.PHP_URL + '/app/track/url?url=' + encodeURIComponent(url) + '&source=51gjj&location=' + location;
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----------'); ctx.logger.info(v.business_id, v.type);
if ((v.cities.includes(city) && Number(v.city_status) === 1) || (!v.cities.includes(city) && Number(v.city_status) === 0) ) { ctx.logger.info(JSON.stringify(v.cities));
ctx.logger.info('imh----------------'); if ((v.cities.includes(city) && Number(v.city_state) === 1) || (!v.cities.includes(city) && Number(v.city_state) === 0) ) {
const tmp = { const tmp = {
type: v.type, type: v.type,
business_id: v.business_id, business_id: v.business_id,
...@@ -554,11 +544,8 @@ class ProductService extends Service { ...@@ -554,11 +544,8 @@ class ProductService extends Service {
}; };
ret.push(tmp); ret.push(tmp);
} }
ctx.logger.info('imh------end----------');
} }
ctx.logger.info('check city end');
return ret; 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