Commit 3d37542f authored by Hsinli's avatar Hsinli

Merge branch 'master' of t-git.51gjj.com:fangbin/51business

parents b93f9b76 beb64607
Pipeline #8796 passed with stage
in 12 seconds
...@@ -3,30 +3,32 @@ ...@@ -3,30 +3,32 @@
const Controller = require('egg').Controller; const Controller = require('egg').Controller;
class ProductController extends Controller { class ProductController extends Controller {
// 筛选项列表 // 筛选项列表
async getOptionProducts() { async getOptionProducts() {
const { ctx } = this; const { ctx } = this;
const type = ctx.params.type || 'credit'; const type = ctx.params.type || 'credit';
const keys = ctx.query.keys ? eval(ctx.query.keys) : []; const keys = ctx.query.keys ? ctx.query.keys.split(',') : [];
const results = await ctx.service.gjj.product.getRecommendOptions(type, keys); const results = await ctx.service.gjj.product.getRecommendOptions(type, keys);
let suit_options; let suit_options;
let credit_loans = []; let credit_loans = [];
let common_loans = []; let common_loans = [];
let common_credits = []; let common_credits = [];
if (type == 'loan') { let credit_cards = [];
suit_options = await ctx.service.gjj.product.getLoanChannelSuitOptions(); if (type === 'loan') {
if (suit_options) { suit_options = await ctx.service.gjj.product.getLoanChannelSuitOptions();
results.unshift(suit_options); if (suit_options) {
} results.unshift(suit_options);
credit_loans = await ctx.service.gjj.product.getAllProductsByType(1); }
common_loans = await ctx.service.gjj.product.getAllProductsByType(4); credit_loans = await ctx.service.gjj.product.getAllProductsByType(1);
} else { common_loans = await ctx.service.gjj.product.getAllProductsByType(4);
common_credits = await ctx.service.gjj.product.getAllProductsByType(3); } else {
} credit_cards = await ctx.service.gjj.product.getAllProductsByType(2);
common_credits = await ctx.service.gjj.product.getAllProductsByType(3);
ctx.success({ results: results, credit_loans: credit_loans, common_loans: common_loans, common_credits: common_credits });
} }
ctx.success({ results, credit_loans, common_loans, common_credits, credit_cards });
}
} }
module.exports = ProductController; module.exports = ProductController;
...@@ -39,6 +39,36 @@ module.exports = { ...@@ -39,6 +39,36 @@ module.exports = {
} }
}, },
isEmpty(data) {
const type = typeof (data);
let ret = false;
switch (type) {
case 'undefined':
ret = true;
break;
case 'string':
ret = !(data.length > 0);
break;
case 'number':
ret = !(data > 0);
break;
case 'boolean':
ret = false;
break;
case 'object':
// 判断是否为数组
if (data instanceof Array) {
ret = !(data.length > 0);
} else {
ret = JSON.stringify(data) === '{}' || !data;
}
break;
default:
break;
}
return ret;
},
login(params) { login(params) {
const { cookies, session } = this; const { cookies, session } = this;
const moment = require('moment'); const moment = require('moment');
......
...@@ -4,6 +4,6 @@ module.exports = app => { ...@@ -4,6 +4,6 @@ module.exports = app => {
const router = app.router.namespace(app.config.projectRootPath + '/product'); const router = app.router.namespace(app.config.projectRootPath + '/product');
router.get('/recommend/channel/options/:type', 'gjj.product.getOptionProducts');// router.get('third_options', '/recommend/channel/options/:type', 'gjj.product.getOptionProducts');//
}; };
This diff is collapsed.
...@@ -90,13 +90,13 @@ module.exports = appInfo => { ...@@ -90,13 +90,13 @@ module.exports = appInfo => {
}; };
config.PHP_URL = 'https://kaifa.jianbing.com'; config.PHP_URL = 'https://kaifa.jianbing.com';
config.NODE_URL = 'https://dev-nginx.jianbing.com/user_api/v1'; config.NODE_URL = 'https://uat-nginx.jianbing.com/user_api/v1';
config.NODE_BASE_URL = 'https://dev-nginx.jianbing.com'; config.NODE_BASE_URL = 'https://uat-nginx.jianbing.com';
config.HOUSE_SERVICE_API = 'https://uat-nginx.jianbing.com/house-service'; config.HOUSE_SERVICE_API = 'https://uat-nginx.jianbing.com/house-service';
config.CDN_BASE_URL = 'https://r.51gjj.com/image/'; config.CDN_BASE_URL = 'https://r.51gjj.com/image/';
config.USER_CENTER_API_URI = 'https://dev-nginx.jianbing.com/usercenter-service'; config.USER_CENTER_API_URI = 'https://uat-nginx.jianbing.com/usercenter-service';
return config; return config;
......
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