hot.js
1.35 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
45
46
47
'use strict';
const css = require('../css');
const mRoot = '../models';
const listModel = require(`${mRoot}/hot`);
const co = require('bluebird').coroutine;
exports.index = (req, res, next) => {
co(function* () {
let params = {
page: 1,
limit: 100,
sales: 'Y',
outlets: 2,
stocknumber: 1,
need_filter: 'no',
type: 'default',
order: 's_t_desc',
id: req.params.id
};
let list = yield req.ctx(listModel).index(params);
let goodsList = {
name: list.name || '',
list: list.list,
fuzzyWord: list.fuzzyWord
};
let chanpinCss = yield css('chanpin.css');
let commonCss = yield css('common.css');
if (!list || !list.fuzzyWord.length) {
return next();
}
return res.render('hot', Object.assign({
css: chanpinCss + commonCss,
title: `${goodsList.name}_${goodsList.name}【图片,新款,价格,折扣,搭配】-YOHO!BUY有货`,
mipUrl: `https://m.yohobuy.com${req.originalUrl}`,
mipFooter: true,
canonical: {
currentHref: `https://www.yohobuy.com/hot/${req.params.id}.html`
},
pageTitle: goodsList.name
}, goodsList));
})().catch(next);
};