|
|
'use strict';
|
|
|
|
|
|
const moment = require('moment');
|
|
|
const SeoIndexModel = require('../../models/seo/index');
|
|
|
|
|
|
const index = (req, res) => {
|
...
|
...
|
@@ -50,8 +52,9 @@ const demoXml = (req, res) => { |
|
|
|
|
|
const siteMapXml = (req, res) => {
|
|
|
req.ctx(SeoIndexModel).getGoodsPage().then(result => {
|
|
|
let date = moment(new Date()).format('YYYY-MM-DD');
|
|
|
let sitemap = new Array(result).fill().map((val, k) => {
|
|
|
return `http://spiderwebhook.yoho.cn/dist/goods-xml/goods-${k + 1}.xml`;
|
|
|
return {url: `http://spiderwebhook.yoho.cn/dist/goods-xml/goods-${k + 1}.xml`, date: date};
|
|
|
});
|
|
|
|
|
|
res.setHeader('Content-Type', 'text/xml; charset=utf-8');
|
...
|
...
|
|