Authored by 郝肖肖

'mars'

... ... @@ -55,6 +55,9 @@ app.get('/xzh-yohoGirlsAll', baiduXzh.yohoGirlsAll);
// 百度熊掌号--潮流全站推送一遍mip
app.get('/xzh-yohoBoysAll', baiduXzh.yohoBoysAll);
// 百度熊掌号--mars全站推送一遍mip
app.get('/xzh-marsAll', baiduXzh.marsAll);
// 商品详情-百度链接提交
app.get('/goodsUrl', cseo.goodsUrl);
... ... @@ -73,6 +76,9 @@ app.get('/newsSitemap', cseo.newsSitemap);
// 潮流全站推送一遍mip和百度资源位
app.get('/yohoGirlsAll', cseo.yohoGirlsAll);
// mars全站推送一遍mip和百度资源位
app.get('/marsAll', cseo.marsAll);
// 潮流全站推送一遍mip和百度资源位
app.get('/yohoBoysAll', cseo.yohoBoysAll);
... ...
... ... @@ -123,6 +123,12 @@ const yohoBoysAll = (req, res) => {
});
};
const marsAll = (req, res) => {
return req.ctx(BaiduLinkSubmit).marsAll(req.query).then(result => {
return res.json(result);
});
};
module.exports = {
index,
autoGoodsXml,
... ... @@ -136,6 +142,7 @@ module.exports = {
newsSitemap,
yohoGirlsAll,
yohoBoysAll,
marsAll,
demoXsd,
demoXml
};
... ...
... ... @@ -8,31 +8,32 @@
const XzhIndexModel = require('../../models/xzh/index');
const index = (req, res) => {
return req.ctx(XzhIndexModel).index().then(result => {
return res.json(result);
});
};
const yohoGirlsAll = (req, res) => {
return req.ctx(XzhIndexModel).yohoGirlsAll().then(result => {
return res.json(result);
});
};
const yohoBoysAll = (req, res) => {
return req.ctx(XzhIndexModel).yohoBoysAll().then(result => {
return res.json(result);
});
};
const marsAll = (req, res) => {
return req.ctx(XzhIndexModel).marsAll().then(result => {
return res.json(result);
});
};
module.exports = {
index,
yohoGirlsAll,
yohoBoysAll
yohoBoysAll,
marsAll,
};
... ...
... ... @@ -421,6 +421,40 @@ class BaiduLinkSubmit extends global.yoho.BaseModel {
})();
}
marsAll() {
let that = this;
return co(function* () {
let initData = {
mip: [],
pc: [],
pcUrl: 'http://www.yohomars.com',
mipUrl: 'http://www.yohomars.com'
};
let rdata = yield Promise.all([
redis.lrangeAsync(`${NEWSKEY}:www_yohomars_com`, 0, 1000),
redis.lrangeAsync(`${NEWSKEY}:mip:www_yohomars_com`, 0, 1000)
]);
initData.pc = _.get(rdata, '[0]', []);
initData.mip = _.get(rdata, '[1]', []);
rdata = yield Promise.all([
that.sendUrl(initData.pc, initData.pcUrl),
that.sendUrl(initData.mip, initData.mipUrl, 'mip')
]);
if (rdata[0].code !== 200 || rdata[1].code !== 200) {
return rdata;
}
initData = {};
return rdata;
})();
}
}
module.exports = BaiduLinkSubmit;
... ...
... ... @@ -96,6 +96,21 @@ class XzhIndexModel extends global.yoho.BaseModel {
})();
}
marsAll() {
let that = this;
return co(function* () {
let urls = yield redis.lrangeAsync(`${NEWSKEY}:mip:www_yohomars_com`, 0, 1000);
let rdata = yield that.sendData(urls, 'batch');
redis.ltrimAsync(`${NEWSKEY}:www_yohomars_com`, 1000, -1);
redis.ltrimAsync(`${NEWSKEY}:mip:www_yohomars_com`, 1000, -1);
return rdata;
})();
}
// 向百度发送数据
sendData(urls, type) {
... ...