|
|
'use strict';
|
|
|
const model = require('../models/feature');
|
|
|
const _ = require('lodash');
|
|
|
const stringProcess = require('../../../utils/string-process');
|
|
|
|
|
|
exports.index = function(req, res, next) {
|
|
|
model.index({
|
|
|
code: req.params.code,
|
|
|
type: req.query.type
|
|
|
type: stringProcess.paramsFilter(req.query.type)
|
|
|
}).then((result) => {
|
|
|
if (!result) {
|
|
|
return next();
|
|
|
}
|
|
|
let title = req.query.title || result.name || '专题活动';
|
|
|
let title = stringProcess.paramsFilter(req.query.title) || result.name || '专题活动';
|
|
|
let shareId = _.parseInt(stringProcess.paramsFilter(req.query.share_id));
|
|
|
|
|
|
// 唤起 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.locals.appPath = `yohobuy://yohobuy.com/goapp?openby:yohobuy={"action":"go.h5","params":{"param":{"share_id":"${shareId}","title":"${title}"},"share":"/operations/api/v5/webshare/getShare","shareparam":{"share_id":"${shareId}"},"title":"${title}","url":"https://activity.yoho.cn/feature/${req.params.code}.html"}}`;
|
|
|
|
|
|
res.render('feature/index', {
|
|
|
module: 'activity',
|
...
|
...
|
|