feature.js
1.34 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
'use strict';
const model = require('../models/feature');
exports.index = function(req, res, next) {
model.index({
code: req.params.code,
type: req.query.type
}).then((result) => {
if (!result) {
return next();
}
let title = req.query.title || result.name || '专题活动';
// 唤起 APP 的路径
res.locals.appPath = `yohobuy://yohobuy.com/goapp?openby:yohobuy={"action":"go.h5","params":{"param":{"share_id":"${req.query.share_id}","title":"${title}"},"share":"/operations/api/v5/webshare/getShare","shareparam":{"share_id":"${req.query.share_id}"},"title":"${title}","url":"https://activity.yoho.cn/feature/${req.params.code}.html"}}`;
res.render('feature/index', {
module: 'activity',
page: 'feature',
title: title,
content: result,
activity_id: req.params.code,
isFeature: true,
loadJs: [{
src: global.yoho.config.jsSdk
}]
});
}).catch(next);
};
exports.sidebar = function(req, res, next) {
model.index({
code: req.params.code
}).then((result) => {
if (!result) {
return next();
}
res.render('feature/sidebar', {
content: result,
layout: false
});
}).catch(next);
};