|
|
'use strict';
|
|
|
const _ = require('lodash');
|
|
|
const helpers = global.yoho.helpers;
|
|
|
const cartModel = require('../models/cart');
|
|
|
|
|
|
|
|
|
exports.orderEnsure = (req, res, next) => {
|
|
|
let uid = req.user.uid;
|
|
|
let returnUrl = helpers.urlFormat('/cart/index/new');
|
|
|
let cartType = req.query.cartType;
|
|
|
|
|
|
let orderInfo;
|
|
|
try {
|
|
|
orderInfo = JSON.parse(req.cookies['order-info']);
|
|
|
} catch (e) {
|
|
|
orderInfo = {};
|
|
|
}
|
|
|
|
|
|
// 如果传递了code, skn, sku, buy_number 就代表限购商品
|
|
|
let limitProductCode = req.query.limitproductcode || '';
|
|
|
let sku = req.query.sku || '';
|
|
|
let skn = req.query.skn || '';
|
|
|
let buyNumber = req.query.buy_number || 1;
|
|
|
|
|
|
if (limitProductCode) {
|
|
|
returnUrl = req.get('Referer') || returnUrl;
|
|
|
}
|
|
|
|
|
|
cartModel.cartPay(uid, cartType, orderInfo, limitProductCode)
|
|
|
|
|
|
res.send('todo: orderEnsure');
|
|
|
}; |
...
|
...
|
|