904118851 5 månader sedan
förälder
incheckning
d7cd55ac5f

+ 22 - 17
2_PRODUCT_FACTORY/dz_batch_factory.js

@@ -5,6 +5,7 @@ const other_book_controllers = require('../src/data_manager/Controllers/other_bo
 const video_applet_product_controllers = require('../src/data_manager/Controllers/video_applet_product_controllers');
 const redis_help = require('../src/use_redis');
 const config = require('../etc/config.json');
+const tools = require('../tools');
 const time_count = 1000;
 const task_queue = []
 
@@ -279,25 +280,29 @@ CMD.update_filter_data = async function(FilterConfig,data) {
                         let word = data.words
                         let material_platform_id = main_info.material_platform_id
                         if(!CMD.isBlackBook(black_books,data.book_id)&&word>=min_book_word&&word<=max_book_word){
+                            let butler_video_applet_info = await tools.getAppletProductDataByButlerId(butler_id,data.book_id,data.main_id)
                             //符合标准进行创建表
-                            const result = await video_applet_product_controllers.getAppletProductData({book_id:data.book_id,main_id:data.main_id})
-                            if(!result.success){
-                                //没有找到 可以创建
-                                await video_applet_product_controllers.createAppletProductData({
-                                    book_platform:config.platform_dianzhong,
-                                    product_name:data.book_name,
-                                    product_id:data.book_id,
-                                    dy_small_program_start:"",
-                                    dy_small_program_start_data:"",
-                                    dy_small_applet_app_id:data.app_id,
-                                    status:0,
-                                    main_id:data.main_id,
-                                    promotion_id:"",
-                                    wait_status:0,
-                                    material_platform_id:material_platform_id,
-                                    butler_id:butler_id
-                                })
+                            if(butler_video_applet_info==null){
+                                const result = await video_applet_product_controllers.getAppletProductData({book_id:data.book_id,main_id:data.main_id})
+                                if(!result.success){
+                                    //没有找到 可以创建
+                                    await video_applet_product_controllers.createAppletProductData({
+                                        book_platform:config.platform_dianzhong,
+                                        product_name:data.book_name,
+                                        product_id:data.book_id,
+                                        dy_small_program_start:"",
+                                        dy_small_program_start_data:"",
+                                        dy_small_applet_app_id:data.app_id,
+                                        status:0,
+                                        main_id:data.main_id,
+                                        promotion_id:"",
+                                        wait_status:0,
+                                        material_platform_id:material_platform_id,
+                                        butler_id:butler_id
+                                    })
+                                }
                             }
+                  
                         }
                     }
                 }

+ 21 - 17
2_PRODUCT_FACTORY/fq_factory.js

@@ -305,24 +305,28 @@ CMD.update_filter_data = async function(FilterConfig,data) {
                         let material_platform_id = main_info.material_platform_id
                         if(!CMD.isBlackBook(black_books,data.book_id)&&word>=min_book_word&&word<=max_book_word){
                             //符合标准进行创建表
-                            const result = await video_applet_product_controllers.getAppletProductData({book_id:data.book_id,main_id:data.main_id})
-                            if(!result.success){
-                                //没有找到 可以创建
-                                await video_applet_product_controllers.createAppletProductData({
-                                    book_platform:config.platform_fanqie,
-                                    product_name:data.book_name,
-                                    product_id:data.book_id,
-                                    dy_small_program_start:"",
-                                    dy_small_program_start_data:"",
-                                    dy_small_applet_app_id:data.app_id,
-                                    status:0,
-                                    main_id:data.main_id,
-                                    promotion_id:"",
-                                    wait_status:0,
-                                    material_platform_id:material_platform_id,
-                                    butler_id:butler_id
-                                })
+                            let butler_video_applet_info = await tools.getAppletProductDataByButlerId(butler_id,data.book_id,data.main_id)
+                            if(butler_video_applet_info==null){
+                                const result = await video_applet_product_controllers.getAppletProductData({book_id:data.book_id,main_id:data.main_id})
+                                if(!result.success){
+                                    //没有找到 可以创建
+                                    await video_applet_product_controllers.createAppletProductData({
+                                        book_platform:config.platform_fanqie,
+                                        product_name:data.book_name,
+                                        product_id:data.book_id,
+                                        dy_small_program_start:"",
+                                        dy_small_program_start_data:"",
+                                        dy_small_applet_app_id:data.app_id,
+                                        status:0,
+                                        main_id:data.main_id,
+                                        promotion_id:"",
+                                        wait_status:0,
+                                        material_platform_id:material_platform_id,
+                                        butler_id:butler_id
+                                    })
+                                }
                             }
+                           
                         }
                     }
                 }

+ 20 - 17
2_PRODUCT_FACTORY/fq_mf_factory.js

@@ -245,23 +245,26 @@ CMD.update_filter_data = async function(FilterConfig,data) {
                     let material_platform_id = main_info.material_platform_id
                     if(!CMD.isBlackBook(black_books,data.book_id)&&word>=min_book_word&&word<=max_book_word){
                         //符合标准进行创建表
-                        const result = await video_applet_product_controllers.getAppletProductData({book_id:data.book_id,main_id:data.main_id})
-                        if(!result.success){
-                            //没有找到 可以创建
-                            await video_applet_product_controllers.createAppletProductData({
-                                book_platform:config.platform_fanqiemf,
-                                product_name:data.book_name,
-                                product_id:data.book_id,
-                                dy_small_program_start:"",
-                                dy_small_program_start_data:"",
-                                dy_small_applet_app_id:data.app_id,
-                                status:0,
-                                main_id:data.main_id,
-                                promotion_id:"",
-                                wait_status:0,
-                                material_platform_id:material_platform_id,
-                                butler_id:butler_id 
-                            })
+                        let butler_video_applet_info = await tools.getAppletProductDataByButlerId(butler_id,data.book_id,data.main_id)
+                        if(butler_video_applet_info==null){
+                            const result = await video_applet_product_controllers.getAppletProductData({book_id:data.book_id,main_id:data.main_id})
+                            if(!result.success){
+                                //没有找到 可以创建
+                                await video_applet_product_controllers.createAppletProductData({
+                                    book_platform:config.platform_fanqiemf,
+                                    product_name:data.book_name,
+                                    product_id:data.book_id,
+                                    dy_small_program_start:"",
+                                    dy_small_program_start_data:"",
+                                    dy_small_applet_app_id:data.app_id,
+                                    status:0,
+                                    main_id:data.main_id,
+                                    promotion_id:"",
+                                    wait_status:0,
+                                    material_platform_id:material_platform_id,
+                                    butler_id:butler_id 
+                                })
+                            }
                         }
                     }
                 }

+ 43 - 29
2_PRODUCT_FACTORY/hy_batch_factory.js

@@ -5,6 +5,7 @@ const video_applet_product_controllers = require('../src/data_manager/Controller
 const redis_help = require('../src/use_redis');
 const config = require('../etc/config.json');
 const other_book_controllers = require('../src/data_manager/Controllers/other_book_controllers');
+const tools = require('../tools');
 const time_count = 1000;
 const task_queue = []
 
@@ -107,6 +108,7 @@ async function processTask(){
                         info.genre =  product_item.genre
                         info.book_id = product_item.product_id
                         info.book_name = product_item.product_name
+                        info.book_platform = product_item.book_platform
                         await CMD.update_filter_data(FilterConfig,info)
                         await updateSameProductId(UpdateProductList[info.book_id],info)
                         await new Promise(resolve => setTimeout(resolve,100));
@@ -159,7 +161,6 @@ async function processCreateTask(){
                         if(hy_book_data.is_c500){
                             hy_book_data.tg_platform_id = config.platform_heiyanmf
                         }
-    
                         if(hy_book_data.genre==1){ //长篇给黑岩免费长篇添加进去
                             await CMD.insert_product({
                                 tg_platform_id:config.platform_heiyanmf,
@@ -174,6 +175,7 @@ async function processCreateTask(){
                         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
+                        result.data.book_platform = hy_book_data.tg_platform_id
                     }else{
                         result.data.words = 0
                         result.data.genre = 999
@@ -187,6 +189,7 @@ async function processCreateTask(){
                 result.data.genre = product.genre
                 result.data.book_id = product.product_id
                 result.data.book_name = product.product_name
+                result.data.book_platform = product.book_platform
             }
             await CMD.update_filter_data(FilterConfig,result.data)
         }
@@ -228,12 +231,18 @@ CMD.isBlackBook = function(all_black_books,book_id){
     }
     return false
 }
-CMD.getMainInfoByAppid = function(MainConfig,app_id){
+CMD.getMainInfoByAppid = function(MainConfig,app_id,isMf){
     let list = []
     for (let index = 0; index < MainConfig.length; index++) {
         const element = MainConfig[index];
         if(element.app_id==app_id){
-            list.push(element)
+            if(isMf){
+                if(config.platform_heiyanmf==element.tg_platform_id){
+                    list.push(element)
+                }
+            }else{
+                list.push(element)
+            }
         }
     }
     return list
@@ -273,7 +282,8 @@ CMD.getSharedPlatform = function(PlatformShared,platform_shared_id){
 CMD.update_filter_data = async function(FilterConfig,data) {
     // let isGenre = CMD.isGenre(FilterConfig,data.genre)
     let isGenre = true
-    // console.log("data.genre:",data.genre,data,isGenre)
+    let isMf = data.book_platform==config.platform_heiyanmf
+    console.log("data.book_platform:",data.book_platform)
     if(isGenre){
 
         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})
@@ -290,7 +300,7 @@ CMD.update_filter_data = async function(FilterConfig,data) {
 
         PlatformConfig = JSON.parse(PlatformConfig)
 
-        let PlatformInfo = CMD.getPlatformInfo(PlatformConfig,config.platform_heiyan)
+        let PlatformInfo = CMD.getPlatformInfo(PlatformConfig,isMf==true?config.platform_heiyanmf:config.platform_heiyan)
 
         console.log("PlatformInfo:",PlatformInfo)
 
@@ -315,7 +325,7 @@ CMD.update_filter_data = async function(FilterConfig,data) {
 
                 MainConfig = JSON.parse(MainConfig)
 
-                let list = CMD.getMainInfoByAppid(MainConfig,data.app_id)
+                let list = CMD.getMainInfoByAppid(MainConfig,data.app_id,isMf)
 
                 if(list.length<0){
                     return console.error("获取主体错误:",data)
@@ -332,6 +342,7 @@ CMD.update_filter_data = async function(FilterConfig,data) {
                     data.main_id = main_info.id
                     data.main_name = main_info.main_name
                     let butler_id = main_info.butler_id
+
                     if(main_info.tg_link_config==undefined||main_info.tg_link_config==null){
                         console.error("主体配置推广链接错误:",main_info)
                     }else{
@@ -343,30 +354,33 @@ CMD.update_filter_data = async function(FilterConfig,data) {
                         let word = data.words
                         if(!CMD.isBlackBook(black_books,data.book_id)&&word>=min_book_word&&word<=max_book_word){
                             //符合标准进行创建表
-                            const result = await video_applet_product_controllers.getAppletProductData({book_id:data.book_id,main_id:data.main_id})
-                            if(!result.success){
-
-                                let table_data = {
-                                    book_platform:config.platform_heiyan,
-                                    product_name:data.book_name,
-                                    product_id:data.book_id,
-                                    dy_small_program_start:"",
-                                    dy_small_program_start_data:"",
-                                    dy_small_applet_app_id:data.app_id,
-                                    status:0,
-                                    main_id:data.main_id,
-                                    promotion_id:"",
-                                    wait_status:0,
-                                    material_platform_id:material_platform_id,
-                                    butler_id:butler_id
-                                }
-
-                                if(main_info.pay_type==0){
-                                    table_data.book_platform = config.platform_heiyanmf
-                                    table_data.product_parent_id = data.product_parent_id
+                            let butler_video_applet_info = await tools.getAppletProductDataByButlerId(butler_id,data.book_id,data.main_id)
+                            if(butler_video_applet_info==null){
+                                const result = await video_applet_product_controllers.getAppletProductData({book_id:data.book_id,main_id:data.main_id})
+                                if(!result.success){
+    
+                                    let table_data = {
+                                        book_platform:config.platform_heiyan,
+                                        product_name:data.book_name,
+                                        product_id:data.book_id,
+                                        dy_small_program_start:"",
+                                        dy_small_program_start_data:"",
+                                        dy_small_applet_app_id:data.app_id,
+                                        status:0,
+                                        main_id:data.main_id,
+                                        promotion_id:"",
+                                        wait_status:0,
+                                        material_platform_id:material_platform_id,
+                                        butler_id:butler_id
+                                    }
+    
+                                    if(main_info.pay_type==0){
+                                        table_data.book_platform = config.platform_heiyanmf
+                                        table_data.product_parent_id = data.product_parent_id
+                                    }
+                                    //没有找到 可以创建
+                                    await video_applet_product_controllers.createAppletProductData(table_data)
                                 }
-                                //没有找到 可以创建
-                                await video_applet_product_controllers.createAppletProductData(table_data)
                             }
                         }
                     }

+ 22 - 18
2_PRODUCT_FACTORY/qm_batch_factory.js

@@ -8,6 +8,7 @@ const config = require('../etc/config.json');
 const time_count = 1000;
 const task_queue = []
 const mysql = require('mysql2/promise');
+const tools = require('../tools');
 const dbConfig = config.isDebug?config.debug_mysql:config.release_mysql
 const taskdbConfig = config.isDebug?config.debug_task_mysql:config.release_task_mysql
 
@@ -30,7 +31,7 @@ async function processTask(){
         }
         let FilterConfig = await redis_help.getKeyValue("FilterConfig")
         FilterConfig = JSON.parse(FilterConfig)
-        result = await filter_data_controllers.getFilterDataByStatusAndLimit({ status: 0 , tg_platform_id: config.platform_qimao },500);
+        result = await filter_data_controllers.getFilterDataByStatusAndLimit({ status: 0 , tg_platform_id: config.platform_qimao },500,"DESC");
         if(result.success){
             let ProductIds = []
             let FilterList = []
@@ -290,23 +291,26 @@ CMD.update_filter_data = async function(FilterConfig,data) {
                         let material_platform_id = main_info.material_platform_id
                         if(!CMD.isBlackBook(black_books,data.book_id)&&word>=min_book_word&&word<=max_book_word){
                             //符合标准进行创建表
-                            const result = await video_applet_product_controllers.getAppletProductData({book_id:data.book_id,main_id:data.main_id})
-                            if(!result.success){
-                                //没有找到 可以创建
-                                await video_applet_product_controllers.createAppletProductData({
-                                    book_platform:config.platform_qimao,
-                                    product_name:data.book_name,
-                                    product_id:data.book_id,
-                                    dy_small_program_start:"",
-                                    dy_small_program_start_data:"",
-                                    dy_small_applet_app_id:data.app_id,
-                                    status:0,
-                                    main_id:data.main_id,
-                                    promotion_id:"",
-                                    wait_status:0,
-                                    material_platform_id:material_platform_id,
-                                    butler_id:butler_id
-                                })
+                            let butler_video_applet_info = await tools.getAppletProductDataByButlerId(butler_id,data.book_id,data.main_id)
+                            if(butler_video_applet_info==null){
+                                const result = await video_applet_product_controllers.getAppletProductData({book_id:data.book_id,main_id:data.main_id})
+                                if(!result.success){
+                                    //没有找到 可以创建
+                                    await video_applet_product_controllers.createAppletProductData({
+                                        book_platform:config.platform_qimao,
+                                        product_name:data.book_name,
+                                        product_id:data.book_id,
+                                        dy_small_program_start:"",
+                                        dy_small_program_start_data:"",
+                                        dy_small_applet_app_id:data.app_id,
+                                        status:0,
+                                        main_id:data.main_id,
+                                        promotion_id:"",
+                                        wait_status:0,
+                                        material_platform_id:material_platform_id,
+                                        butler_id:butler_id
+                                    })
+                                }
                             }
                         }
                     }

+ 22 - 18
2_PRODUCT_FACTORY/qm_mf_batch_factory.js

@@ -6,6 +6,7 @@ const other_book_controllers = require('../src/data_manager/Controllers/other_bo
 const redis_help = require('../src/use_redis');
 const config = require('../etc/config.json');
 const mysql = require('mysql2/promise');
+const tools = require('../tools');
 const dbConfig = config.isDebug?config.debug_mysql:config.release_mysql
 const taskdbConfig = config.isDebug?config.debug_task_mysql:config.release_task_mysql
 const time_count = 1000;
@@ -30,7 +31,7 @@ async function processTask(){
         }
         let FilterConfig = await redis_help.getKeyValue("FilterConfig")
         FilterConfig = JSON.parse(FilterConfig)
-        result = await filter_data_controllers.getFilterDataByStatusAndLimit({ status: 0 , tg_platform_id: config.platform_qmmf },500);
+        result = await filter_data_controllers.getFilterDataByStatusAndLimit({ status: 0 , tg_platform_id: config.platform_qmmf },500,"DESC");
         if(result.success){
             let ProductIds = []
             let FilterList = []
@@ -290,23 +291,26 @@ CMD.update_filter_data = async function(FilterConfig,data) {
                         let material_platform_id = main_info.material_platform_id
                         if(!CMD.isBlackBook(black_books,data.book_id)&&word>=min_book_word&&word<=max_book_word){
                             //符合标准进行创建表
-                            const result = await video_applet_product_controllers.getAppletProductData({book_id:data.book_id,main_id:data.main_id})
-                            if(!result.success){
-                                //没有找到 可以创建
-                                await video_applet_product_controllers.createAppletProductData({
-                                    book_platform:config.platform_qmmf,
-                                    product_name:data.book_name,
-                                    product_id:data.book_id,
-                                    dy_small_program_start:"",
-                                    dy_small_program_start_data:"",
-                                    dy_small_applet_app_id:data.app_id,
-                                    status:0,
-                                    main_id:data.main_id,
-                                    promotion_id:"",
-                                    wait_status:0,
-                                    material_platform_id:material_platform_id,
-                                    butler_id:butler_id
-                                })
+                            let butler_video_applet_info = await tools.getAppletProductDataByButlerId(butler_id,data.book_id,data.main_id)
+                            if(butler_video_applet_info==null){
+                                const result = await video_applet_product_controllers.getAppletProductData({book_id:data.book_id,main_id:data.main_id})
+                                if(!result.success){
+                                    //没有找到 可以创建
+                                    await video_applet_product_controllers.createAppletProductData({
+                                        book_platform:config.platform_qmmf,
+                                        product_name:data.book_name,
+                                        product_id:data.book_id,
+                                        dy_small_program_start:"",
+                                        dy_small_program_start_data:"",
+                                        dy_small_applet_app_id:data.app_id,
+                                        status:0,
+                                        main_id:data.main_id,
+                                        promotion_id:"",
+                                        wait_status:0,
+                                        material_platform_id:material_platform_id,
+                                        butler_id:butler_id
+                                    })
+                                }
                             }
                         }
                     }

+ 20 - 17
2_PRODUCT_FACTORY/yw_batch_factory.js

@@ -291,23 +291,26 @@ CMD.update_filter_data = async function(FilterConfig,data) {
                         let material_platform_id = main_info.material_platform_id
                         if(!CMD.isBlackBook(black_books,data.book_id)&&word>=min_book_word&&word<=max_book_word){
                             //符合标准进行创建表
-                            const result = await video_applet_product_controllers.getAppletProductData({book_id:data.book_id,main_id:data.main_id})
-                            if(!result.success){
-                                //没有找到 可以创建
-                                await video_applet_product_controllers.createAppletProductData({
-                                    book_platform:config.platform_yuewen,
-                                    product_name:data.book_name,
-                                    product_id:data.book_id,
-                                    dy_small_program_start:"",
-                                    dy_small_program_start_data:"",
-                                    dy_small_applet_app_id:data.app_id,
-                                    status:0,
-                                    main_id:data.main_id,
-                                    promotion_id:"",
-                                    wait_status:0,
-                                    material_platform_id:material_platform_id,
-                                    butler_id:butler_id
-                                })
+                            let butler_video_applet_info = await tools.getAppletProductDataByButlerId(butler_id,data.book_id,data.main_id)
+                            if(butler_video_applet_info==null){
+                                const result = await video_applet_product_controllers.getAppletProductData({book_id:data.book_id,main_id:data.main_id})
+                                if(!result.success){
+                                    //没有找到 可以创建
+                                    await video_applet_product_controllers.createAppletProductData({
+                                        book_platform:config.platform_yuewen,
+                                        product_name:data.book_name,
+                                        product_id:data.book_id,
+                                        dy_small_program_start:"",
+                                        dy_small_program_start_data:"",
+                                        dy_small_applet_app_id:data.app_id,
+                                        status:0,
+                                        main_id:data.main_id,
+                                        promotion_id:"",
+                                        wait_status:0,
+                                        material_platform_id:material_platform_id,
+                                        butler_id:butler_id
+                                    })
+                                }
                             }
                         }
                     }

+ 21 - 17
2_PRODUCT_FACTORY/zh_batch_factory.js

@@ -5,6 +5,7 @@ const video_applet_product_controllers = require('../src/data_manager/Controller
 const other_book_controllers = require('../src/data_manager/Controllers/other_book_controllers');
 const redis_help = require('../src/use_redis');
 const config = require('../etc/config.json');
+const tools = require('../tools');
 const time_count = 1000;
 const task_queue = []
 
@@ -283,23 +284,26 @@ CMD.update_filter_data = async function(FilterConfig,data) {
                         let material_platform_id = main_info.material_platform_id
                         if(!CMD.isBlackBook(black_books,data.book_id)&&word>=min_book_word&&word<=max_book_word){
                             //符合标准进行创建表
-                            const result = await video_applet_product_controllers.getAppletProductData({book_id:data.book_id,main_id:data.main_id})
-                            if(!result.success){
-                                //没有找到 可以创建
-                                await video_applet_product_controllers.createAppletProductData({
-                                    book_platform:config.platform_zhihu,
-                                    product_name:data.book_name,
-                                    product_id:data.book_id,
-                                    dy_small_program_start:"",
-                                    dy_small_program_start_data:"",
-                                    dy_small_applet_app_id:data.app_id,
-                                    status:0,
-                                    main_id:data.main_id,
-                                    promotion_id:"",
-                                    wait_status:0,
-                                    material_platform_id:material_platform_id,
-                                    butler_id:butler_id
-                                })
+                            let butler_video_applet_info = await tools.getAppletProductDataByButlerId(butler_id,data.book_id,data.main_id)
+                            if(butler_video_applet_info==null){
+                                const result = await video_applet_product_controllers.getAppletProductData({book_id:data.book_id,main_id:data.main_id})
+                                if(!result.success){
+                                    //没有找到 可以创建
+                                    await video_applet_product_controllers.createAppletProductData({
+                                        book_platform:config.platform_zhihu,
+                                        product_name:data.book_name,
+                                        product_id:data.book_id,
+                                        dy_small_program_start:"",
+                                        dy_small_program_start_data:"",
+                                        dy_small_applet_app_id:data.app_id,
+                                        status:0,
+                                        main_id:data.main_id,
+                                        promotion_id:"",
+                                        wait_status:0,
+                                        material_platform_id:material_platform_id,
+                                        butler_id:butler_id
+                                    })
+                                }
                             }
                         }
                     }

+ 3 - 2
5_CREATE_LINK_FACTORY/dz_create_link_factory.js

@@ -11,8 +11,9 @@ let finish_call_back = async function(new_data,error_info=null){
                 dy_small_program_start:new_data.start_page,
                 dy_small_program_start_data:new_data.start_param,
                 promotion_id:new_data.promotion_id,
-                wait_status:1,
-                status:0
+                wait_status:2,
+                status:1,
+                check_url:"https://n8-adv-ocean.s6kuwan.com"
             })
         }else{
             const result = await video_applet_product_controllers.updateData({id:new_data.id},{

+ 6 - 5
5_CREATE_LINK_FACTORY/fq_create_link_factory.js

@@ -8,11 +8,12 @@ let finish_call_back = async function(new_data,error_info=null){
     try{
         if(new_data.start_page != null && error_info==null){
             const result = await video_applet_product_controllers.updateData({id:new_data.id},{
-                dy_small_program_start:new_data.start_page,
-                dy_small_program_start_data:new_data.start_param,
-                promotion_id:new_data.promotion_id,
-                wait_status:1,
-                status:0
+                    dy_small_program_start:new_data.start_page,
+                    dy_small_program_start_data:new_data.start_param,
+                    promotion_id:new_data.promotion_id,
+                    wait_status:2,
+                    status:1,
+                    check_url:"https://n8-adv-ocean.s6kuwan.com"
             })
         }else{
             const result = await video_applet_product_controllers.updateData({id:new_data.id},{

+ 6 - 5
5_CREATE_LINK_FACTORY/fqmf_create_link_factory.js

@@ -8,11 +8,12 @@ let finish_call_back = async function(new_data,error_info=null){
     try{
         if(new_data.start_page != null && error_info==null){
             const result = await video_applet_product_controllers.updateData({id:new_data.id},{
-                dy_small_program_start:new_data.start_page,
-                dy_small_program_start_data:new_data.start_param,
-                promotion_id:new_data.promotion_id,
-                wait_status:1,
-                status:0
+                    dy_small_program_start:new_data.start_page,
+                    dy_small_program_start_data:new_data.start_param,
+                    promotion_id:new_data.promotion_id,
+                    wait_status:2,
+                    status:1,
+                    check_url:"https://n8-adv-ocean.s6kuwan.com"
             })
         }else{
             const result = await video_applet_product_controllers.updateData({id:new_data.id},{

+ 6 - 5
5_CREATE_LINK_FACTORY/hy_create_link_factory.js

@@ -8,11 +8,12 @@ let finish_call_back = async function(new_data,error_info=null){
     try{
         if(new_data.start_page != null && error_info==null){
             const result = await video_applet_product_controllers.updateData({id:new_data.id},{
-                dy_small_program_start:new_data.start_page,
-                dy_small_program_start_data:new_data.start_param,
-                promotion_id:new_data.promotion_id,
-                wait_status:1,
-                status:0
+                    dy_small_program_start:new_data.start_page,
+                    dy_small_program_start_data:new_data.start_param,
+                    promotion_id:new_data.promotion_id,
+                    wait_status:2,
+                    status:1,
+                    check_url:"https://n8-adv-ocean.s6kuwan.com"
             })
         }else{
             const result = await video_applet_product_controllers.updateData({id:new_data.id},{

+ 6 - 5
5_CREATE_LINK_FACTORY/hymf_create_link_factory.js

@@ -8,11 +8,12 @@ let finish_call_back = async function(new_data,error_info=null){
     try{
         if(new_data.start_page != null && error_info==null){
             const result = await video_applet_product_controllers.updateData({id:new_data.id},{
-                dy_small_program_start:new_data.start_page,
-                dy_small_program_start_data:new_data.start_param,
-                promotion_id:new_data.promotion_id,
-                wait_status:1,
-                status:0
+                    dy_small_program_start:new_data.start_page,
+                    dy_small_program_start_data:new_data.start_param,
+                    promotion_id:new_data.promotion_id,
+                    wait_status:2,
+                    status:1,
+                    check_url:"https://n8-adv-ocean.s6kuwan.com"
             })
         }else{
             const result = await video_applet_product_controllers.updateData({id:new_data.id},{

+ 6 - 5
5_CREATE_LINK_FACTORY/qm_create_link_factory.js

@@ -8,11 +8,12 @@ let finish_call_back = async function(new_data,error_info=null){
     try{
         if(new_data.start_page != null && error_info==null){
             const result = await video_applet_product_controllers.updateData({id:new_data.id},{
-                dy_small_program_start:new_data.start_page,
-                dy_small_program_start_data:new_data.start_param,
-                promotion_id:new_data.promotion_id,
-                wait_status:1,
-                status:0
+                    dy_small_program_start:new_data.start_page,
+                    dy_small_program_start_data:new_data.start_param,
+                    promotion_id:new_data.promotion_id,
+                    wait_status:2,
+                    status:1,
+                    check_url:"https://n8-adv-ocean.s6kuwan.com"
             })
         }else{
             const result = await video_applet_product_controllers.updateData({id:new_data.id},{

+ 6 - 5
5_CREATE_LINK_FACTORY/qm_mf_create_link_factory.js

@@ -8,11 +8,12 @@ let finish_call_back = async function(new_data,error_info=null){
     try{
         if(new_data.start_page != null && error_info==null){
             const result = await video_applet_product_controllers.updateData({id:new_data.id},{
-                dy_small_program_start:new_data.start_page,
-                dy_small_program_start_data:new_data.start_param,
-                promotion_id:new_data.promotion_id,
-                wait_status:1,
-                status:0
+                    dy_small_program_start:new_data.start_page,
+                    dy_small_program_start_data:new_data.start_param,
+                    promotion_id:new_data.promotion_id,
+                    wait_status:2,
+                    status:1,
+                    check_url:"https://n8-adv-ocean.s6kuwan.com"
             })
         }else{
             const result = await video_applet_product_controllers.updateData({id:new_data.id},{

+ 6 - 5
5_CREATE_LINK_FACTORY/yw_create_link_factory.js

@@ -9,11 +9,12 @@ let finish_call_back = async function(new_data,error_info=null){
     try{
         if(new_data.start_page != null && error_info==null){
             const result = await video_applet_product_controllers.updateData({id:new_data.id},{
-                dy_small_program_start:new_data.start_page,
-                dy_small_program_start_data:new_data.start_param,
-                promotion_id:new_data.promotion_id,
-                wait_status:1,
-                status:0
+                    dy_small_program_start:new_data.start_page,
+                    dy_small_program_start_data:new_data.start_param,
+                    promotion_id:new_data.promotion_id,
+                    wait_status:2,
+                    status:1,
+                    check_url:"https://n8-adv-ocean.s6kuwan.com"
             })
         }else{
             const result = await video_applet_product_controllers.updateData({id:new_data.id},{

+ 6 - 5
5_CREATE_LINK_FACTORY/zh_create_link_factory.js

@@ -9,11 +9,12 @@ let finish_call_back = async function(new_data,error_info=null){
     try{
         if(new_data.start_page != null && error_info==null){
             const result = await video_applet_product_controllers.updateData({id:new_data.id},{
-                dy_small_program_start:new_data.start_page,
-                dy_small_program_start_data:new_data.start_param,
-                promotion_id:new_data.promotion_id,
-                wait_status:1,
-                status:0
+                    dy_small_program_start:new_data.start_page,
+                    dy_small_program_start_data:new_data.start_param,
+                    promotion_id:new_data.promotion_id,
+                    wait_status:2,
+                    status:1,
+                    check_url:"https://n8-adv-ocean.s6kuwan.com"
             })
         }else{
             const result = await video_applet_product_controllers.updateData({id:new_data.id},{

+ 13 - 0
logs/combined.log

@@ -1,4 +1,16 @@
 <<<<<<< HEAD
+2025-03-27T18:35:02: 
+2025-03-27T18:35:02: > heiyan@1.0.0 start
+2025-03-27T18:35:02: > node tg_factory_main.js
+2025-03-27T18:35:02: 
+2025-03-27T18:35:06: Connected to Redis
+2025-03-27T18:40:28: 
+2025-03-27T18:40:28: > heiyan@1.0.0 start
+2025-03-27T18:40:28: > node tg_factory_main.js
+2025-03-27T18:40:28: 
+2025-03-27T18:40:31: Connected to Redis
+=======
+<<<<<<< HEAD
 2025-03-25T11:30:03: 
 2025-03-25T11:30:03: > heiyan@1.0.0 start
 2025-03-25T11:30:03: > node tg_factory_main.js
@@ -43,3 +55,4 @@
 >>>>>>> 56ee8c7424952aef3f7381c17c1e522664c5b208
 >>>>>>> 8087ec3f1d4a7a8b243309f6f18e865a524348c0
 >>>>>>> 0b144be220dc013186aafed8f5d848e41bd655a0
+>>>>>>> af064582f8d2f0b664cb1f5b9d17f8f45bdba756

+ 13 - 0
logs/out.log

@@ -1,4 +1,16 @@
 <<<<<<< HEAD
+2025-03-27T18:35:02: 
+2025-03-27T18:35:02: > heiyan@1.0.0 start
+2025-03-27T18:35:02: > node tg_factory_main.js
+2025-03-27T18:35:02: 
+2025-03-27T18:35:06: Connected to Redis
+2025-03-27T18:40:28: 
+2025-03-27T18:40:28: > heiyan@1.0.0 start
+2025-03-27T18:40:28: > node tg_factory_main.js
+2025-03-27T18:40:28: 
+2025-03-27T18:40:31: Connected to Redis
+=======
+<<<<<<< HEAD
 2025-03-25T11:30:03: 
 2025-03-25T11:30:03: > heiyan@1.0.0 start
 2025-03-25T11:30:03: > node tg_factory_main.js
@@ -43,3 +55,4 @@
 >>>>>>> 56ee8c7424952aef3f7381c17c1e522664c5b208
 >>>>>>> 8087ec3f1d4a7a8b243309f6f18e865a524348c0
 >>>>>>> 0b144be220dc013186aafed8f5d848e41bd655a0
+>>>>>>> af064582f8d2f0b664cb1f5b9d17f8f45bdba756

+ 0 - 14
pm2json.json

@@ -153,20 +153,6 @@
             "exec_mode": "fork",
             "autorestart": true
         },
-        {
-            "name": "7_CHECK_AND_CREATE_URL_FACTORY",
-            "script": "./7_CHECK_AND_CREATE_URL_FACTORY/CHECK_AND_CREATE_URL_FACTORY.js",
-            "node_args": "--max-old-space-size=8192 --expose-gc",
-            "max_memory_restart": "4G",
-            "args": ["--type=data"],
-            "cwd": "/home/tg_factory",
-            "log_date_format": "YYYY-MM-DD HH:mm:ss",
-            "error_file": "./logs/7_CHECK_AND_CREATE_URL_FACTORY_error.log",
-            "out_file": "./logs/7_CHECK_AND_CREATE_URL_FACTORY_out.log",
-            "merge_logs": true,
-            "exec_mode": "fork",
-            "autorestart": true
-        },
         {
             "name": "MESSAGE_DISPATCH_FACTORY",
             "script": "./MESSAGE_DISPATCH/MESSAGE_DISPATCH.js",

+ 17 - 2
src/data_manager/BaseModel.js

@@ -48,12 +48,27 @@ class BaseModel {
         return await db.query(sql, params);
     }
 
-    async findOne(conditions) {
+    async findOne(conditions, orderBy = "DESC") {
         this.queryBuilder.clear()
         const { sql, params } = this.queryBuilder
             .select()
             .from(this.tableName)
             .where(conditions)
+            .orderBy('id',orderBy)
+            .limit(1)
+            .getQuery();
+        
+        const results = await db.query(sql, params);
+        return results[0] || null;
+    }
+
+    async findOneByWeight(conditions, orderBy = "DESC") {
+        this.queryBuilder.clear()
+        const { sql, params } = this.queryBuilder
+            .select()
+            .from(this.tableName)
+            .where(conditions)
+            .orderByWeight('id',orderBy)
             .limit(1)
             .getQuery();
         
@@ -67,7 +82,7 @@ class BaseModel {
             .select()
             .from(this.tableName)
             .where(conditions)
-            .orderBy('id',orderBy)
+            .orderByWeight('id',orderBy)
             .limit(limit)
             .getQuery();
         const results = await db.query(sql, params);

+ 1 - 1
src/data_manager/Controllers/filter_data_controllers.js

@@ -151,7 +151,7 @@ class filter_data_controllers {
             }
 
             const status = params.status;
-            const filterData = await filter_data_model.findOne({ status: status ,tg_platform_id:params.tg_platform_id});
+            const filterData = await filter_data_model.findOneByWeight({ status: status ,tg_platform_id:params.tg_platform_id});
 
             if (!filterData) {
                 return {

+ 10 - 0
src/data_manager/QueryBuilder.js

@@ -48,6 +48,16 @@ class QueryBuilder {
         return this;
     }
 
+    orderByWeight(field, direction = 'ASC') {
+        if(field==null){
+            return this;
+        }
+        if(direction!=""){
+            this.query += ` ORDER BY weight DESC , ${field} ${direction} `;
+        }
+        return this;
+    }
+
     insert(table, data) {
         const fields = Object.keys(data);
         const values = Object.values(data);

+ 43 - 0
task_script/async_filter_data.js

@@ -0,0 +1,43 @@
+//将筛选已存在的书进行赋值
+
+const config = require("../etc/config.json");
+const mysql = require('mysql2/promise');
+const dbConfig = config.isDebug?config.debug_mysql:config.release_mysql
+const taskdbConfig = config.isDebug?config.debug_task_mysql:config.release_task_mysql
+const redis_help = require('../src/use_redis');
+const CMD = {}
+async function processTask(){
+    let right_status = true
+    let connection  = null
+    try{
+        //1.遍历书库
+        //2.每一本书
+        // connection = await mysql.createConnection({
+        //     ...dbConfig,
+        //     multipleStatements: true
+        // });
+
+    }catch(e){
+        if(e==0){
+            right_status = false
+        }
+        console.error("processTask error:",e)
+    } finally{
+        if(right_status){
+            // global.setTimeout(processTask, 1000);
+        }
+
+    }
+
+}
+
+CMD.init = async function(){
+    redis_help.connect((results)=>{
+        if(results){
+            processTask();
+        }
+    })
+
+}
+
+CMD.init()

+ 17 - 0
tools.js

@@ -3,6 +3,7 @@ const config = require('./etc/config.json');
 const { default: axios } = require('axios');
 const http = require('http');
 const moment = require('moment');
+const mysql = require('mysql2/promise');
 class tools {
     constructor(redis_help){
         this.redis_help = redis_help
@@ -250,6 +251,22 @@ class tools {
             }
         });
     }
+
+    async getAppletProductDataByButlerId(butler_id,product_id,main_id){
+        const taskdbConfig = config.isDebug?config.debug_task_mysql:config.release_task_mysql
+        let connection = await mysql.createConnection({
+            ...taskdbConfig,
+            multipleStatements: true
+        });
+        const [rows] = await connection.execute(
+            `SELECT * FROM video_applet_product_${butler_id} WHERE product_id = ${product_id} AND main_id = ${main_id}  LIMIT 1`
+        );
+        await connection.end();
+        if(rows.length<=0){
+            return null
+        }
+        return rows[0]
+    }
 }
 
 module.exports = new tools(require('./src/use_redis'));