router.js 2.99 KB
/**
 * router of sub app cart
 * @author: htoooth<ht.anglenx@gmail.com>
 * @date: 2016/10/19
 */

'use strict';

const router = require('express').Router(); // eslint-disable-line
const cRoot = './controllers';
const csrf = require(`${global.middleware}/csrf`);
const auth = require(`${global.middleware}/auth`);

const cart = require(`${cRoot}/cart`);
const address = require(`${cRoot}/address`);
const easypay = require(`${cRoot}/easypay`);
const ensure = require(`${cRoot}/order-ensure`);
const ticket = require(`${cRoot}/ticket`);

router.get('/index/getProductInfo', cart.getProductInfo);
router.post('/cart/detailAdd', auth, cart.cartAddIndex); // 加入购物车 商品详情页

router.get('/coupon/list', cart.getCoupons); // 优惠券列表

router.get('/address/list', address.getList); // 省市区列表信息
router.get('/address/area', address.getArea); // 省市区列表信息
router.post('/address/delete', csrf, address.delAddress); // 删除地址
router.post('/address/save', csrf, address.saveAddress); // 新增地址/更新地址
router.post('/address/setdefault', csrf, address.setDefault); // 设置默认地址

router.get('/ensure', auth, csrf, ensure.index); // 限购商品快捷结算页
router.get('/ensure/coupons', auth, ensure.getCoupons); // 结算优惠券列表
router.get('/ensure/giftcards', auth, ensure.getGiftCards); // 结算礼品卡列表
router.get('/ensure/couponcode', auth, ensure.convertCoupons); // 优惠码兑换券
router.post('/ensure/compute', auth, ensure.compute); // 价格重新计算
router.post('/ensure/submit', auth, csrf, ensure.submitCheck, ensure.submit); // 订单提交
router.post('/property/checksms', ensure.sendCheckSms); // 虚拟资产使用校验

router.get('/easypay', auth, easypay.index); // 限购商品快捷结算页
router.post('/easypay/compute', auth, easypay.compute); // 价格重新计算
router.post('/easypay/submit', auth, easypay.submit); // 限购商品订单提交

router.get('/ticketEnsure', auth, ticket.ticketEnsure);
router.post('/ticketSubmit', auth, ensure.submitCheck, ticket.ticketSubmit);
router.post('/ticketCompute', auth, ticket.ticketCompute);

router.get('/cart', cart.cart);
router.post('/cart/select', cart.selectProduct);
router.post('/cart/modifyNum', cart.modifyProductNum);
router.post('/cart/add', auth, cart.cartAdd);
router.post('/cart/updateProduct', cart.modifyProduct);
router.post('/cart/remove', cart.removeProduct);
router.post('/cart/fav', cart.moveToFav);
router.post('/cart/checkFav', cart.checkFav);
router.get('/cart/getProductData', cart.getProductData);
router.post('/cart/swapGift', cart.swapGift);
router.get('/cart/queryPromotionGift', cart.queryUserPromotionGift);
router.get('/cart/togetherProduct', cart.getTogetherProduct);
router.get('/cart/recommendProduct', cart.getRecommendProductAction);
router.get('/cart/minicart', cart.miniCart);
router.get('/cart/del', cart.delCartGoods);
router.post('/cart/addBundle', auth, cart.addBundle);
router.post('/cart/piece/product', auth, cart.addBundle);


module.exports = router;