Authored by 郝肖肖

Merge branch 'hotfix/goodsXml'

1 'use strict'; 1 'use strict';
  2 +
  3 +const moment = require('moment');
2 const SeoIndexModel = require('../../models/seo/index'); 4 const SeoIndexModel = require('../../models/seo/index');
3 5
4 const index = (req, res) => { 6 const index = (req, res) => {
@@ -50,8 +52,9 @@ const demoXml = (req, res) => { @@ -50,8 +52,9 @@ const demoXml = (req, res) => {
50 52
51 const siteMapXml = (req, res) => { 53 const siteMapXml = (req, res) => {
52 req.ctx(SeoIndexModel).getGoodsPage().then(result => { 54 req.ctx(SeoIndexModel).getGoodsPage().then(result => {
  55 + let date = moment(new Date()).format('YYYY-MM-DD');
53 let sitemap = new Array(result).fill().map((val, k) => { 56 let sitemap = new Array(result).fill().map((val, k) => {
54 - return `http://spiderwebhook.yoho.cn/dist/goods-xml/goods-${k + 1}.xml`; 57 + return {url: `http://spiderwebhook.yoho.cn/dist/goods-xml/goods-${k + 1}.xml`, date: date};
55 }); 58 });
56 59
57 res.setHeader('Content-Type', 'text/xml; charset=utf-8'); 60 res.setHeader('Content-Type', 'text/xml; charset=utf-8');
@@ -3346,6 +3346,69 @@ const baiduBrand = { @@ -3346,6 +3346,69 @@ const baiduBrand = {
3346 categoryLv2: '女装', 3346 categoryLv2: '女装',
3347 categoryLv3: '羊毛衫', 3347 categoryLv3: '羊毛衫',
3348 categoryLv4: '羊毛衫' 3348 categoryLv4: '羊毛衫'
  3349 + },
  3350 + 1906: {
  3351 + yoho: '针织衫',
  3352 + categoryLv1: '服饰内衣',
  3353 + categoryLv2: '女装',
  3354 + categoryLv3: '针织衫',
  3355 + categoryLv4: '针织衫'
  3356 + },
  3357 + 416: {
  3358 + yoho: '冷帽',
  3359 + categoryLv1: '服饰内衣',
  3360 + categoryLv2: '服饰配件',
  3361 + categoryLv3: '围巾/手套/帽子套装',
  3362 + categoryLv4: '帽子'
  3363 + },
  3364 + 418: {
  3365 + yoho: '套装',
  3366 + categoryLv1: '美妆个护',
  3367 + categoryLv2: '洗发护发',
  3368 + categoryLv3: '套装',
  3369 + categoryLv4: '套装'
  3370 + },
  3371 + 422: {
  3372 + yoho: '围巾',
  3373 + categoryLv1: '服饰内衣',
  3374 + categoryLv2: '服饰配件',
  3375 + categoryLv3: '围巾/手套/帽子套装',
  3376 + categoryLv4: '围巾'
  3377 + },
  3378 + 424: {
  3379 + yoho: '棉衣',
  3380 + categoryLv1: '运动户外',
  3381 + categoryLv2: '运动服饰',
  3382 + categoryLv3: '棉服',
  3383 + categoryLv4: '棉服'
  3384 + },
  3385 + 432: {
  3386 + yoho: '羽绒服',
  3387 + categoryLv1: '运动户外',
  3388 + categoryLv2: '户外鞋服',
  3389 + categoryLv3: '羽绒服/棉服',
  3390 + categoryLv4: '羽绒服'
  3391 + },
  3392 + 435: {
  3393 + yoho: '手套',
  3394 + categoryLv1: '服饰内衣',
  3395 + categoryLv2: '服饰配件',
  3396 + categoryLv3: '围巾/手套/帽子套装',
  3397 + categoryLv4: '手套'
  3398 + },
  3399 + 449: {
  3400 + yoho: '儿童玩具',
  3401 + categoryLv1: '玩具乐器',
  3402 + categoryLv2: '娃娃玩具',
  3403 + categoryLv3: '芭比娃娃',
  3404 + categoryLv4: '芭比娃娃'
  3405 + },
  3406 + 454: {
  3407 + yoho: '防风外套',
  3408 + categoryLv1: '服饰内衣',
  3409 + categoryLv2: '女装',
  3410 + categoryLv3: '短外套',
  3411 + categoryLv4: '短外套'
3349 } 3412 }
3350 }; 3413 };
3351 3414
@@ -165,7 +165,7 @@ class SeoIndexModel extends global.yoho.BaseModel { @@ -165,7 +165,7 @@ class SeoIndexModel extends global.yoho.BaseModel {
165 } 165 }
166 166
167 autoGoodsXml(params) { 167 autoGoodsXml(params) {
168 - return util.sleep(60000).then(() => { 168 + return util.sleep(2000).then(() => {
169 return this.writerGoodsXml(params); 169 return this.writerGoodsXml(params);
170 }).then(rdata => { 170 }).then(rdata => {
171 171
@@ -2,9 +2,8 @@ @@ -2,9 +2,8 @@
2 <sitemapindex> 2 <sitemapindex>
3 {{#sitemap}} 3 {{#sitemap}}
4 <sitemap> 4 <sitemap>
5 - <loc>  
6 - {{.}}  
7 - </loc> 5 + <loc>{{url}}</loc>
  6 + <lastmod>{{date}}</lastmod>
8 </sitemap> 7 </sitemap>
9 {{/sitemap}} 8 {{/sitemap}}
10 </sitemapindex> 9 </sitemapindex>