Authored by 李靖

合master

... ... @@ -307,12 +307,12 @@ const index = (req, res, next) => {
isShare: isShare,
id: id,
showAnaJson: {
mipsite: true,
miptitle: data.title,
mipPublishTime: guang.detail.publishTime,
mipPic: mipPic,
mipDes: guang.shareDesc,
mipUrl: `${req.protocol}://m.yohobuy.com/guang/${id}.html`
addBaiduSite: true,
title: data.title,
publishTime: guang.detail.publishTime,
pic: mipPic,
des: guang.shareDesc,
url: `${req.protocol}://m.yohobuy.com/guang/${id}.html`
}
}, data, parameter));
})().catch(next);
... ...
... ... @@ -37,3 +37,11 @@ exports.index = (req, res, next) => {
}, goodsList));
})().catch(next);
};
// 301到新路由
exports.redirect = (req, res) => {
let redirectUrl = '/mip/chanpin/';
redirectUrl += `${req.params.id}.html`;
res.redirect(301, redirectUrl);
};
... ...
... ... @@ -216,14 +216,12 @@ const detailIndex = (req, res, next) => {
currentHref: `https://m.yohobuy.com/guang/${id}.html`
},
showAnaJson: {
mipsite: false,
miptitle: `${detail.getArticle.article_title} | Yoho!Buy有货 | 潮流购物逛不停`,
mipId: id,
mipPublishTime: mipPublishTime,
mipPic: mipPic,
mipDes: detail.getArticle.article_summary,
mipUrl: `${req.protocol}://m.yohobuy.com${req.originalUrl}`,
miphtml: `${req.protocol}://m.yohobuy.com/mip/guang/${id}.html`
addBaiduSite: false,
title: `${detail.getArticle.article_title} | Yoho!Buy有货 | 潮流购物逛不停`,
publishTime: mipPublishTime,
pic: mipPic,
des: detail.getArticle.article_summary,
url: `${req.protocol}://m.yohobuy.com${req.originalUrl}`,
}
}, data));
})().catch(next);
... ...
... ... @@ -21,6 +21,7 @@ router.get(/^\/guang\/info\/(.*?)\.html/, rewrite.resolve, guang.detailIndex);
router.get(/^\/guang\/(.*?)\.html/, rewrite.resolve, guang.detailIndex);
router.get('/chanpin/:id.html', chanpin.index);
router.get('/list/:id.html', chanpin.redirect);
router.get(/^\/product\/(\d+)\.html/, productDetail.index);
... ...
... ... @@ -294,20 +294,6 @@ const category = (req, res, next) => {
*/
const listNew = (req, res, next) => {
let params = _.assign({}, req.query);
/* 勿修改,唤起 APP 使用 */
let appParams = _.assign({}, req.query, {
title: req.query.title || req.query.sort_name || '',
productPool: req.query.filter_poolId,
actiontype: req.query.actiontype || '1'
});
delete appParams.filter_poolId;
let appPath = 'yohobuy://yohobuy.com/goapp?openby:yohobuy={"action":"go.list","params":' +
JSON.stringify(appParams) +
'}';
let uid = req.user.uid;
// 获取第一页数据做服务端渲染
... ... @@ -372,7 +358,6 @@ const listNew = (req, res, next) => {
firstPageGoods: responseResult || [],
pageFooter: true,
localCss: true,
appPath: appPath,
categoryIntro: categoryIntro
}, seoRenderData));
})().catch(next);
... ...
... ... @@ -85,12 +85,12 @@ const newDetail = {
appPath: appPath,
isMarsApp: req.yoho.isMarsApp, // 判断mars
showAnaJson: {
mipsite: true,
miptitle: title,
mipPublishTime: moment.unix(result.shelveTime).format('YYYY-MM-DDTHH:mm:ss'), // mip日期必填
mipPic: mipPic,
mipDes: description,
mipUrl: `${req.protocol}://m.yohobuy.com/product/${result.productSkn}.html`
addBaiduSite: true,
title: title,
publishTime: moment.unix(result.shelveTime).format('YYYY-MM-DDTHH:mm:ss'), // mip日期必填
pic: mipPic,
des: description,
url: `${req.protocol}://m.yohobuy.com/product/${result.productSkn}.html`
},
miniPath: helpers.urlFormat('/api/wechat/miniapp.jpg', {
miniapp_type: 0,
... ...
... ... @@ -583,13 +583,15 @@ const shop = {
params.limit = 24;
req.ctx(searchModel).getShopGoods(params).then((result) => {
if (result.data.product_list && result.data.product_list.length > 0) {
let product_list = productProcess.processProductList(result.data.product_list || [], {
isApp: params.isApp || (params.appVersion && params.appVersion !== 'false'),
gender: _coverChannel[params.coverChannel],
showSimilar: params.shop_id || params.material === 'true' ? false : true
});
let productList = _.get(result, 'data.product_list', []);
if (productList.length > 0) {
let product_list =
productProcess.processProductList(productList, {
isApp: params.isApp || (params.appVersion && params.appVersion !== 'false'),
gender: _coverChannel[params.coverChannel],
showSimilar: params.shop_id || params.material === 'true' ? false : true
});
res.render('search/page', {
layout: false,
... ...
... ... @@ -22,8 +22,6 @@
<link rel="dns-prefetch" href="{{this}}">
{{/dnsPrefetch.hosts}}
{{> ld-json}}
<script>
{{#ifand isProduction wap.open.bughd}}
window._timeStart = new Date().getTime();
... ... @@ -87,6 +85,8 @@
<link rel="apple-touch-startup-image" href="https://cdn.yoho.cn/h5/forios/startup/startup-orange-x.png" media="screen and (min-device-width: 751px) and (max-device-width: 1125px)">
<link rel="apple-touch-startup-image" href="https://cdn.yoho.cn/h5/forios/startup/startup-orange-6.png" media="screen and (min-device-width: 641px) and (max-device-width: 750px)">
<link rel="apple-touch-startup-image" href="https://cdn.yoho.cn/h5/forios/startup/startup-orange-5.png" media="screen and (max-device-width: 640px)">
{{> ld-json}}
</head>
<body class="{{pageStyle}}{{#if isWechat}} wechat-body{{/if}}{{#if width750}} width750{{/if}}{{#if isPassportPage}} passport-body{{/if}}{{#if isStarIndexPage}} star-index-bg{{/if}}{{#if isStarDetailPage}} star-class-body{{/if}}{{#if isInstallmentPage}} installment-body{{/if}}{{#if @root.isMarsApp}} is-mars-app{{/if}}{{#if @root.isNowApp}} is-now-app{{/if}}">
<div class="main-wrap" id="main-wrap" {{#if appPath}}data-apppath='{{{appPath}}}'{{/if}} {{#if miniPath}}data-miniPath='{{{miniPath}}}'{{/if}}>
... ... @@ -130,5 +130,8 @@
{{#unless devEnv}}
{{> analysis}}
{{/unless}}
{{# showAnaJson}}
{{#if addBaiduSite}}<script src="//msite.baidu.com/sdk/c.js?appid=1583402501013173"></script>{{/if}}
{{/showAnaJson}}
</body>
</html>
... ...
{{# showAnaJson}}
{{#if mipsite}}<script src="//msite.baidu.com/sdk/c.js?appid=1583402501013173"></script>{{/if}}
<script type="application/ld+json">
{
"@context": "https://ziyuan.baidu.com/contexts/cambrian.jsonld",
"@id": "{{mipUrl}}",
"@id": "{{url}}",
"appid": "1583402501013173",
"title": "{{miptitle}}",
"title": "{{title}}",
"images": [
{{#if mipPic}}"http:{{image mipPic 750 500 1}}"{{/if}}
{{#if pic}}"http:{{image pic 750 500 1}}"{{/if}}
],
"description": "{{mipDes}}",
"pubDate": "{{mipPublishTime}}"
"description": "{{des}}",
"pubDate": "{{publishTime}}"
}
</script>
{{/showAnaJson}}
... ...