Showing
6 changed files
with
78 additions
and
22 deletions
@@ -123,11 +123,13 @@ try { | @@ -123,11 +123,13 @@ try { | ||
123 | app.get('/h5/sitemap/hot_:id.xml', sitemap.hotsXmlDataH5); | 123 | app.get('/h5/sitemap/hot_:id.xml', sitemap.hotsXmlDataH5); |
124 | app.get('/h5/sitemap/chanpin_:id.xml', sitemap.chanpinXmlDataH5); | 124 | app.get('/h5/sitemap/chanpin_:id.xml', sitemap.chanpinXmlDataH5); |
125 | app.get('/h5/sitemap/productindex.xml', sitemap.productIndexXmlDataH5); | 125 | app.get('/h5/sitemap/productindex.xml', sitemap.productIndexXmlDataH5); |
126 | + | ||
127 | + app.get('/h5/sitemap/mip/shop_:id.xml', sitemap.shopMipXmlDataH5); | ||
128 | + app.get('/h5/sitemap/mip/list_:id.xml', sitemap.listMipXmlDataH5); | ||
126 | } catch (e) { | 129 | } catch (e) { |
127 | logger.error(e); | 130 | logger.error(e); |
128 | } | 131 | } |
129 | 132 | ||
130 | - | ||
131 | app.listen(config.port, function() { | 133 | app.listen(config.port, function() { |
132 | logger.info(`yoho seo start : http://127.0.0.1:${config.port}`); | 134 | logger.info(`yoho seo start : http://127.0.0.1:${config.port}`); |
133 | }); | 135 | }); |
@@ -263,6 +263,37 @@ function productIndexXmlDataH5(req, res, next) { | @@ -263,6 +263,37 @@ function productIndexXmlDataH5(req, res, next) { | ||
263 | .catch(next); | 263 | .catch(next); |
264 | } | 264 | } |
265 | 265 | ||
266 | +// mip | ||
267 | +function shopMipXmlDataH5(req, res, next) { | ||
268 | + let page = +req.params.id || 1; | ||
269 | + | ||
270 | + if (page <= 0) { | ||
271 | + page = 1; | ||
272 | + } | ||
273 | + | ||
274 | + req.ctx(SiteMapServiceH5).shopMipXml(page) | ||
275 | + .then(xml => { | ||
276 | + res.header('Content-Type', 'application/xml'); | ||
277 | + res.send(xml); | ||
278 | + }) | ||
279 | + .catch(next); | ||
280 | +} | ||
281 | + | ||
282 | +function listMipXmlDataH5(req, res, next) { | ||
283 | + let page = +req.params.id || 1; | ||
284 | + | ||
285 | + if (page <= 0) { | ||
286 | + page = 1; | ||
287 | + } | ||
288 | + | ||
289 | + req.ctx(SiteMapServiceH5).listXml(page) | ||
290 | + .then(xml => { | ||
291 | + res.header('Content-Type', 'application/xml'); | ||
292 | + res.send(xml); | ||
293 | + }) | ||
294 | + .catch(next); | ||
295 | +} | ||
296 | + | ||
266 | module.exports = { | 297 | module.exports = { |
267 | indexXmlData, | 298 | indexXmlData, |
268 | homeXmlData, | 299 | homeXmlData, |
@@ -284,5 +315,8 @@ module.exports = { | @@ -284,5 +315,8 @@ module.exports = { | ||
284 | chanpinXmlDataH5, | 315 | chanpinXmlDataH5, |
285 | hotsXmlDataH5, | 316 | hotsXmlDataH5, |
286 | indexJsonDataH5, | 317 | indexJsonDataH5, |
287 | - productIndexXmlDataH5 | 318 | + productIndexXmlDataH5, |
319 | + | ||
320 | + shopMipXmlDataH5, | ||
321 | + listMipXmlDataH5 | ||
288 | }; | 322 | }; |
@@ -8,7 +8,11 @@ const BRAND_TYPE = { | @@ -8,7 +8,11 @@ const BRAND_TYPE = { | ||
8 | shop: 2 | 8 | shop: 2 |
9 | }; | 9 | }; |
10 | 10 | ||
11 | -function getShopUrl(domain, shopId) { | 11 | +function getShopUrl(domain, shopId, mip) { |
12 | + if (mip) { | ||
13 | + return `/mip/shop/${domain}-${shopId}.html`; | ||
14 | + } | ||
15 | + | ||
12 | return `/shop/${domain}-${shopId}.html`; | 16 | return `/shop/${domain}-${shopId}.html`; |
13 | } | 17 | } |
14 | 18 | ||
@@ -22,7 +26,7 @@ module.exports = class extends global.yoho.BaseModel { | @@ -22,7 +26,7 @@ module.exports = class extends global.yoho.BaseModel { | ||
22 | this.shopModel = new ShopModel(ctx); | 26 | this.shopModel = new ShopModel(ctx); |
23 | } | 27 | } |
24 | 28 | ||
25 | - async _getShopUrl() { | 29 | + async _getShopUrl(isMip) { |
26 | let shopUrls = []; | 30 | let shopUrls = []; |
27 | 31 | ||
28 | await Promise.map(Object.values(CHANNELS), async (channel) => { | 32 | await Promise.map(Object.values(CHANNELS), async (channel) => { |
@@ -35,7 +39,7 @@ module.exports = class extends global.yoho.BaseModel { | @@ -35,7 +39,7 @@ module.exports = class extends global.yoho.BaseModel { | ||
35 | let shopId = shop.shop_id; | 39 | let shopId = shop.shop_id; |
36 | let domain = shop.brand_domain || 'default_domain'; | 40 | let domain = shop.brand_domain || 'default_domain'; |
37 | 41 | ||
38 | - shopUrls.push(getShopUrl(domain.toLowerCase(), shopId)); | 42 | + shopUrls.push(getShopUrl(domain.toLowerCase(), shopId, isMip)); |
39 | } | 43 | } |
40 | }); | 44 | }); |
41 | }); | 45 | }); |
@@ -48,6 +52,10 @@ module.exports = class extends global.yoho.BaseModel { | @@ -48,6 +52,10 @@ module.exports = class extends global.yoho.BaseModel { | ||
48 | return this._getShopUrl(); | 52 | return this._getShopUrl(); |
49 | } | 53 | } |
50 | 54 | ||
55 | + async getMipUrls() { | ||
56 | + return this._getShopUrl(true); | ||
57 | + } | ||
58 | + | ||
51 | async getIndex(type) { | 59 | async getIndex(type) { |
52 | return [indexUrl(type, 1)]; | 60 | return [indexUrl(type, 1)]; |
53 | } | 61 | } |
@@ -93,10 +93,12 @@ module.exports = function() { | @@ -93,10 +93,12 @@ module.exports = function() { | ||
93 | 93 | ||
94 | guang: { | 94 | guang: { |
95 | urls: ['/guang/', | 95 | urls: ['/guang/', |
96 | - '/guang/boys-t0/', '/guang/boys-t1001/', '/guang/boys-t2/', '/guang/boys-t4/', '/guang/boys-t22/', '/guang/news/', | ||
97 | - '/guang/girls-t0/', '/guang/girls-t1001/', '/guang/girls-t2/', '/guang/girls-t4', '/guang/girls-t22/', | ||
98 | - '/guang/kids-t0/', '/guang/kids-t1001/', '/guang/kids-t2/', '/guang/kids-t4/', '/guang/kids-t22/', | ||
99 | - '/guang/lifestyle-t0/', '/guang/lifestyle-t1001/', '/guang/lifestyle-t2/', '/guang/lifestyle-t4/', '/guang/lifestyle-t22/' | 96 | + '/guang/boys-t0/', '/guang/boys-t1001/', '/guang/boys-t2/', '/guang/boys-t4/', |
97 | + '/guang/boys-t22/', '/guang/news/', '/guang/girls-t0/', '/guang/girls-t1001/', | ||
98 | + '/guang/girls-t2/', '/guang/girls-t4', '/guang/girls-t22/', '/guang/kids-t0/', | ||
99 | + '/guang/kids-t1001/', '/guang/kids-t2/', '/guang/kids-t4/', '/guang/kids-t22/', | ||
100 | + '/guang/lifestyle-t0/', '/guang/lifestyle-t1001/', '/guang/lifestyle-t2/', | ||
101 | + '/guang/lifestyle-t4/', '/guang/lifestyle-t22/' | ||
100 | ], | 102 | ], |
101 | lastmod: today, | 103 | lastmod: today, |
102 | priority: PRIO.L1, | 104 | priority: PRIO.L1, |
@@ -120,4 +122,4 @@ module.exports = function() { | @@ -120,4 +122,4 @@ module.exports = function() { | ||
120 | mobile: true | 122 | mobile: true |
121 | } | 123 | } |
122 | }; | 124 | }; |
123 | -}; | ||
125 | +}; |
@@ -137,6 +137,16 @@ module.exports = class extends global.yoho.BaseModel { | @@ -137,6 +137,16 @@ module.exports = class extends global.yoho.BaseModel { | ||
137 | return _createXml(this.host, shopConfig.urls, opt); | 137 | return _createXml(this.host, shopConfig.urls, opt); |
138 | } | 138 | } |
139 | 139 | ||
140 | + async shopMipXml() { | ||
141 | + const shopConfig = this.config.shop; | ||
142 | + const opt = _.pick(this.config.shop, this.props); | ||
143 | + let urls = await this.shopService.getMipUrls(); | ||
144 | + | ||
145 | + shopConfig.urls = shopConfig.urls.concat(urls); | ||
146 | + | ||
147 | + return _createXml(this.host, shopConfig.urls, opt); | ||
148 | + } | ||
149 | + | ||
140 | async productXml(page) { | 150 | async productXml(page) { |
141 | const productConfig = this.config.product; | 151 | const productConfig = this.config.product; |
142 | const opt = _.pick(this.config.product, this.props); | 152 | const opt = _.pick(this.config.product, this.props); |
@@ -18,20 +18,20 @@ module.exports = { | @@ -18,20 +18,20 @@ module.exports = { | ||
18 | cookieDomain: '.yohobuy.com', | 18 | cookieDomain: '.yohobuy.com', |
19 | domains: { | 19 | domains: { |
20 | // test3 | 20 | // test3 |
21 | - // singleApi: 'http://api-test3.yohops.com:9999/', | ||
22 | - // api: 'http://api-test3.yohops.com:9999/', | ||
23 | - // service: 'http://api-test3.yohops.com:9999/', | ||
24 | - // serviceNotify: 'http://api-test3.yohops.com:9999/', | ||
25 | - // global: 'http://global-test-soa.yohops.com:9999/', | ||
26 | - // platformApi: 'http://192.168.102.48:8088/', | ||
27 | - // yohoNowApi: 'http://yohonow-test.yohops.com:9999/' | 21 | + api: 'http://api-test3.dev.yohocorp.com/', |
22 | + service: 'http://api-test3.dev.yohocorp.com/', | ||
23 | + singleApi: 'http://api-test3.dev.yohocorp.com/', | ||
24 | + serviceNotify: 'http://api-test3.dev.yohocorp.com/', | ||
25 | + global: 'http://global-test-soa.yohops.com:9999/', | ||
26 | + platformApi: 'http://192.168.102.48:8088/', | ||
27 | + yohoNowApi: 'http://yohonow-test.yohops.com:9999/' | ||
28 | 28 | ||
29 | // prod | 29 | // prod |
30 | - singleApi: 'http://single.yoho.cn/', | ||
31 | - api: 'http://api.yoho.cn/', | ||
32 | - service: 'http://service.yoho.cn/', | ||
33 | - serviceNotify: 'http://service.yoho.cn/', | ||
34 | - global: 'http://api-global.yohobuy.com/' | 30 | + // singleApi: 'http://single.yoho.cn/', |
31 | + // api: 'http://api.yoho.cn/', | ||
32 | + // service: 'http://service.yoho.cn/', | ||
33 | + // serviceNotify: 'http://service.yoho.cn/', | ||
34 | + // global: 'http://api-global.yohobuy.com/' | ||
35 | 35 | ||
36 | // gray | 36 | // gray |
37 | // singleApi: 'http://single.gray.yohops.com/', | 37 | // singleApi: 'http://single.gray.yohops.com/', |
-
Please register or login to post a comment