Authored by Aiden Xu

延长超时时间

@@ -12,6 +12,7 @@ const api = global.yoho.API; @@ -12,6 +12,7 @@ const api = global.yoho.API;
12 const serviceAPI = global.yoho.ServiceAPI; 12 const serviceAPI = global.yoho.ServiceAPI;
13 const logger = global.yoho.logger; 13 const logger = global.yoho.logger;
14 const camelCase = global.yoho.camelCase; 14 const camelCase = global.yoho.camelCase;
  15 +const API_TIMEOUT = 10000;
15 16
16 // 处理还款列表数据 17 // 处理还款列表数据
17 const _processAmtList = (listData, queryDays) => { 18 const _processAmtList = (listData, queryDays) => {
@@ -189,6 +190,8 @@ const getStauts = (uid) => { @@ -189,6 +190,8 @@ const getStauts = (uid) => {
189 return api.get('', { 190 return api.get('', {
190 method: 'user.instalment.getStatus', 191 method: 'user.instalment.getStatus',
191 uid: uid 192 uid: uid
  193 + }, {
  194 + timeout: API_TIMEOUT
192 }).then((result) => { 195 }).then((result) => {
193 if (result && result.code === 200) { 196 if (result && result.code === 200) {
194 return result.data.status; 197 return result.data.status;
@@ -204,6 +207,8 @@ const getQueryCreditInfo = (uid) => { @@ -204,6 +207,8 @@ const getQueryCreditInfo = (uid) => {
204 return api.get('', { 207 return api.get('', {
205 method: 'user.instalment.queryCreditLimit', 208 method: 'user.instalment.queryCreditLimit',
206 uid: uid 209 uid: uid
  210 + }, {
  211 + timeout: API_TIMEOUT
207 }).then((result) => { 212 }).then((result) => {
208 if (result && result.code === 200) { 213 if (result && result.code === 200) {
209 return result.data; 214 return result.data;
@@ -219,6 +224,8 @@ const getQueryAmtInfo = (uid) => { @@ -219,6 +224,8 @@ const getQueryAmtInfo = (uid) => {
219 return api.get('', { 224 return api.get('', {
220 method: 'app.order.queryAmtInfo', 225 method: 'app.order.queryAmtInfo',
221 uid: uid 226 uid: uid
  227 + }, {
  228 + timeout: API_TIMEOUT
222 }).then((result) => { 229 }).then((result) => {
223 if (result && result.code === 200) { 230 if (result && result.code === 200) {
224 result.data.dayAmt = result.data.s_7daysAmt; 231 result.data.dayAmt = result.data.s_7daysAmt;
@@ -237,7 +244,7 @@ const getQueryAmtList = (params) => { @@ -237,7 +244,7 @@ const getQueryAmtList = (params) => {
237 method: 'app.order.queryAmtList', 244 method: 'app.order.queryAmtList',
238 pageSize: '20' 245 pageSize: '20'
239 }, params), { 246 }, params), {
240 - cache: true 247 + timeout: API_TIMEOUT
241 }).then((result) => { 248 }).then((result) => {
242 if (result && result.code === 200) { 249 if (result && result.code === 200) {
243 return _processAmtList(result.data, params.queryDays); 250 return _processAmtList(result.data, params.queryDays);
@@ -256,7 +263,8 @@ const getSearchIntallment = (params) => { @@ -256,7 +263,8 @@ const getSearchIntallment = (params) => {
256 order: 's_t_desc', 263 order: 's_t_desc',
257 page: params.page 264 page: params.page
258 }, { 265 }, {
259 - cache: true 266 + cache: true,
  267 + timeout: API_TIMEOUT
260 }).then((result) => { 268 }).then((result) => {
261 if (result && result.code === 200) { 269 if (result && result.code === 200) {
262 let goods = productProcess.processProductList(result.data.product_list); 270 let goods = productProcess.processProductList(result.data.product_list);
@@ -285,6 +293,8 @@ const sendVerifyCode = (uid, mobile) => { @@ -285,6 +293,8 @@ const sendVerifyCode = (uid, mobile) => {
285 uid: uid, 293 uid: uid,
286 mobile: mobile, 294 mobile: mobile,
287 codeType: 1 // 授信 295 codeType: 1 // 授信
  296 + }, {
  297 + timeout: API_TIMEOUT
288 }); 298 });
289 }; 299 };
290 300
@@ -304,7 +314,9 @@ const activateService = (params) => { @@ -304,7 +314,9 @@ const activateService = (params) => {
304 return api.get('', Object.assign({ 314 return api.get('', Object.assign({
305 method: 'user.instalment.activate', 315 method: 'user.instalment.activate',
306 debug: 'XYZ' // TODO: remove this 316 debug: 'XYZ' // TODO: remove this
307 - }, params)); 317 + }, params), {
  318 + timeout: API_TIMEOUT
  319 + });
308 }; 320 };
309 321
310 /** 322 /**
@@ -319,6 +331,8 @@ const getBankInfo = (params) => { @@ -319,6 +331,8 @@ const getBankInfo = (params) => {
319 method: 'user.instalment.getBankInfoByCardNo', 331 method: 'user.instalment.getBankInfoByCardNo',
320 cardNo: params.cardNo, 332 cardNo: params.cardNo,
321 uid: params.uid 333 uid: params.uid
  334 + }, {
  335 + timeout: API_TIMEOUT
322 }); 336 });
323 }; 337 };
324 338
@@ -343,6 +357,8 @@ const getInstallmentOrders = (params) => { @@ -343,6 +357,8 @@ const getInstallmentOrders = (params) => {
343 page: params.page || 1, 357 page: params.page || 1,
344 limit: params.limit || 10, 358 limit: params.limit || 10,
345 debug: 'XYZ' 359 debug: 'XYZ'
  360 + }, {
  361 + timeout: API_TIMEOUT
346 }).then((result) => { 362 }).then((result) => {
347 return Promise.resolve(camelCase(result)); 363 return Promise.resolve(camelCase(result));
348 }); 364 });
@@ -357,7 +373,7 @@ const getQueryRePayList = (params) => { @@ -357,7 +373,7 @@ const getQueryRePayList = (params) => {
357 method: 'app.order.queryRePayList', 373 method: 'app.order.queryRePayList',
358 pageSize: '20' 374 pageSize: '20'
359 }, params), { 375 }, params), {
360 - cache: true 376 + timeout: API_TIMEOUT
361 }).then((result) => { 377 }).then((result) => {
362 if (result && result.code === 200) { 378 if (result && result.code === 200) {
363 return _processRepayList(result.data); 379 return _processRepayList(result.data);
@@ -374,7 +390,7 @@ const getBankCards = (uid) => { @@ -374,7 +390,7 @@ const getBankCards = (uid) => {
374 method: 'user.instalment.getBankCards', 390 method: 'user.instalment.getBankCards',
375 uid: uid 391 uid: uid
376 }, { 392 }, {
377 - cache: true 393 + timeout: API_TIMEOUT
378 }).then((result) => { 394 }).then((result) => {
379 if (result && result.code === 200) { 395 if (result && result.code === 200) {
380 return _processBankCards(result.data); 396 return _processBankCards(result.data);
@@ -401,6 +417,8 @@ const getInstallmentOrderDetail = (params) => { @@ -401,6 +417,8 @@ const getInstallmentOrderDetail = (params) => {
401 uid: params.uid, 417 uid: params.uid,
402 order_code: params.orderCode, 418 order_code: params.orderCode,
403 debug: 'XYZ' 419 debug: 'XYZ'
  420 + }, {
  421 + timeout: API_TIMEOUT
404 }).then((result)=> { 422 }).then((result)=> {
405 return Promise.resolve(camelCase(result)); 423 return Promise.resolve(camelCase(result));
406 }); 424 });
@@ -420,6 +438,8 @@ const totalAmount = (params) => { @@ -420,6 +438,8 @@ const totalAmount = (params) => {
420 method: method, 438 method: method,
421 prices: params, 439 prices: params,
422 debug: 'XYZ' 440 debug: 'XYZ'
  441 + }, {
  442 + timeout: API_TIMEOUT
423 }).then((result)=> { 443 }).then((result)=> {
424 return Promise.resolve(camelCase(result)); 444 return Promise.resolve(camelCase(result));
425 }); 445 });
@@ -435,6 +455,8 @@ const checkVerifyCode = (uid, mobile, code) => { @@ -435,6 +455,8 @@ const checkVerifyCode = (uid, mobile, code) => {
435 mobile: mobile, 455 mobile: mobile,
436 snsCheckCode: code, 456 snsCheckCode: code,
437 debug: 'XYZ' 457 debug: 'XYZ'
  458 + }, {
  459 + timeout: API_TIMEOUT
438 }).then((result)=> { 460 }).then((result)=> {
439 return Promise.resolve(camelCase(result)); 461 return Promise.resolve(camelCase(result));
440 }); 462 });
@@ -56,7 +56,7 @@ @@ -56,7 +56,7 @@
56 "uuid": "^2.0.2", 56 "uuid": "^2.0.2",
57 "winston": "^2.2.0", 57 "winston": "^2.2.0",
58 "winston-daily-rotate-file": "^1.1.4", 58 "winston-daily-rotate-file": "^1.1.4",
59 - "yoho-node-lib": "0.0.31" 59 + "yoho-node-lib": "0.0.43"
60 }, 60 },
61 "devDependencies": { 61 "devDependencies": {
62 "autoprefixer": "^6.3.7", 62 "autoprefixer": "^6.3.7",