...
|
...
|
@@ -2,35 +2,65 @@ const FindGoods = require('../models/find-goods'); |
|
|
const _ = require('lodash');
|
|
|
const stringProcess = require('../../../utils/string-process');
|
|
|
|
|
|
|
|
|
exports.index = function(req, res, next) {
|
|
|
let qcdn = _.get(req.app.locals, 'wap.qcloud_cdn');
|
|
|
const {page = 1} = req.query || {};
|
|
|
|
|
|
req.ctx(FindGoods).findGoods({page}).then((result)=> {
|
|
|
if (!result) {
|
|
|
return next();
|
|
|
}
|
|
|
const title = stringProcess.paramsFilter(req.query.title) || '发现好货';
|
|
|
const 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":"${shareId}","title":"${title}"},"share":"/operations/api/v5/webshare/getShare","shareparam":{"share_id":"${shareId}"},"title":"${title}","url":"https://activity.yoho.cn/activity/find/goods.html"}}`;
|
|
|
|
|
|
const jsSdk = global.yoho.config.jsSdk;
|
|
|
|
|
|
console.log('---------result---------', result);
|
|
|
res.render('find-goods/index', {
|
|
|
module: 'activity',
|
|
|
page: 'find-goods',
|
|
|
title: title,
|
|
|
content: result.data,
|
|
|
isFeature: true,
|
|
|
wechatShare: true,
|
|
|
localCss: true,
|
|
|
loadJs: [{
|
|
|
src: qcdn ? jsSdk.replace(/\/\/cdn.yoho.cn/gi, '//qcdn.yoho.cn') : jsSdk
|
|
|
}]
|
|
|
});
|
|
|
}).then().catch(next);
|
|
|
const { page = 1 } = req.query || {};
|
|
|
|
|
|
req.ctx(FindGoods)
|
|
|
.findGoods({ page, limit: 5 })
|
|
|
.then(result => {
|
|
|
if (!result) {
|
|
|
return next();
|
|
|
}
|
|
|
const title =
|
|
|
stringProcess.paramsFilter(req.query.title) || '发现好货';
|
|
|
const 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":"${shareId}","title":"${title}"},"share":"/operations/api/v5/webshare/getShare","shareparam":{"share_id":"${shareId}"},"title":"${title}","url":"https://activity.yoho.cn/activity/find/goods.html"}}`;
|
|
|
|
|
|
const jsSdk = global.yoho.config.jsSdk;
|
|
|
|
|
|
console.log('---------result---------', result);
|
|
|
|
|
|
res.render('find-goods/index', {
|
|
|
module: 'activity',
|
|
|
page: 'find-goods',
|
|
|
title: title,
|
|
|
content: result.data,
|
|
|
isFeature: true,
|
|
|
wechatShare: true,
|
|
|
localCss: true,
|
|
|
loadJs: [
|
|
|
{
|
|
|
src: qcdn ?
|
|
|
jsSdk.replace(
|
|
|
/\/\/cdn.yoho.cn/gi,
|
|
|
'//qcdn.yoho.cn',
|
|
|
) :
|
|
|
jsSdk,
|
|
|
},
|
|
|
],
|
|
|
});
|
|
|
})
|
|
|
.catch(next);
|
|
|
};
|
|
|
|
|
|
exports.fetchMore = function(req, res, next) {
|
|
|
const { page = 1 } = req.query || {};
|
|
|
|
|
|
req.ctx(FindGoods)
|
|
|
.findGoods({ page })
|
|
|
.then(result => {
|
|
|
if (!result) {
|
|
|
return next();
|
|
|
}
|
|
|
|
|
|
res.render('find-goods/item-list', {
|
|
|
content: result.data
|
|
|
});
|
|
|
})
|
|
|
.catch(next);
|
|
|
}; |
...
|
...
|
|