904118851 преди 5 месеца
родител
ревизия
cb0411c64a
променени са 1 файла, в които са добавени 28 реда и са изтрити 1 реда
  1. 28 1
      2_PRODUCT_FACTORY/qm_batch_factory.js

+ 28 - 1
2_PRODUCT_FACTORY/qm_batch_factory.js

@@ -231,6 +231,8 @@ CMD.update_filter_data = async function(FilterConfig,data) {
         await filter_data_controllers.updateFilterData({id:data.id},{status:1,book_id:data.book_id,book_name:data.book_name,genre:data.genre,words:data.words})
         //创建一个小程序    
 
+        await CMD.async_other_books(data)
+
         let MainConfig = await redis_help.getKeyValue("MainConfig")
 
         MainConfig = JSON.parse(MainConfig)
@@ -324,6 +326,31 @@ CMD.update_filter_data = async function(FilterConfig,data) {
 }
 
 
+CMD.async_other_books = async function(data) {
+    let connection  = null
+    try{
+        connection = await mysql.createConnection({
+            ...dbConfig,
+            multipleStatements: true
+        });
+
+        let sql = `UPDATE filter_data SET status = 1 , book_name = "${data.book_name}" , genre = ${data.genre} ,words = "${data.words}" WHERE book_id = "${data.book_id}" AND status = 0 AND tg_platform_id = ${data.tg_platform_id} `
+
+        console.log("async_other_books:",sql)
+
+        await connection.execute(
+            sql
+        );
+
+    }catch(e){
+        console.error("insert_product:",e)
+    }finally{
+        if(connection!=null){
+            await connection.end();
+        }
+    }
+}
+
 CMD.insert_product = async function(data){
     await video_product_controllers.createProductData({
         book_platform:data.tg_platform_id,
@@ -340,7 +367,7 @@ CMD.insert_product = async function(data){
             multipleStatements: true
         });
 
-        let sql = `UPDATE filter_data SET status = 1 , book_name = "${data.book_name}" , genre = ${data.genre} ,words = "${data.words}" WHERE book_id = " ${data.book_id}" AND status = 0 AND tg_platform_id = ${data.tg_platform_id} `
+        let sql = `UPDATE filter_data SET status = 1 , book_name = "${data.book_name}" , genre = ${data.genre} ,words = "${data.words}" WHERE book_id = "${data.book_id}" AND status = 0 AND tg_platform_id = ${data.tg_platform_id} `
 
         await connection.execute(
             sql