|
@@ -27,50 +27,62 @@ async function processTask(){
|
|
|
|
|
|
for (let index = 0; index < rows.length; index++) {
|
|
|
let video_product_info = rows[index]
|
|
|
-
|
|
|
- if(video_product_info.product_parent_id==video_product_info.product_id){
|
|
|
+ let data = await require('../src/api/fq/fq_search_book').search_mf_new_id(video_product_info.product_parent_id)
|
|
|
+ if(data!=null){
|
|
|
await connection.execute(
|
|
|
- ` UPDATE video_product SET publish_time = '2000-01-01 01:01:01' WHERE id = ${video_product_info.id} `
|
|
|
+ `UPDATE video_product SET publish_time = ? WHERE id = ${video_product_info.id} `,[data.publish_time]
|
|
|
);
|
|
|
}else{
|
|
|
- let book_info = await video_product_controllers.getProductData({book_id:video_product_info.product_parent_id})
|
|
|
- if(book_info.success){
|
|
|
- if(book_info.data.publish_time!=null){
|
|
|
- let publish_time = helper.getDate7DaysBefore(book_info.data.publish_time,null,'YYYY-MM-DD')
|
|
|
- await connection.execute(
|
|
|
- `UPDATE video_product SET publish_time = ? WHERE id = ${video_product_info.id} `,[publish_time]
|
|
|
- );
|
|
|
- }
|
|
|
- }else{
|
|
|
- //添加到番茄付费里
|
|
|
- let data = await require('../src/api/fq/fq_search_book').search_new_id(video_product_info.product_parent_id)
|
|
|
- if(data!=null){
|
|
|
- let publish_time = data.publish_time
|
|
|
- let words = data.words
|
|
|
- let book_name = data.book_name;
|
|
|
- let genre = 1
|
|
|
- if(words>100000){
|
|
|
- genre = 1;
|
|
|
- }else{
|
|
|
- genre = 3;
|
|
|
- }
|
|
|
- await CMD.insert_product({
|
|
|
- tg_platform_id:config.platform_fanqie,
|
|
|
- book_name:book_name,
|
|
|
- genre:genre,
|
|
|
- book_id:video_product_info.product_parent_id,
|
|
|
- words:words,
|
|
|
- publish_time:publish_time
|
|
|
- })
|
|
|
- }else{
|
|
|
- console.error("没找父书:",video_product_info.product_parent_id)
|
|
|
- await connection.execute(
|
|
|
- ` UPDATE video_product SET status = 0 , publish_time = '2000-01-01 01:01:01' WHERE id = ${video_product_info.id} `
|
|
|
- );
|
|
|
- console.error("查无此书:",video_product_info)
|
|
|
- }
|
|
|
- }
|
|
|
+ await connection.execute(
|
|
|
+ ` UPDATE video_product SET status = 0 , publish_time = '2000-01-01 01:01:01' WHERE id = ${video_product_info.id} `
|
|
|
+ );
|
|
|
+ console.error("查无此书:",video_product_info)
|
|
|
}
|
|
|
+ // if(video_product_info.product_parent_id==video_product_info.product_id){
|
|
|
+ // await connection.execute(
|
|
|
+ // ` UPDATE video_product SET publish_time = '2000-01-01 01:01:01' WHERE id = ${video_product_info.id} `
|
|
|
+ // );
|
|
|
+ // }else{
|
|
|
+ // let book_info = await video_product_controllers.getProductData({book_id:video_product_info.product_parent_id})
|
|
|
+ // if(book_info.success){
|
|
|
+ // if(book_info.data.publish_time!=null){
|
|
|
+ // let publish_time = helper.getDate7DaysBefore(book_info.data.publish_time,null,'YYYY-MM-DD')
|
|
|
+ // await connection.execute(
|
|
|
+ // `UPDATE video_product SET publish_time = ? WHERE id = ${video_product_info.id} `,[publish_time]
|
|
|
+ // );
|
|
|
+ // }
|
|
|
+ // }else{
|
|
|
+ // //添加到番茄付费里
|
|
|
+ // let data = await require('../src/api/fq/fq_search_book').search_new_id(video_product_info.product_parent_id)
|
|
|
+ // if(data!=null){
|
|
|
+ // let publish_time = data.publish_time
|
|
|
+ // let words = data.words
|
|
|
+ // let book_name = data.book_name;
|
|
|
+ // let author = data.author
|
|
|
+ // let genre = 1
|
|
|
+ // if(words>100000){
|
|
|
+ // genre = 1;
|
|
|
+ // }else{
|
|
|
+ // genre = 3;
|
|
|
+ // }
|
|
|
+ // await CMD.insert_product({
|
|
|
+ // tg_platform_id:config.platform_fanqie,
|
|
|
+ // book_name:book_name,
|
|
|
+ // genre:genre,
|
|
|
+ // book_id:video_product_info.product_parent_id,
|
|
|
+ // words:words,
|
|
|
+ // publish_time:publish_time,
|
|
|
+ // author:author
|
|
|
+ // })
|
|
|
+ // }else{
|
|
|
+ // console.error("没找父书:",video_product_info.product_parent_id)
|
|
|
+ // await connection.execute(
|
|
|
+ // ` UPDATE video_product SET status = 0 , publish_time = '2000-01-01 01:01:01' WHERE id = ${video_product_info.id} `
|
|
|
+ // );
|
|
|
+ // console.error("查无此书:",video_product_info)
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+ // }
|
|
|
|
|
|
}
|
|
|
|
|
@@ -97,8 +109,8 @@ CMD.insert_product = async function(data){
|
|
|
genre:data.genre,
|
|
|
product_id:data.book_id,
|
|
|
words:data.words,
|
|
|
- publish_time:data.publish_time
|
|
|
-
|
|
|
+ publish_time:data.publish_time,
|
|
|
+ author:data.author
|
|
|
})
|
|
|
}
|
|
|
CMD.init = async function(){
|