Authored by 陈峰

Merge branch 'feature/cart' into 'release/5.4.1'

秒杀接口挂掉优化



See merge request !272
@@ -39,6 +39,10 @@ exports.ensure = (req, res, next) => { @@ -39,6 +39,10 @@ exports.ensure = (req, res, next) => {
39 uid 39 uid
40 }; 40 };
41 let skillData = yield seckillModel.skillData(skn); // 根据skn查活动信息 41 let skillData = yield seckillModel.skillData(skn); // 根据skn查活动信息
  42 + let view = {
  43 + orderEnsure: false,
  44 + message: ''
  45 + };
42 46
43 skillData = skillData.data; 47 skillData = skillData.data;
44 48
@@ -51,7 +55,15 @@ exports.ensure = (req, res, next) => { @@ -51,7 +55,15 @@ exports.ensure = (req, res, next) => {
51 skillData && 55 skillData &&
52 skillData.secKillSku.some(obj => obj.productSku === sku) // skn has sku; 56 skillData.secKillSku.some(obj => obj.productSku === sku) // skn has sku;
53 )) { 57 )) {
54 - return Promise.reject('活动不存在'); 58 + view.message = '挤爆啦,系统繁忙';
  59 + return res.render('order-ensure', Object.assign({
  60 + module: 'cart',
  61 + page: 'seckill',
  62 + pageHeader: headerModel.setNav({
  63 + navTitle: '确认订单',
  64 + backUrl: '/product/show_' + skn + '.html'
  65 + }),
  66 + }, view));
55 } 67 }
56 68
57 paymentOption.activity_id = activityId = skillData.activityId; 69 paymentOption.activity_id = activityId = skillData.activityId;
@@ -68,7 +80,6 @@ exports.ensure = (req, res, next) => { @@ -68,7 +80,6 @@ exports.ensure = (req, res, next) => {
68 80
69 // 获取结算 数据 81 // 获取结算 数据
70 let paymentInfo = yield seckillModel.payment(paymentOption, orderInfo, orderComputerData.data); 82 let paymentInfo = yield seckillModel.payment(paymentOption, orderInfo, orderComputerData.data);
71 - let view;  
72 83
73 if (paymentInfo.code !== 200) { 84 if (paymentInfo.code !== 200) {
74 view = { 85 view = {