...
|
...
|
@@ -17,6 +17,7 @@ const config = require('../../../config/config'); |
|
|
const singleBrandKeyPre = config.singleBrandKeyPre;
|
|
|
const singleSortKeyPre = config.singleSortKeyPre;
|
|
|
const qs = require('querystring');
|
|
|
const lestGoodsNum = 3;
|
|
|
|
|
|
const multiAsync=(multi)=>{
|
|
|
return multi.execAsync().then(function(res) {
|
...
|
...
|
@@ -414,12 +415,12 @@ const sendUrlsToBaidu = (params, urls) => { |
|
|
* @params limit url条数
|
|
|
* @return boolean
|
|
|
*/
|
|
|
const sendUrls = (limit) => {
|
|
|
const sendUrls = (limit, page) => {
|
|
|
|
|
|
// 调用limit条未推送关键词
|
|
|
let mysql = new Mysql();
|
|
|
|
|
|
return mysql.query(`select id, keyword from seo_keywords where is_push=0 order by id asc limit ${limit}`).then(d => {
|
|
|
return mysql.query(`select id, keyword from seo_keywords where is_push=0 and yoho_goods_num > ${lestGoodsNum} and status=1 order by id asc limit ${(page-1)*limit}, ${limit}`).then(d => {
|
|
|
let pcPages = [],
|
|
|
wapPages = [];
|
|
|
|
...
|
...
|
@@ -443,7 +444,7 @@ const sendUrls = (limit) => { |
|
|
const getPushTotal = () => {
|
|
|
let mysql = new Mysql();
|
|
|
|
|
|
return mysql.query(`select count(id) from seo_keywords where is_push=0`).then(d=>{
|
|
|
return mysql.query(`select count(id) from seo_keywords where is_push=0 and yoho_goods_num > ${lestGoodsNum} and status=1`).then(d=>{
|
|
|
return _.get(d, '0.count(id)', 0);
|
|
|
});
|
|
|
}
|
...
|
...
|
@@ -452,7 +453,7 @@ const getPushTotal = () => { |
|
|
* 推送url到百度(获取2000条未推送关键词,监测是否还有未推关键词,如果有再推2000,直到全部推送)
|
|
|
*/
|
|
|
|
|
|
r.get('/sendUrl2', async(ctx, next) => {
|
|
|
r.get('/sendUrl', async(ctx, next) => {
|
|
|
let result = {
|
|
|
code: 200,
|
|
|
message: '暂未开放!'
|
...
|
...
|
@@ -469,7 +470,7 @@ r.get('/sendUrl2', async(ctx, next) => { |
|
|
|
|
|
// 推送2000条
|
|
|
let interval = setInterval(() => {
|
|
|
sendUrls(limit);
|
|
|
sendUrls(limit, intervalTime);
|
|
|
|
|
|
if (--intervalTime < 1) {
|
|
|
clearInterval(interval);
|
...
|
...
|
|