...
|
...
|
@@ -2,17 +2,21 @@ 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 || {};
|
|
|
const { page = 1 } = req.query || {};
|
|
|
|
|
|
req.ctx(FindGoods).findGoods({page}).then((result)=> {
|
|
|
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));
|
|
|
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"}}`;
|
...
|
...
|
@@ -20,6 +24,7 @@ exports.index = function(req, res, next) { |
|
|
const jsSdk = global.yoho.config.jsSdk;
|
|
|
|
|
|
console.log('---------result---------', result);
|
|
|
|
|
|
res.render('find-goods/index', {
|
|
|
module: 'activity',
|
|
|
page: 'find-goods',
|
...
|
...
|
@@ -28,9 +33,34 @@ exports.index = function(req, res, next) { |
|
|
isFeature: true,
|
|
|
wechatShare: true,
|
|
|
localCss: true,
|
|
|
loadJs: [{
|
|
|
src: qcdn ? jsSdk.replace(/\/\/cdn.yoho.cn/gi, '//qcdn.yoho.cn') : jsSdk
|
|
|
}]
|
|
|
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
|
|
|
});
|
|
|
}).then().catch(next);
|
|
|
})
|
|
|
.catch(next);
|
|
|
}; |
...
|
...
|
|