|
@@ -8,6 +8,15 @@ const config = require('../etc/config.json');
|
|
|
const time_count = 1000;
|
|
|
const task_queue = []
|
|
|
|
|
|
+function getProductById(product_list,product_id){
|
|
|
+ for (let index = 0; index < product_list.length; index++) {
|
|
|
+ const product_item = product_list[index];
|
|
|
+ if(product_item.product_id==product_id){
|
|
|
+ return product_item
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return null
|
|
|
+}
|
|
|
async function processTask(){
|
|
|
let result = null
|
|
|
try{
|
|
@@ -37,9 +46,12 @@ async function processTask(){
|
|
|
let filter_item = result.data[index];
|
|
|
if(product_list_result.data.existingProductIds.has(filter_item.book_id)){
|
|
|
let info = FilterList[filter_item.book_id];
|
|
|
+ let product_item = getProductById(product_list_result.data.existingRecords,filter_item.book_id)
|
|
|
if (!info) {
|
|
|
- console.error(`No filter info found for book_id: ${filter_item.book_id}`);
|
|
|
- continue;
|
|
|
+ throw `No filter info found for book_id: ${filter_item.book_id}`
|
|
|
+ }
|
|
|
+ if (!product_item) {
|
|
|
+ throw `product_item is null: ${filter_item.book_id}`
|
|
|
}
|
|
|
info.words = product_item.words
|
|
|
info.genre = product_item.genre
|