router.js 4.67 KB
/**
 * 管理员router
 * @author: leo <qi.li@yoho.cn>
 * @date: 23/06/2017
 */
const express = require('express');
const router = express.Router();  // eslint-disable-line
const admin = require('./controllers/admin');
const activity = require('./controllers/activity');
const user = require('./controllers/user');
const coupon = require('./controllers/coupon');
const multipart = require('connect-multiparty');
const guochao = require('./controllers/guochao');
const wheelSurf = require('./controllers/wheel-surf');
const mutilpartMiddleware = multipart();

// 管理员[page]
router.get('/login', admin.loginPage);


// 国潮排行[page]
router.get('/guochao/list', guochao.listPage);
router.get('/guochao/update', guochao.updatePage);

// 活动管理[page]
router.get('/activity/list', activity.activityListPage);
router.get('/activity/create', activity.createActivityPage);
router.get('/activity/article', activity.actArticleListPage);
router.get('/activity/createArticle', activity.createArticlePage);
router.get('/activity/createY100Article', activity.createY100ArticlePage);
router.get('/activity/y100Article', activity.actY100ArticleListPage);
router.get('/activity/upload_excel', activity.uploadExcelPage);
router.get('/activity/zerobuy', activity.zeroBuyList);
router.post('/activity/zerobuy/switch', activity.zeroBuySwitch);
router.post('/activity/zerobuy/publish', activity.zeroBuyPublish);
router.get('/activity/zerobuy/export', activity.zeroBuyExport);
router.get('/activity/zerobuy/edit', activity.zeroBuyEdit);
router.post('/activity/zerobuy/save', activity.zeroBuySave);

// 用户管理[page]
router.get('/user/list', user.userListPage);
router.get('/user/users_list', user.usersListPage);
router.get('/user/prize_users_list', user.prizeUsersListPage);

// 用户登录日志[page]
router.get('/user/login-log', user.userLoginLog);
router.get('/user/exportUserLoginLog', user.exportUserLoginLog);

// 优惠券管理[page]
router.get('/coupon/list', coupon.couponListPage);
router.get('/coupon/option', coupon.couponOptionPage);
router.get('/coupon/update', coupon.couponOptionPage);

// 管理员[ajax]
router.post('/api/login', admin.login);
router.post('/api/logout', admin.logout);

// 国潮排行[page]
router.post('/api/guochao/list', guochao.list);
router.post('/api/guochao/update', guochao.update);

// 活动管理[ajax]
router.post('/api/activity/list', activity.activityList);
router.post('/api/activity/create', activity.createActivity);
router.post('/api/activity/delete', activity.deleteActivity);

router.get('/api/activity/article', activity.actArticleList);
router.get('/api/activity/y100Article', activity.actY100ArticleList);
router.post('/api/activity/deleteArticle', activity.deleteArticle);
router.post('/api/activity/modifyArticle', activity.modifyArticle);
router.get('/api/activity/exportArticleList', activity.exportArticleList);
router.post('/api/activity/createArticle', activity.createArticle);
router.post('/api/activity/createY100Article', activity.createY100Article);

// 优惠券管理[ajax]
router.get('/api/coupon/list', coupon.couponList);
router.post('/api/coupon/modify', coupon.modifyCoupon);
router.post('/api/coupon/batchAddNo', mutilpartMiddleware, coupon.loadCouponNoList);
router.get('/api/coupon/downloadNo', coupon.downloadNoList);
router.get('/api/coupon/delete', coupon.deleteCoupon);
router.get('/api/coupon/downloadTpl', coupon.downloadTpl);

// 用户管理[ajax]
router.post('/api/user/delete', user.deleteUser);
router.post('/api/user/deleteInfoUser', user.deleteInfoUsers);
router.post('/api/user/deletePrizeUser', user.deletePrizeUsers);
router.get('/api/user/list', user.userList);
router.get('/api/user/users_list', user.usersList);
router.get('/api/user/prize_users_list', user.prizeUsersList);
router.get('/api/user/exportUserList', user.exportUserList);
router.get('/api/user/exportPrizeUserList', user.exportPrizeUserList);
router.get('/api/user/exportInfoUserList', user.exportInfoUserList);

// 大转盘活动管理
router.get('/wheelSurf', wheelSurf.entry);

router.post('/wheelSurf/api/create', wheelSurf.actCreate);
router.post('/wheelSurf/api/delete', wheelSurf.actDelete);
router.get('/wheelSurf/api/list', wheelSurf.actList);

router.post('/wheelSurf/api/config/modify', wheelSurf.configModify);
router.get('/wheelSurf/api/config/detail', wheelSurf.configFindOne);

router.get('/wheelSurf/api/prize/list', wheelSurf.prizeFindByActId);
router.post('/wheelSurf/api/prize/create', wheelSurf.prizeCreate);
router.post('/wheelSurf/api/prize/update', wheelSurf.prizeUpdate);
router.post('/wheelSurf/api/prize/userFind', wheelSurf.userFind);
router.get('/wheelSurf/api/prize/exportRecords', wheelSurf.exportRecords);


router.get('/wheelSurf/*', wheelSurf.entry);


module.exports = router;