router.js
1.21 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
/**
* router of sub app brands
* @author: ghw<hongwei.gao@yoho.cn>
* @date: 2016/09/29
*/
'use strict';
const express = require('express');
const cRoot = './controllers';
const router = express.Router(); // eslint-disable-line
const brandsController = require(`${cRoot}/brands`);
// 品牌一览
router.get('/brands', brandsController.index); // 暂时保留
router.get(/\/(boys|girls|kids|lifestyle)-brands(\/)?$/,
function(req, res, next) {
req.query.channel = req.params[0];
if (req.query.channel === 'kids') {
req.query.msort = 365;
}
next();
}, brandsController.index);
// 悬浮出现品牌信息
router.get('/brands/brandinfo', brandsController.brandInfo);
// 品牌没有加载完全,继续加载
router.post('/brands/brandList', brandsController.brandList);
// brands/plusstar 暂时保留
router.get('/brands/plusstar', brandsController.plusstarList);
// seo plusstar
router.get(/\/(boys|girls|kids|lifestyle)-brands\/plusstar\/id(\d*)-p(\d*)\/?/, function(req, res, next) {
req.query.channel = req.params[0];
req.query.id = req.params[1];
req.query.page = req.params[2];
next();
}, brandsController.plusstarList);
module.exports = router;