router.js 3.86 KB
/**
 * router of sub app cart
 * @author: xuan.chen@yoho.cn<xuan.chen@yoho.cn>
 * @date: 2016/09/26
 */

'use strict';

const router = require('express').Router(); //eslint-disable-line
const cRoot = './controllers';
const authMW = require('../../doraemon/middleware/auth');

const seckill = require(cRoot + '/seckill');
const order = require(cRoot + '/order');
const countController = require(`${cRoot}/count`);
const payController = require(`${cRoot}/pay`);
const indexController = require(`${cRoot}/index`);
const ticketsConfirmController = require(`${cRoot}/ticketsConfirm`);

// Your controller here
router.all('/index/seckill/', authMW);
router.all('/index/seckill/*', authMW);
router.get('/index/seckill/', seckill.ensure);
router.post('/index/seckill/compute', seckill.compute);
router.post('/index/seckill/submit', seckill.submit);

router.get('/index/count', countController.cartCount);
router.get('/paySuccess/payCod', payController.payCod);// 支付成功,货到付款
router.get('/shopping/pay/aliwapreturn', payController.payAli);// 支付成功,支付宝付款
router.get('/shopping/pay/payZero', payController.payZero);// 支付成功,支付为0

router.get('/index/new/pay', authMW, payController.pay);// 统一支付 URL,支持微信,支付宝
router.get('/index/new/pay/alipayresult', authMW, payController.payAli);// 支付宝付款支付成功

router.get('/index/new/orderEnsure', authMW, order.orderEnsure); // 订单结算
router.post('/index/new/orderCompute', authMW, order.orderCompute); // 结算页参数改变,重新运算
router.post('/index/new/orderSub', authMW, order.orderSub); // 结算页参数改变,重新运算
router.get('/index/new/selectCoupon', authMW, order.selectCoupon); // 选择优惠券 页面
router.get('/index/new/couponList', order.couponList); // [ajax]获取优惠券列表
router.post('/index/new/couponSearch', order.couponSearch); // [ajax]购物车输入优惠券码使用优惠券
router.get('/index/new/selectAddress', authMW, order.selectAddress); // 选择地址
router.get('/index/new/invoiceInfo', authMW, order.invoiceInfo); // 发票信息
router.get('/index/new/jitDetail', authMW, order.jitDetail); // JIT 拆单配送信息

router.post('/index/add', indexController.add); // 加入购物车

router.get('/index/index', indexController.index); // 购物车 TODO: 删除

router.get('/index/new', indexController.index); // 购物车(新版接口)
router.post('/index/new/data', indexController.indexData); // 购物车
router.post('/index/new/select', indexController.select); // 选择取消购物车商品
router.post('/index/new/del', indexController.del); // 删除购物车商品
router.post('/index/new/col', indexController.col); // 删除购物车商品
router.post('/index/new/goodinfo', indexController.goodinfo); // 获取购物车商品数据,chosepanel
router.post('/index/new/modifyNum', indexController.modifyNum); // 修改购物车商品数量
router.post('/index/new/modify', indexController.modify); // 修改购物车商品数据
router.post('/index/new/modifyPriceGift', indexController.modifyPriceGift); // 修改购物车赠品、加价购商品数据
router.get('/index/new/gift', indexController.gift); // 获取购物车赠品
router.get('/index/new/advanceBuy', indexController.advanceBuy); // 获取购物车加价购
router.post('/index/new/giftinfo', indexController.giftinfo); // 获取购物车加价购商品数据,chosepanel


// 支付中心 URL,由于微信安全限制,在现有 URL 后追加 new ,通过 subDomain 中间件转发到此
router.get('/home/orders/paynew', authMW, payController.payCenter);

// 门票确认
router.post('/index/ticketsConfirm', authMW, ticketsConfirmController.ticketsConfirm);

// 门票下单
router.post('/index/submitTicket', ticketsConfirmController.submitTicket);

// 添加门票
router.post('/index/checkTickets', ticketsConfirmController.checkTickets);

module.exports = router;