Showing
5 changed files
with
69 additions
and
6 deletions
@@ -55,6 +55,9 @@ app.get('/xzh-yohoGirlsAll', baiduXzh.yohoGirlsAll); | @@ -55,6 +55,9 @@ app.get('/xzh-yohoGirlsAll', baiduXzh.yohoGirlsAll); | ||
55 | // 百度熊掌号--潮流全站推送一遍mip | 55 | // 百度熊掌号--潮流全站推送一遍mip |
56 | app.get('/xzh-yohoBoysAll', baiduXzh.yohoBoysAll); | 56 | app.get('/xzh-yohoBoysAll', baiduXzh.yohoBoysAll); |
57 | 57 | ||
58 | +// 百度熊掌号--mars全站推送一遍mip | ||
59 | +app.get('/xzh-marsAll', baiduXzh.marsAll); | ||
60 | + | ||
58 | // 商品详情-百度链接提交 | 61 | // 商品详情-百度链接提交 |
59 | app.get('/goodsUrl', cseo.goodsUrl); | 62 | app.get('/goodsUrl', cseo.goodsUrl); |
60 | 63 | ||
@@ -73,6 +76,9 @@ app.get('/newsSitemap', cseo.newsSitemap); | @@ -73,6 +76,9 @@ app.get('/newsSitemap', cseo.newsSitemap); | ||
73 | // 潮流全站推送一遍mip和百度资源位 | 76 | // 潮流全站推送一遍mip和百度资源位 |
74 | app.get('/yohoGirlsAll', cseo.yohoGirlsAll); | 77 | app.get('/yohoGirlsAll', cseo.yohoGirlsAll); |
75 | 78 | ||
79 | +// mars全站推送一遍mip和百度资源位 | ||
80 | +app.get('/marsAll', cseo.marsAll); | ||
81 | + | ||
76 | // 潮流全站推送一遍mip和百度资源位 | 82 | // 潮流全站推送一遍mip和百度资源位 |
77 | app.get('/yohoBoysAll', cseo.yohoBoysAll); | 83 | app.get('/yohoBoysAll', cseo.yohoBoysAll); |
78 | 84 |
@@ -123,6 +123,12 @@ const yohoBoysAll = (req, res) => { | @@ -123,6 +123,12 @@ const yohoBoysAll = (req, res) => { | ||
123 | }); | 123 | }); |
124 | }; | 124 | }; |
125 | 125 | ||
126 | +const marsAll = (req, res) => { | ||
127 | + return req.ctx(BaiduLinkSubmit).marsAll(req.query).then(result => { | ||
128 | + return res.json(result); | ||
129 | + }); | ||
130 | +}; | ||
131 | + | ||
126 | module.exports = { | 132 | module.exports = { |
127 | index, | 133 | index, |
128 | autoGoodsXml, | 134 | autoGoodsXml, |
@@ -136,6 +142,7 @@ module.exports = { | @@ -136,6 +142,7 @@ module.exports = { | ||
136 | newsSitemap, | 142 | newsSitemap, |
137 | yohoGirlsAll, | 143 | yohoGirlsAll, |
138 | yohoBoysAll, | 144 | yohoBoysAll, |
145 | + marsAll, | ||
139 | demoXsd, | 146 | demoXsd, |
140 | demoXml | 147 | demoXml |
141 | }; | 148 | }; |
@@ -8,31 +8,32 @@ | @@ -8,31 +8,32 @@ | ||
8 | const XzhIndexModel = require('../../models/xzh/index'); | 8 | const XzhIndexModel = require('../../models/xzh/index'); |
9 | 9 | ||
10 | const index = (req, res) => { | 10 | const index = (req, res) => { |
11 | - | ||
12 | return req.ctx(XzhIndexModel).index().then(result => { | 11 | return req.ctx(XzhIndexModel).index().then(result => { |
13 | return res.json(result); | 12 | return res.json(result); |
14 | }); | 13 | }); |
15 | - | ||
16 | }; | 14 | }; |
17 | 15 | ||
18 | const yohoGirlsAll = (req, res) => { | 16 | const yohoGirlsAll = (req, res) => { |
19 | - | ||
20 | return req.ctx(XzhIndexModel).yohoGirlsAll().then(result => { | 17 | return req.ctx(XzhIndexModel).yohoGirlsAll().then(result => { |
21 | return res.json(result); | 18 | return res.json(result); |
22 | }); | 19 | }); |
23 | - | ||
24 | }; | 20 | }; |
25 | 21 | ||
26 | const yohoBoysAll = (req, res) => { | 22 | const yohoBoysAll = (req, res) => { |
27 | - | ||
28 | return req.ctx(XzhIndexModel).yohoBoysAll().then(result => { | 23 | return req.ctx(XzhIndexModel).yohoBoysAll().then(result => { |
29 | return res.json(result); | 24 | return res.json(result); |
30 | }); | 25 | }); |
26 | +}; | ||
31 | 27 | ||
28 | +const marsAll = (req, res) => { | ||
29 | + return req.ctx(XzhIndexModel).marsAll().then(result => { | ||
30 | + return res.json(result); | ||
31 | + }); | ||
32 | }; | 32 | }; |
33 | 33 | ||
34 | module.exports = { | 34 | module.exports = { |
35 | index, | 35 | index, |
36 | yohoGirlsAll, | 36 | yohoGirlsAll, |
37 | - yohoBoysAll | 37 | + yohoBoysAll, |
38 | + marsAll, | ||
38 | }; | 39 | }; |
@@ -421,6 +421,40 @@ class BaiduLinkSubmit extends global.yoho.BaseModel { | @@ -421,6 +421,40 @@ class BaiduLinkSubmit extends global.yoho.BaseModel { | ||
421 | })(); | 421 | })(); |
422 | } | 422 | } |
423 | 423 | ||
424 | + marsAll() { | ||
425 | + let that = this; | ||
426 | + | ||
427 | + return co(function* () { | ||
428 | + let initData = { | ||
429 | + mip: [], | ||
430 | + pc: [], | ||
431 | + pcUrl: 'http://www.yohomars.com', | ||
432 | + mipUrl: 'http://www.yohomars.com' | ||
433 | + }; | ||
434 | + | ||
435 | + let rdata = yield Promise.all([ | ||
436 | + redis.lrangeAsync(`${NEWSKEY}:www_yohomars_com`, 0, 1000), | ||
437 | + redis.lrangeAsync(`${NEWSKEY}:mip:www_yohomars_com`, 0, 1000) | ||
438 | + ]); | ||
439 | + | ||
440 | + initData.pc = _.get(rdata, '[0]', []); | ||
441 | + initData.mip = _.get(rdata, '[1]', []); | ||
442 | + | ||
443 | + rdata = yield Promise.all([ | ||
444 | + that.sendUrl(initData.pc, initData.pcUrl), | ||
445 | + that.sendUrl(initData.mip, initData.mipUrl, 'mip') | ||
446 | + ]); | ||
447 | + | ||
448 | + if (rdata[0].code !== 200 || rdata[1].code !== 200) { | ||
449 | + return rdata; | ||
450 | + } | ||
451 | + | ||
452 | + initData = {}; | ||
453 | + | ||
454 | + return rdata; | ||
455 | + })(); | ||
456 | + } | ||
457 | + | ||
424 | } | 458 | } |
425 | 459 | ||
426 | module.exports = BaiduLinkSubmit; | 460 | module.exports = BaiduLinkSubmit; |
@@ -96,6 +96,21 @@ class XzhIndexModel extends global.yoho.BaseModel { | @@ -96,6 +96,21 @@ class XzhIndexModel extends global.yoho.BaseModel { | ||
96 | })(); | 96 | })(); |
97 | } | 97 | } |
98 | 98 | ||
99 | + marsAll() { | ||
100 | + let that = this; | ||
101 | + | ||
102 | + return co(function* () { | ||
103 | + let urls = yield redis.lrangeAsync(`${NEWSKEY}:mip:www_yohomars_com`, 0, 1000); | ||
104 | + | ||
105 | + let rdata = yield that.sendData(urls, 'batch'); | ||
106 | + | ||
107 | + redis.ltrimAsync(`${NEWSKEY}:www_yohomars_com`, 1000, -1); | ||
108 | + redis.ltrimAsync(`${NEWSKEY}:mip:www_yohomars_com`, 1000, -1); | ||
109 | + | ||
110 | + return rdata; | ||
111 | + })(); | ||
112 | + } | ||
113 | + | ||
99 | // 向百度发送数据 | 114 | // 向百度发送数据 |
100 | sendData(urls, type) { | 115 | sendData(urls, type) { |
101 | 116 |
-
Please register or login to post a comment