...
|
...
|
@@ -2,6 +2,7 @@ |
|
|
* 秒杀结算
|
|
|
*/
|
|
|
'use strict';
|
|
|
const crypto = global.yoho.crypto;
|
|
|
const co = require('bluebird').coroutine;
|
|
|
const seckillModel = require('../models/seckill');
|
|
|
const headerModel = require('../../../doraemon/models/header'); // 头部model
|
...
|
...
|
@@ -16,9 +17,9 @@ exports.ensure = (req, res, next) => { |
|
|
let orderInfo = req.cookies['order-info'];
|
|
|
|
|
|
try {
|
|
|
orderInfo = JSON.parse(req.cookies['order-info'])
|
|
|
orderInfo = JSON.parse(req.cookies['order-info']);
|
|
|
} catch (e) {
|
|
|
orderInfo = {}
|
|
|
orderInfo = {};
|
|
|
}
|
|
|
|
|
|
// require skn, sku;
|
...
|
...
|
@@ -119,18 +120,21 @@ exports.submit = (req, res, next) => { |
|
|
const uid = req.user.uid,
|
|
|
sku = req.body.sku,
|
|
|
activityId = req.body.activityId,
|
|
|
addressId = Number.parseInt(req.body.addressId, 10),
|
|
|
deliveryTime = Number.parseInt(req.body.deliveryTime, 10),
|
|
|
deliveryWay = Number.parseInt(req.body.deliveryWay, 10),
|
|
|
paymentId = Number.parseInt(req.body.paymentId, 10),
|
|
|
paymentType = Number.parseInt(req.body.paymentType, 10);
|
|
|
|
|
|
let addressId = req.body.addressId || '';
|
|
|
|
|
|
if (!req.xhr) {
|
|
|
return next(404);
|
|
|
}
|
|
|
|
|
|
if (!addressId) {
|
|
|
return res.json({code: 400, message: '请选择地址'});
|
|
|
} else {
|
|
|
addressId = Number.parseInt(crypto.decrypt(null, req.body.addressId), 10);
|
|
|
}
|
|
|
|
|
|
if ([uid, sku, activityId, addressId, deliveryTime,
|
...
|
...
|
|