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

add credit_cards

parent 4cdbe004
Pipeline #8794 passed with stage
in 3 seconds
......@@ -3,30 +3,32 @@
const Controller = require('egg').Controller;
class ProductController extends Controller {
// 筛选项列表
async getOptionProducts() {
// 筛选项列表
async getOptionProducts() {
const { ctx } = this;
const type = ctx.params.type || 'credit';
const { ctx } = this;
const type = ctx.params.type || 'credit';
const keys = ctx.query.keys ? eval(ctx.query.keys) : [];
const results = await ctx.service.gjj.product.getRecommendOptions(type, keys);
let suit_options;
let credit_loans = [];
let common_loans = [];
let common_credits = [];
if (type == 'loan') {
suit_options = await ctx.service.gjj.product.getLoanChannelSuitOptions();
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);
} else {
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 });
const keys = ctx.query.keys ? ctx.query.keys.split(',') : [];
const results = await ctx.service.gjj.product.getRecommendOptions(type, keys);
let suit_options;
let credit_loans = [];
let common_loans = [];
let common_credits = [];
let credit_cards = [];
if (type === 'loan') {
suit_options = await ctx.service.gjj.product.getLoanChannelSuitOptions();
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);
} else {
credit_cards = await ctx.service.gjj.product.getAllProductsByType(2);
common_credits = await ctx.service.gjj.product.getAllProductsByType(3);
}
ctx.success({ results, credit_loans, common_loans, common_credits, credit_cards });
}
}
module.exports = ProductController;
......@@ -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) {
const { cookies, session } = this;
const moment = require('moment');
......
......@@ -4,6 +4,6 @@ module.exports = app => {
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 => {
};
config.PHP_URL = 'https://kaifa.jianbing.com';
config.NODE_URL = 'https://dev-nginx.jianbing.com/user_api/v1';
config.NODE_BASE_URL = 'https://dev-nginx.jianbing.com';
config.NODE_URL = 'https://uat-nginx.jianbing.com/user_api/v1';
config.NODE_BASE_URL = 'https://uat-nginx.jianbing.com';
config.HOUSE_SERVICE_API = 'https://uat-nginx.jianbing.com/house-service';
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;
......
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