|
@@ -10,23 +10,66 @@ const CMD = {}
|
|
|
async function processTask(){
|
|
|
let right_status = true
|
|
|
let connection = null
|
|
|
+ let task_connection = null
|
|
|
try{
|
|
|
+ //清理黑岩堆积数据
|
|
|
//1.遍历书库
|
|
|
//2.每一本书
|
|
|
- // connection = await mysql.createConnection({
|
|
|
- // ...dbConfig,
|
|
|
- // multipleStatements: true
|
|
|
- // });
|
|
|
- let result = await filter_data_controllers.getFilterDataByStatusAndLimit({ status: 0 , tg_platform_id: config.platform_qimao },10,"DESC");
|
|
|
- console.log("result:",result)
|
|
|
+ connection = await mysql.createConnection({
|
|
|
+ ...dbConfig,
|
|
|
+ multipleStatements: true
|
|
|
+ });
|
|
|
+
|
|
|
+ let sql = `SELECT * FROM filter_data WHERE tg_platform_id = 1 AND status = 0 AND weight = 0 LIMIT 1`
|
|
|
+
|
|
|
+ const [row] = await connection.execute(sql)
|
|
|
+
|
|
|
+
|
|
|
+ if(row.length<=0){
|
|
|
+ throw 0
|
|
|
+ }
|
|
|
+
|
|
|
+ let filter_info = row[0]
|
|
|
+
|
|
|
+ task_connection = await mysql.createConnection({
|
|
|
+ ...taskdbConfig,
|
|
|
+ multipleStatements: true
|
|
|
+ });
|
|
|
+
|
|
|
+ sql = `SELECT * FROM video_product WHERE product_id = "${filter_info.book_id}" AND book_platform = 1 LIMIT 1`
|
|
|
+
|
|
|
+ const [video_product_row] = await task_connection.execute(sql)
|
|
|
+
|
|
|
+ if(video_product_row.length<=0){
|
|
|
+ connection.execute(`UPDATE filter_data SET weight = 999 WHERE id = ${filter_info.id}`)
|
|
|
+ throw 999
|
|
|
+ }
|
|
|
+
|
|
|
+ sql = `UPDATE filter_data SET status = 1 , book_name = "${video_product_row.product_name}" , genre = ${video_product_row.genre} ,words = "${data.words}" WHERE book_id = "${video_product_row.product_id}" AND status = 0 AND tg_platform_id = ${video_product_row.book_platform} `
|
|
|
+
|
|
|
+ console.log("processTask:",video_product_row)
|
|
|
+
|
|
|
+ await connection.execute(
|
|
|
+ sql
|
|
|
+ );
|
|
|
+
|
|
|
}catch(e){
|
|
|
if(e==0){
|
|
|
right_status = false
|
|
|
}
|
|
|
console.error("processTask error:",e)
|
|
|
} finally{
|
|
|
+
|
|
|
+ if(connection!=null){
|
|
|
+ connection.end()
|
|
|
+ }
|
|
|
+
|
|
|
+ if(task_connection!=null){
|
|
|
+ task_connection.end()
|
|
|
+ }
|
|
|
+
|
|
|
if(right_status){
|
|
|
- // global.setTimeout(processTask, 1000);
|
|
|
+ global.setTimeout(processTask, 1000);
|
|
|
}
|
|
|
|
|
|
}
|