Authored by 郭成尧

channel-error

... ... @@ -6,6 +6,7 @@
'use strict';
const _ = require('lodash');
const headerModel = require('../../../doraemon/models/header'); // 头部model
const footerModel = require('../../../doraemon/models/footer_tab'); // 底部tab
const indexModel = require('../models/brand');
... ... @@ -27,17 +28,20 @@ exports.index = (req, res, next) => {
// title: '品牌一览 | Yoho!Buy有货 | 潮流购物逛不停',
showFooterTab: footerModel.getUrlData('category')
};
let pathWithoutParams = _.trimEnd(_.first(_.split(req.path, '?')), '/');
let pathLast = _.last(_.split(pathWithoutParams, '/'));
let pathChannel = _.first(_.split(pathLast, '-'));
let channel;
// 唤起 APP 的路径
res.locals.appPath = 'yohobuy://yohobuy.com/goapp?openby:yohobuy={"action":"go.attention","params":{"actiontype":"1"}}';
if (!req.query.channel) {
if (!pathChannel) {
channel = '1';
} else if (!typeLib.channels[req.query.channel]) {
} else if (!typeLib.channels[pathChannel]) {
channel = req.query.channel;
} else {
channel = typeLib.channels[req.query.channel] + '';
channel = typeLib.channels[pathChannel] + '';
}
let param = {
... ...
... ... @@ -26,7 +26,7 @@ router.get('/(:channel)/bottomBanner', channel.bottomBanner);
router.get('/cate', cate.index);
router.get('/brands', rewrite.channel, brandController.indexRedirect); // 品牌首页
router.get(/^\/(.*?)-brands/, rewrite.resolve, brandController.index); // 品牌首页 SEO优化
router.get(/^\/(.*?)-brands/, brandController.index); // 品牌首页 SEO优化
router.get('/brands/search', brandController.search); // 品牌搜索页
router.get('/brands/getBrandList', brandController.brandList); // 获取品牌列表
router.post('/brands/searchAsync', brandController.searchAsync); // 品牌搜索异步数据
... ...