...
|
...
|
@@ -9,7 +9,7 @@ const helpers = global.yoho.helpers; |
|
|
const goodsHbs = require(`${ROOT_PATH}/hbs/partials/seo/index.hbs`);
|
|
|
const util = require(`${ROOT_PATH}/libs/util`);
|
|
|
const redis = require(`${ROOT_PATH}/libs/redis`);
|
|
|
const SIZE = 4000;
|
|
|
const SIZE = 3000;
|
|
|
const GOODS_URL = 'http://spiderwebhook.yoho.cn/dist/goods-xml';
|
|
|
|
|
|
class SeoIndexModel extends global.yoho.BaseModel {
|
...
|
...
|
@@ -34,12 +34,13 @@ class SeoIndexModel extends global.yoho.BaseModel { |
|
|
|
|
|
const fWrite = fs.createWriteStream(`${ROOT_PATH}/public/dist/goods-xml/${fileName}`);
|
|
|
|
|
|
fWrite.write(goodsHbs({products: result}).replace(/\s+/g, ' '));// max 9.5M
|
|
|
fWrite.write(goodsHbs({products: result}));// max 9.5M
|
|
|
fWrite.end();
|
|
|
|
|
|
result = [];
|
|
|
|
|
|
console.log(`${GOODS_URL}/${fileName} over...`);
|
|
|
console.log(`${GOODS_URL}/${fileName} over...`);
|
|
|
|
|
|
return {code: 200, data: `${GOODS_URL}/${fileName}`};
|
|
|
});
|
|
|
}
|
...
|
...
|
@@ -56,10 +57,6 @@ class SeoIndexModel extends global.yoho.BaseModel { |
|
|
let data = _.get(rdata, 'data', {});
|
|
|
let productLists = _.get(rdata, 'data.product_list', []);
|
|
|
|
|
|
if (data.page > data.page_total) {
|
|
|
return products;
|
|
|
}
|
|
|
|
|
|
_.each(productLists, item => {
|
|
|
let images = [];
|
|
|
|
...
|
...
|
@@ -134,6 +131,10 @@ class SeoIndexModel extends global.yoho.BaseModel { |
|
|
rdata = [];
|
|
|
productLists = [];
|
|
|
|
|
|
if (data.page >= data.page_total) {
|
|
|
return products;
|
|
|
}
|
|
|
|
|
|
return this.searchGoodsHandle(Object.assign({}, params, {page: ++params.page}), products, sort);
|
|
|
});
|
|
|
}
|
...
|
...
|
|