...
|
...
|
@@ -9,7 +9,6 @@ const productProcess = require(`${utils}/product-process`); |
|
|
const resourcesProcess = require(`${utils}/resources-process`);
|
|
|
const _ = require('lodash');
|
|
|
const helpers = global.yoho.helpers;
|
|
|
const api = global.yoho.API;
|
|
|
const serviceAPI = global.yoho.ServiceAPI;
|
|
|
const logger = global.yoho.logger;
|
|
|
const stringProcess = require(`${global.utils}/string-process`);
|
...
|
...
|
@@ -19,7 +18,8 @@ const codeContent = { |
|
|
openY: 'c233ad4ca91fef45ed7d0b26d9953e61',
|
|
|
advertisement: 'f3fe0793a7d59479542a14b15359c47d'
|
|
|
};
|
|
|
|
|
|
const response = require('./response.json');
|
|
|
const _DEBUG = false;// true;
|
|
|
|
|
|
// 处理还款列表数据
|
|
|
const _processAmtList = (listData, queryDays) => {
|
...
|
...
|
@@ -29,7 +29,6 @@ const _processAmtList = (listData, queryDays) => { |
|
|
currFeeCount: 0
|
|
|
};
|
|
|
|
|
|
|
|
|
if (listData !== 'NULL') {
|
|
|
let list = listData.amtList;
|
|
|
|
...
|
...
|
@@ -175,410 +174,445 @@ const _processCardDetail = (list) => { |
|
|
return list;
|
|
|
};
|
|
|
|
|
|
/**
|
|
|
* 获取资源位数据
|
|
|
* @return {[array]}
|
|
|
*/
|
|
|
const getResources = (code) => {
|
|
|
return serviceAPI.get('/operations/api/v5/resource/get', {
|
|
|
content_code: codeContent[code],
|
|
|
platform: 'iphone'
|
|
|
}, {
|
|
|
cache: true
|
|
|
}).then((result) => {
|
|
|
if (result && result.code === 200) {
|
|
|
return resourcesProcess(result.data);
|
|
|
} else {
|
|
|
logger.error('get resources data return code is not 200');
|
|
|
return [];
|
|
|
}
|
|
|
});
|
|
|
};
|
|
|
module.exports = class extends global.yoho.BaseModel {
|
|
|
constructor(ctx) {
|
|
|
super(ctx);
|
|
|
}
|
|
|
|
|
|
const response = require('./response.json');
|
|
|
const _DEBUG = false;// true;
|
|
|
/**
|
|
|
* 获取资源位数据
|
|
|
* @return {[array]}
|
|
|
*/
|
|
|
getResources(code) {
|
|
|
return this.get({
|
|
|
api: serviceAPI,
|
|
|
url: '/operations/api/v5/resource/get',
|
|
|
data: {
|
|
|
content_code: codeContent[code],
|
|
|
platform: 'iphone'
|
|
|
},
|
|
|
param: {
|
|
|
cache: true
|
|
|
}
|
|
|
}).then((result) => {
|
|
|
if (result && result.code === 200) {
|
|
|
return resourcesProcess(result.data);
|
|
|
} else {
|
|
|
logger.error('get resources data return code is not 200');
|
|
|
return [];
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
|
|
|
// 获取分期开通状态
|
|
|
const getStauts = (uid) => {
|
|
|
return api.get('', {
|
|
|
method: 'user.instalment.getStatus',
|
|
|
uid: uid
|
|
|
}, {
|
|
|
timeout: API_TIMEOUT
|
|
|
}).then((result) => {
|
|
|
if (result && result.code === 200) {
|
|
|
return result.data.status;
|
|
|
} else {
|
|
|
logger.error(`get installment open status return code is not 200,uid:${uid},result=${JSON.stringify(result)}`); // eslint-disable-line
|
|
|
return Promise.reject(result);
|
|
|
}
|
|
|
});
|
|
|
};
|
|
|
// 获取分期开通状态
|
|
|
getStauts(uid) {
|
|
|
return this.get({
|
|
|
data: {
|
|
|
method: 'user.instalment.getStatus',
|
|
|
uid: uid
|
|
|
},
|
|
|
param: {
|
|
|
timeout: API_TIMEOUT
|
|
|
}
|
|
|
}).then((result) => {
|
|
|
if (result && result.code === 200) {
|
|
|
return result.data.status;
|
|
|
} else {
|
|
|
logger.error(`get installment open status return code is not 200,uid:${uid},result=${JSON.stringify(result)}`); // eslint-disable-line
|
|
|
return Promise.reject(result);
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
|
|
|
// 获取用户可用额度信息
|
|
|
const getQueryCreditInfo = (uid) => {
|
|
|
return api.get('', {
|
|
|
method: 'user.instalment.queryCreditLimit',
|
|
|
uid: uid
|
|
|
}, {
|
|
|
timeout: API_TIMEOUT
|
|
|
}).then((result) => {
|
|
|
if (result && result.code === 200) {
|
|
|
return result.data;
|
|
|
} else {
|
|
|
logger.error('get user installment usable price info return code is not 200');
|
|
|
return Promise.reject(result);
|
|
|
}
|
|
|
});
|
|
|
};
|
|
|
// 获取用户可用额度信息
|
|
|
getQueryCreditInfo(uid) {
|
|
|
return this.get({
|
|
|
data: {
|
|
|
method: 'user.instalment.queryCreditLimit',
|
|
|
uid: uid
|
|
|
},
|
|
|
param: {
|
|
|
timeout: API_TIMEOUT
|
|
|
}
|
|
|
}).then((result) => {
|
|
|
if (result && result.code === 200) {
|
|
|
return result.data;
|
|
|
} else {
|
|
|
logger.error('get user installment usable price info return code is not 200');
|
|
|
return Promise.reject(result);
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
|
|
|
// 获取用户待还款金额
|
|
|
const getQueryAmtInfo = (uid) => {
|
|
|
return api.get('', {
|
|
|
method: 'app.order.queryAmtInfo',
|
|
|
uid: uid
|
|
|
}, {
|
|
|
timeout: API_TIMEOUT
|
|
|
}).then((result) => {
|
|
|
if (result && result.code === 200) {
|
|
|
result.data.dayAmt = result.data.s_7daysAmt;
|
|
|
return result.data;
|
|
|
} else {
|
|
|
logger.error('get user installment repay info return code is not 200');
|
|
|
return Promise.reject(result);
|
|
|
}
|
|
|
});
|
|
|
};
|
|
|
// 获取用户待还款金额
|
|
|
getQueryAmtInfo(uid) {
|
|
|
return this.get({
|
|
|
data: {
|
|
|
method: 'app.order.queryAmtInfo',
|
|
|
uid: uid
|
|
|
},
|
|
|
param: {
|
|
|
timeout: API_TIMEOUT
|
|
|
}
|
|
|
}).then((result) => {
|
|
|
if (result && result.code === 200) {
|
|
|
result.data.dayAmt = result.data.s_7daysAmt;
|
|
|
return result.data;
|
|
|
} else {
|
|
|
logger.error('get user installment repay info return code is not 200');
|
|
|
return Promise.reject(result);
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
|
|
|
// 获取用户待还列表信息 queryDays -1:逾期待还;0:全部待还;7:七日待还;30:本月待还
|
|
|
getQueryAmtList(params) {
|
|
|
return this.get({
|
|
|
data: _.assign({
|
|
|
method: 'app.order.queryAmtList',
|
|
|
pageSize: '20'
|
|
|
}, params),
|
|
|
param: {
|
|
|
timeout: API_TIMEOUT
|
|
|
}
|
|
|
}).then((result) => {
|
|
|
if (result && result.code === 200) {
|
|
|
return _processAmtList(result.data, params.queryDays);
|
|
|
} else {
|
|
|
logger.error('get queryAmtList data return code is not 200');
|
|
|
return Promise.reject(result);
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
|
|
|
// 获取用户待还列表信息 queryDays -1:逾期待还;0:全部待还;7:七日待还;30:本月待还
|
|
|
const getQueryAmtList = (params) => {
|
|
|
return api.get('', _.assign({
|
|
|
method: 'app.order.queryAmtList',
|
|
|
pageSize: '20'
|
|
|
}, params), {
|
|
|
timeout: API_TIMEOUT
|
|
|
}).then((result) => {
|
|
|
if (result && result.code === 200) {
|
|
|
return _processAmtList(result.data, params.queryDays);
|
|
|
} else {
|
|
|
logger.error('get queryAmtList data return code is not 200');
|
|
|
return Promise.reject(result);
|
|
|
}
|
|
|
});
|
|
|
};
|
|
|
// 分期专享推荐商品
|
|
|
getSearchIntallment(params) {
|
|
|
return this.get({
|
|
|
data: {
|
|
|
method: 'app.search.recInstal',
|
|
|
uid: params.uid
|
|
|
},
|
|
|
param: {
|
|
|
cache: true,
|
|
|
timeout: API_TIMEOUT
|
|
|
}
|
|
|
}).then((result) => {
|
|
|
if (result && result.code === 200) {
|
|
|
let goods = productProcess.processProductList(result.data.product_list);
|
|
|
|
|
|
// 分期专享推荐商品
|
|
|
const getSearchIntallment = (params) => {
|
|
|
return api.post('', {
|
|
|
method: 'app.search.recInstal',
|
|
|
uid: params.uid
|
|
|
}, {
|
|
|
cache: true,
|
|
|
timeout: API_TIMEOUT
|
|
|
}).then((result) => {
|
|
|
if (result && result.code === 200) {
|
|
|
let goods = productProcess.processProductList(result.data.product_list);
|
|
|
|
|
|
_.forEach(goods, (data) => {
|
|
|
data.url = helpers.appUrlFormat(data.url, 'go.productDetail', {
|
|
|
product_skn: data.product_skn
|
|
|
_.forEach(goods, (data) => {
|
|
|
data.url = helpers.appUrlFormat(data.url, 'go.productDetail', {
|
|
|
product_skn: data.product_skn
|
|
|
});
|
|
|
});
|
|
|
});
|
|
|
|
|
|
return goods;
|
|
|
} else {
|
|
|
logger.error('get instalment promote goods return code is not 200');
|
|
|
return Promise.reject(result);
|
|
|
}
|
|
|
});
|
|
|
};
|
|
|
|
|
|
/**
|
|
|
* 获取短信验证码
|
|
|
*
|
|
|
* @param uid 用户ID
|
|
|
* @param mobile 手机号码
|
|
|
*/
|
|
|
const sendVerifyCode = (uid, mobile) => {
|
|
|
return api.get('', {
|
|
|
method: 'user.instalment.getSnsCheckCode',
|
|
|
uid: uid,
|
|
|
mobile: mobile,
|
|
|
codeType: 1 // 授信
|
|
|
}, {
|
|
|
timeout: API_TIMEOUT
|
|
|
});
|
|
|
};
|
|
|
|
|
|
/**
|
|
|
* 开通服务
|
|
|
*
|
|
|
* @param 参数
|
|
|
* uid 用户id
|
|
|
* userName 姓名
|
|
|
* identityCardNo 身份证号码
|
|
|
* cardNo 银行卡号码
|
|
|
* mobile 手机号码
|
|
|
* snsCheckCode 验证码
|
|
|
* @returns {*}
|
|
|
*/
|
|
|
const activateService = (params) => {
|
|
|
return api.get('', Object.assign({
|
|
|
method: 'user.instalment.activate'
|
|
|
}, params), {
|
|
|
timeout: 30000
|
|
|
});
|
|
|
};
|
|
|
return goods;
|
|
|
} else {
|
|
|
logger.error('get instalment promote goods return code is not 200');
|
|
|
return Promise.reject(result);
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 获取银行信息
|
|
|
*
|
|
|
* @param cardNo
|
|
|
* @param uid
|
|
|
* @returns {*}
|
|
|
*/
|
|
|
const getBankInfo = (params) => {
|
|
|
return api.get('', {
|
|
|
method: 'user.instalment.getBankInfoByCardNo',
|
|
|
cardNo: params.cardNo,
|
|
|
uid: params.uid
|
|
|
}, {
|
|
|
timeout: API_TIMEOUT
|
|
|
});
|
|
|
};
|
|
|
/**
|
|
|
* 获取短信验证码
|
|
|
*
|
|
|
* @param uid 用户ID
|
|
|
* @param mobile 手机号码
|
|
|
*/
|
|
|
sendVerifyCode(uid, mobile) {
|
|
|
return this.get({
|
|
|
data: {
|
|
|
method: 'user.instalment.getSnsCheckCode',
|
|
|
uid: uid,
|
|
|
mobile: mobile,
|
|
|
codeType: 1 // 授信
|
|
|
},
|
|
|
param: {
|
|
|
timeout: API_TIMEOUT
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 分期订单列表
|
|
|
*
|
|
|
* @params 参数
|
|
|
* uid
|
|
|
* type 订单类型 1:全部订单,2:还款中,3:已还清
|
|
|
* page 页数
|
|
|
* limit
|
|
|
* @returns {*}
|
|
|
*/
|
|
|
const getInstallmentOrders = (params) => {
|
|
|
const method = 'app.SpaceOrders.getInstallment';
|
|
|
|
|
|
if (!_DEBUG) {
|
|
|
return api.get('', {
|
|
|
method: method,
|
|
|
uid: params.uid,
|
|
|
type: params.type || 1,
|
|
|
page: params.page || 1,
|
|
|
limit: params.limit || 10
|
|
|
}, {
|
|
|
timeout: API_TIMEOUT
|
|
|
}).then((result) => {
|
|
|
return Promise.resolve(result);
|
|
|
/**
|
|
|
* 开通服务
|
|
|
*
|
|
|
* @param 参数
|
|
|
* uid 用户id
|
|
|
* userName 姓名
|
|
|
* identityCardNo 身份证号码
|
|
|
* cardNo 银行卡号码
|
|
|
* mobile 手机号码
|
|
|
* snsCheckCode 验证码
|
|
|
* @returns {*}
|
|
|
*/
|
|
|
activateService(params) {
|
|
|
return this.get({
|
|
|
data: Object.assign({
|
|
|
method: 'user.instalment.activate'
|
|
|
}, params),
|
|
|
param: {
|
|
|
timeout: 30000
|
|
|
}
|
|
|
});
|
|
|
} else {
|
|
|
return Promise.resolve(response[method]);
|
|
|
}
|
|
|
};
|
|
|
|
|
|
// 还款记录查询
|
|
|
const getQueryRePayList = (params) => {
|
|
|
return api.get('', _.assign({
|
|
|
method: 'app.order.queryRePayList',
|
|
|
pageSize: '20'
|
|
|
}, params), {
|
|
|
timeout: API_TIMEOUT
|
|
|
}).then((result) => {
|
|
|
if (result && result.code === 200) {
|
|
|
return _processRepayList(result.data);
|
|
|
} else {
|
|
|
logger.error('get queryRePayList data return code is not 200');
|
|
|
return {};
|
|
|
}
|
|
|
});
|
|
|
};
|
|
|
/**
|
|
|
* 获取银行信息
|
|
|
*
|
|
|
* @param cardNo
|
|
|
* @param uid
|
|
|
* @returns {*}
|
|
|
*/
|
|
|
getBankInfo(params) {
|
|
|
return this.get({
|
|
|
data: {
|
|
|
method: 'user.instalment.getBankInfoByCardNo',
|
|
|
cardNo: params.cardNo,
|
|
|
uid: params.uid
|
|
|
},
|
|
|
param: {
|
|
|
timeout: API_TIMEOUT
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
|
|
|
// 账号管理
|
|
|
const getBankCards = (uid) => {
|
|
|
return api.get('', {
|
|
|
method: 'user.instalment.getBankCards',
|
|
|
uid: uid
|
|
|
}, {
|
|
|
timeout: API_TIMEOUT
|
|
|
}).then((result) => {
|
|
|
if (result && result.code === 200) {
|
|
|
return _processBankCards(result.data);
|
|
|
/**
|
|
|
* 分期订单列表
|
|
|
*
|
|
|
* @params 参数
|
|
|
* uid
|
|
|
* type 订单类型 1:全部订单,2:还款中,3:已还清
|
|
|
* page 页数
|
|
|
* limit
|
|
|
* @returns {*}
|
|
|
*/
|
|
|
getInstallmentOrders(params) {
|
|
|
const method = 'app.SpaceOrders.getInstallment';
|
|
|
|
|
|
if (!_DEBUG) {
|
|
|
return this.get({
|
|
|
data: {
|
|
|
method: method,
|
|
|
uid: params.uid,
|
|
|
type: params.type || 1,
|
|
|
page: params.page || 1,
|
|
|
limit: params.limit || 10
|
|
|
},
|
|
|
param: {
|
|
|
timeout: API_TIMEOUT
|
|
|
}
|
|
|
}).then((result) => {
|
|
|
return Promise.resolve(result);
|
|
|
});
|
|
|
} else {
|
|
|
logger.error('get getBankCards data return code is not 200');
|
|
|
return '';
|
|
|
return Promise.resolve(response[method]);
|
|
|
}
|
|
|
});
|
|
|
};
|
|
|
|
|
|
/**
|
|
|
* 获取订单号
|
|
|
*
|
|
|
* @param 参数
|
|
|
* orderCode 订单号
|
|
|
*
|
|
|
* @returns {*}
|
|
|
*/
|
|
|
const getInstallmentOrderDetail = (params) => {
|
|
|
const method = 'app.SpaceOrders.installDetail';
|
|
|
}
|
|
|
|
|
|
if (!params.uid || !params.orderCode || !stringProcess.isNumeric(params.orderCode)) {
|
|
|
return Promise.resolve({});
|
|
|
// 还款记录查询
|
|
|
getQueryRePayList(params) {
|
|
|
return this.get({
|
|
|
data: _.assign({
|
|
|
method: 'app.order.queryRePayList',
|
|
|
pageSize: '20'
|
|
|
}, params),
|
|
|
param: {
|
|
|
timeout: API_TIMEOUT
|
|
|
}
|
|
|
}).then((result) => {
|
|
|
if (result && result.code === 200) {
|
|
|
return _processRepayList(result.data);
|
|
|
} else {
|
|
|
logger.error('get queryRePayList data return code is not 200');
|
|
|
return {};
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
|
|
|
return api.get('', {
|
|
|
method: method,
|
|
|
uid: params.uid,
|
|
|
order_code: params.orderCode
|
|
|
}, {
|
|
|
timeout: API_TIMEOUT
|
|
|
}).then((result)=> {
|
|
|
return Promise.resolve(result);
|
|
|
});
|
|
|
};
|
|
|
// 账号管理
|
|
|
getBankCards(uid) {
|
|
|
return this.get({
|
|
|
data: {
|
|
|
method: 'user.instalment.getBankCards',
|
|
|
uid: uid
|
|
|
},
|
|
|
param: {
|
|
|
timeout: API_TIMEOUT
|
|
|
}
|
|
|
}).then((result) => {
|
|
|
if (result && result.code === 200) {
|
|
|
return _processBankCards(result.data);
|
|
|
} else {
|
|
|
logger.error('get getBankCards data return code is not 200');
|
|
|
return '';
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 计算总金额
|
|
|
*
|
|
|
* @param params 金额
|
|
|
*
|
|
|
* @returns {*|Promise.<TResult>}
|
|
|
*/
|
|
|
const totalAmount = (params) => {
|
|
|
const method = 'app.order.calPrice';
|
|
|
|
|
|
return api.get('', {
|
|
|
method: method,
|
|
|
prices: params
|
|
|
}, {
|
|
|
timeout: API_TIMEOUT
|
|
|
}).then((result)=> {
|
|
|
return Promise.resolve(result);
|
|
|
});
|
|
|
};
|
|
|
/**
|
|
|
* 获取订单号
|
|
|
*
|
|
|
* @param 参数
|
|
|
* orderCode 订单号
|
|
|
*
|
|
|
* @returns {*}
|
|
|
*/
|
|
|
getInstallmentOrderDetail(params) {
|
|
|
const method = 'app.SpaceOrders.installDetail';
|
|
|
|
|
|
if (!params.uid || !params.orderCode || !stringProcess.isNumeric(params.orderCode)) {
|
|
|
return Promise.resolve({});
|
|
|
}
|
|
|
|
|
|
return this.get({
|
|
|
data: {
|
|
|
method: method,
|
|
|
uid: params.uid,
|
|
|
order_code: params.orderCode
|
|
|
},
|
|
|
param: {
|
|
|
timeout: API_TIMEOUT
|
|
|
}
|
|
|
}).then((result)=> {
|
|
|
return Promise.resolve(result);
|
|
|
});
|
|
|
}
|
|
|
|
|
|
const checkVerifyCode = (uid, mobile, code) => {
|
|
|
const method = 'user.instalment.validateSnsCheckCode';
|
|
|
/**
|
|
|
* 计算总金额
|
|
|
*
|
|
|
* @param params 金额
|
|
|
*
|
|
|
* @returns {*|Promise.<TResult>}
|
|
|
*/
|
|
|
totalAmount(params) {
|
|
|
const method = 'app.order.calPrice';
|
|
|
|
|
|
return this.get({
|
|
|
data: {
|
|
|
method: method,
|
|
|
prices: params
|
|
|
},
|
|
|
param: {
|
|
|
timeout: API_TIMEOUT
|
|
|
}
|
|
|
}).then((result)=> {
|
|
|
return Promise.resolve(result);
|
|
|
});
|
|
|
}
|
|
|
|
|
|
return api.get('', {
|
|
|
uid: uid,
|
|
|
method: method,
|
|
|
mobile: mobile,
|
|
|
snsCheckCode: code,
|
|
|
codeType: 1 // 授信
|
|
|
}, {
|
|
|
timeout: API_TIMEOUT
|
|
|
}).then((result)=> {
|
|
|
return Promise.resolve(result);
|
|
|
});
|
|
|
};
|
|
|
checkVerifyCode(uid, mobile, code) {
|
|
|
const method = 'user.instalment.validateSnsCheckCode';
|
|
|
|
|
|
return this.get({
|
|
|
data: {
|
|
|
uid: uid,
|
|
|
method: method,
|
|
|
mobile: mobile,
|
|
|
snsCheckCode: code,
|
|
|
codeType: 1 // 授信
|
|
|
},
|
|
|
param: {
|
|
|
timeout: API_TIMEOUT
|
|
|
}
|
|
|
}).then((result)=> {
|
|
|
return Promise.resolve(result);
|
|
|
});
|
|
|
}
|
|
|
|
|
|
// 添加银行卡请求
|
|
|
const postAccount = (params) => {
|
|
|
return api.get('', _.assign({
|
|
|
method: 'user.instalment.bindingCards'
|
|
|
}, params), {
|
|
|
timeout: 6000
|
|
|
});
|
|
|
};
|
|
|
// 添加银行卡请求
|
|
|
postAccount(params) {
|
|
|
return this.get({
|
|
|
data: _.assign({
|
|
|
method: 'user.instalment.bindingCards'
|
|
|
}, params),
|
|
|
param: {
|
|
|
timeout: 6000
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
|
|
|
// 获取银行卡详情
|
|
|
const getCardDetail = (uid, cardIdNo) => {
|
|
|
return api.get('', {
|
|
|
method: 'user.instalment.getBankCardDetail',
|
|
|
uid: uid,
|
|
|
cardIdNo: cardIdNo
|
|
|
}, {
|
|
|
timeout: API_TIMEOUT
|
|
|
}).then((result) => {
|
|
|
if (result && result.code === 200) {
|
|
|
return _processCardDetail(result.data);
|
|
|
} else {
|
|
|
logger.error('get getBankCards data return code is not 200');
|
|
|
return Promise.reject(result);
|
|
|
}
|
|
|
});
|
|
|
};
|
|
|
// 获取银行卡详情
|
|
|
getCardDetail(uid, cardIdNo) {
|
|
|
return this.get({
|
|
|
data: {
|
|
|
method: 'user.instalment.getBankCardDetail',
|
|
|
uid: uid,
|
|
|
cardIdNo: cardIdNo
|
|
|
},
|
|
|
param: {
|
|
|
timeout: API_TIMEOUT
|
|
|
}
|
|
|
}).then((result) => {
|
|
|
if (result && result.code === 200) {
|
|
|
return _processCardDetail(result.data);
|
|
|
} else {
|
|
|
logger.error('get getCardDetail data return code is not 200');
|
|
|
return Promise.reject(result);
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
|
|
|
// 解除银行卡绑定
|
|
|
const delBankCard = (params) => {
|
|
|
return api.get('', _.assign({
|
|
|
method: 'user.instalment.unbindCard'
|
|
|
}, params)).then((res) => {
|
|
|
return res;
|
|
|
});
|
|
|
};
|
|
|
// 解除银行卡绑定
|
|
|
delBankCard(params) {
|
|
|
return this.get({
|
|
|
data: _.assign({
|
|
|
method: 'user.instalment.unbindCard'
|
|
|
}, params)
|
|
|
});
|
|
|
}
|
|
|
|
|
|
// 切换银行卡主卡
|
|
|
const setMasterCard = (params) => {
|
|
|
return api.get('', _.assign({
|
|
|
method: 'user.instalment.toggleCard'
|
|
|
}, params)).then((res) => {
|
|
|
return res;
|
|
|
});
|
|
|
};
|
|
|
// 切换银行卡主卡
|
|
|
setMasterCard(params) {
|
|
|
return this.get({
|
|
|
data: _.assign({
|
|
|
method: 'user.instalment.toggleCard'
|
|
|
}, params)
|
|
|
});
|
|
|
}
|
|
|
|
|
|
// 公告
|
|
|
const getNotices = () => {
|
|
|
return api.get('', {
|
|
|
method: 'app.resources.getNotices',
|
|
|
position: 8
|
|
|
}, {
|
|
|
cache: true
|
|
|
}).then((res) => {
|
|
|
if (res && res.code === 200) {
|
|
|
if (res.data && res.data.list.length < 1) {
|
|
|
return false;
|
|
|
// 公告
|
|
|
getNotices() {
|
|
|
return this.get({
|
|
|
data: {
|
|
|
method: 'app.resources.getNotices',
|
|
|
position: 8
|
|
|
},
|
|
|
param: {
|
|
|
cache: true
|
|
|
}
|
|
|
}).then((res) => {
|
|
|
if (res && res.code === 200) {
|
|
|
if (res.data && res.data.list.length < 1) {
|
|
|
return false;
|
|
|
} else {
|
|
|
return res.data;
|
|
|
}
|
|
|
} else {
|
|
|
return res.data;
|
|
|
return false;
|
|
|
}
|
|
|
} else {
|
|
|
return false;
|
|
|
}
|
|
|
});
|
|
|
};
|
|
|
|
|
|
// 帮助中心
|
|
|
const getHelpDetail = (id) => {
|
|
|
return api.get('', {
|
|
|
method: 'app.helper.detail',
|
|
|
id: id
|
|
|
}, {
|
|
|
cache: true
|
|
|
}).then((result) => {
|
|
|
if (result && result.code === 200) {
|
|
|
return result.data;
|
|
|
} else {
|
|
|
return false;
|
|
|
}
|
|
|
});
|
|
|
};
|
|
|
});
|
|
|
}
|
|
|
|
|
|
module.exports = {
|
|
|
getStauts,
|
|
|
getQueryCreditInfo,
|
|
|
getQueryAmtInfo,
|
|
|
getSearchIntallment,
|
|
|
sendVerifyCode,
|
|
|
activateService,
|
|
|
getResources,
|
|
|
getQueryAmtList,
|
|
|
getQueryRePayList,
|
|
|
getBankCards,
|
|
|
getBankInfo,
|
|
|
getInstallmentOrders,
|
|
|
getInstallmentOrderDetail,
|
|
|
totalAmount,
|
|
|
checkVerifyCode,
|
|
|
postAccount,
|
|
|
getCardDetail,
|
|
|
delBankCard,
|
|
|
setMasterCard,
|
|
|
getNotices,
|
|
|
getHelpDetail
|
|
|
// 帮助中心
|
|
|
getHelpDetail(id) {
|
|
|
return this.get({
|
|
|
data: {
|
|
|
method: 'app.helper.detail',
|
|
|
id: id
|
|
|
},
|
|
|
param: {
|
|
|
cache: true
|
|
|
}
|
|
|
}).then((result) => {
|
|
|
if (result && result.code === 200) {
|
|
|
return result.data;
|
|
|
} else {
|
|
|
return false;
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
};
|
|
|
|
|
|
|
|
|
|
...
|
...
|
|