Authored by 郝肖肖

Merge branch 'hotfix/goodsXml'

... ... @@ -49,12 +49,15 @@ const demoXml = (req, res) => {
};
const siteMapXml = (req, res) => {
let sitemap = new Array(26).fill().map((val, k) => {
req.ctx(SeoIndexModel).getGoodsPage().then(result => {
let sitemap = new Array(result).fill().map((val, k) => {
return `http://spiderwebhook.yoho.cn/dist/goods-xml/goods-${k + 1}.xml`;
});
res.setHeader('Content-Type', 'text/xml; charset=utf-8');
res.render('seo/site-map', {sitemap});
return res.render('seo/site-map', {sitemap});
});
};
module.exports = {
... ...
'use strict';
const baiduBrand = {
1: {
yoho: '',
baidu: ''
},
999: {
yoho: '',
baidu: ''
}
};
module.exports = baiduBrand;
... ...
... ... @@ -9,7 +9,7 @@ const helpers = global.yoho.helpers;
const goodsHbs = require(`${ROOT_PATH}/hbs/partials/seo/index.hbs`);
const util = require(`${ROOT_PATH}/libs/util`);
const redis = require(`${ROOT_PATH}/libs/redis`);
const SIZE = 3000;
const SIZE = 2500;
const GOODS_URL = 'http://spiderwebhook.yoho.cn/dist/goods-xml';
class SeoIndexModel extends global.yoho.BaseModel {
... ... @@ -201,6 +201,14 @@ class SeoIndexModel extends global.yoho.BaseModel {
return sData;
});
}
getGoodsPage() {
return this.searchList({page: 1, limit: 1}).then(rdata => {
let total = _.get(rdata, 'data.total', 0);
return Math.ceil(total / SIZE);
});
}
}
module.exports = SeoIndexModel;
... ...