|
@@ -65,7 +65,7 @@ async function processTask(){
|
|
if(result.success){
|
|
if(result.success){
|
|
let ProductIds = []
|
|
let ProductIds = []
|
|
let FilterList = []
|
|
let FilterList = []
|
|
-
|
|
|
|
|
|
+ let Ids = []
|
|
if(result.data.length<=0){
|
|
if(result.data.length<=0){
|
|
throw '没有数据可处理!'
|
|
throw '没有数据可处理!'
|
|
}
|
|
}
|
|
@@ -73,10 +73,12 @@ async function processTask(){
|
|
let filter_item = result.data[index];
|
|
let filter_item = result.data[index];
|
|
ProductIds.push(filter_item.book_id)
|
|
ProductIds.push(filter_item.book_id)
|
|
FilterList[filter_item.book_id] = filter_item
|
|
FilterList[filter_item.book_id] = filter_item
|
|
|
|
+ Ids.push(info.id)
|
|
}
|
|
}
|
|
|
|
|
|
let product_list_result = await video_product_controllers.findNonExistentProductIds(ProductIds);
|
|
let product_list_result = await video_product_controllers.findNonExistentProductIds(ProductIds);
|
|
if(product_list_result.success){
|
|
if(product_list_result.success){
|
|
|
|
+
|
|
for (let index = 0; index < result.data.length; index++) {
|
|
for (let index = 0; index < result.data.length; index++) {
|
|
let filter_item = result.data[index];
|
|
let filter_item = result.data[index];
|
|
if(product_list_result.data.existingProductIds.has(filter_item.book_id)){
|
|
if(product_list_result.data.existingProductIds.has(filter_item.book_id)){
|
|
@@ -94,18 +96,16 @@ async function processTask(){
|
|
info.book_name = product_item.product_name
|
|
info.book_name = product_item.product_name
|
|
await CMD.update_filter_data(FilterConfig,info)
|
|
await CMD.update_filter_data(FilterConfig,info)
|
|
await new Promise(resolve => setTimeout(resolve,100));
|
|
await new Promise(resolve => setTimeout(resolve,100));
|
|
- }
|
|
|
|
|
|
+ }
|
|
}
|
|
}
|
|
//找到相同数据的数据进行同步
|
|
//找到相同数据的数据进行同步
|
|
// await findSameFilterData(product_list_result.data.existingRecords,FilterConfig)
|
|
// await findSameFilterData(product_list_result.data.existingRecords,FilterConfig)
|
|
- let Ids = []
|
|
|
|
|
|
+
|
|
for (let index = 0; index < product_list_result.data.nonExistentIds.length; index++) {
|
|
for (let index = 0; index < product_list_result.data.nonExistentIds.length; index++) {
|
|
const product_id = product_list_result.data.nonExistentIds[index];
|
|
const product_id = product_list_result.data.nonExistentIds[index];
|
|
- Ids.push(FilterList[product_id].id)
|
|
|
|
task_queue.push({result:{data:FilterList[product_id]}})
|
|
task_queue.push({result:{data:FilterList[product_id]}})
|
|
}
|
|
}
|
|
if(Ids.length>0){
|
|
if(Ids.length>0){
|
|
- console.log("Ids:",Ids)
|
|
|
|
await filter_data_controllers.updateFilterDataByIds({ids:Ids},{status:1})
|
|
await filter_data_controllers.updateFilterDataByIds({ids:Ids},{status:1})
|
|
}
|
|
}
|
|
|
|
|
|
@@ -133,13 +133,20 @@ async function processCreateTask(){
|
|
let tg_platform_id = result.data.tg_platform_id
|
|
let tg_platform_id = result.data.tg_platform_id
|
|
if(tg_platform_id==config.platform_heiyan){
|
|
if(tg_platform_id==config.platform_heiyan){
|
|
let hy_book_data = await require('./collect_hy_book').runTask(result.data)
|
|
let hy_book_data = await require('./collect_hy_book').runTask(result.data)
|
|
- if(CMD.isGenre(FilterConfig,hy_book_data.genre)){
|
|
|
|
- await CMD.insert_product(hy_book_data)
|
|
|
|
|
|
+ if(hy_book_data!=null){
|
|
|
|
+ if(CMD.isGenre(FilterConfig,hy_book_data.genre)){
|
|
|
|
+ await CMD.insert_product(hy_book_data)
|
|
|
|
+ }
|
|
|
|
+ result.data.words = hy_book_data.words
|
|
|
|
+ result.data.genre = hy_book_data.genre
|
|
|
|
+ result.data.book_id = hy_book_data.book_id
|
|
|
|
+ result.data.book_name = hy_book_data.book_name
|
|
|
|
+ }else{
|
|
|
|
+ result.data.words = 0
|
|
|
|
+ result.data.genre = 999
|
|
|
|
+ result.data.book_id = result.data.book_id
|
|
|
|
+ result.data.book_name = "没有找到这本书"
|
|
}
|
|
}
|
|
- result.data.words = hy_book_data.words
|
|
|
|
- result.data.genre = hy_book_data.genre
|
|
|
|
- result.data.book_id = hy_book_data.book_id
|
|
|
|
- result.data.book_name = hy_book_data.book_name
|
|
|
|
}
|
|
}
|
|
await CMD.update_filter_data(FilterConfig,result.data)
|
|
await CMD.update_filter_data(FilterConfig,result.data)
|
|
}
|
|
}
|