Authored by 周少峰

del log

... ... @@ -400,15 +400,14 @@ const sendUrlsToBaidu = (params, urls) => {
gzip: true
};
return rp(options).then(result => {
logger.info(Object.assign(params, result, {length: urls.length}));
if (result) {
return true;
//return rp(options).then(result => {
// logger.info(Object.assign(params, result, {length: urls.length}));
// if (result) {
// return true;
// } else {
// return false;
// }
//});
} else {
return false;
}
});
};
/**
* 推送urls
... ... @@ -420,12 +419,10 @@ const sendUrls = (limit) => {
// 调用limit条未推送关键词
let mysql = new Mysql();
console.log('sendUrl exe');
return mysql.query(`select id, keyword from seo_keywords where is_push=0 order by id asc limit ${limit}`).then(d => {
let pcPages = [],
wapPages = [];
console.log(d);
_.forEach(d, (val) => {
pcPages.push(`https://www.yohobuy.com/chanpin/${val.id}.html`);
wapPages.push(`https://m.yohobuy.com/chanpin/${val.id}.html`);
... ... @@ -435,11 +432,8 @@ const sendUrls = (limit) => {
return Promise.all([sendUrlsToBaidu({site: 'https://www.yohobuy.com'}, pcPages),sendUrlsToBaidu({site: 'https://m.yohobuy.com'}, wapPages)]).then(result => {
let updateSql = `UPDATE seo_keywords SET is_push = 1 WHERE id >= ${_.get(_.first(d), 'id')} and id <= ${_.get(_.last(d), 'id')}`;
console.log(updateSql);
// 更新关键词推送状态
return mysql.query(updateSql).then(updateRes => {
console.log(updateRes);
return updateRes;
});
})
... ...