904118851 hace 7 meses
padre
commit
9f3a41c7f7

+ 7 - 7
common/dbproxy/tg_main.lua

@@ -73,14 +73,14 @@ end
 -- `daily_new_limit` int DEFAULT '0' COMMENT '今天新上数量上限',
 
 function M.addMain(msg_body)
-    local isok ,key =  tools.checkData({"distributor_id","is_delete","ad_convert_type","aweme_id","tg_app_index","butler_id","mini_program_platform_id","landing_page","valid_timer_time","valid_timer_number","channelId","no_bid_budget","max_ad_quantity","tg_link_config","tg_platform_id","app_id","main_name","running_status","ad_quantity","cpa_bid","bid_type","bid_ratio","custom_budget","daily_new_limit","valid_time","group_id"},msg_body)
+    local isok ,key =  tools.checkData({"parent_platform_id","platform_shared_id","distributor_id","is_delete","ad_convert_type","aweme_id","tg_app_index","butler_id","mini_program_platform_id","landing_page","valid_timer_time","valid_timer_number","channelId","no_bid_budget","max_ad_quantity","tg_link_config","tg_platform_id","app_id","main_name","running_status","ad_quantity","cpa_bid","bid_type","bid_ratio","custom_budget","daily_new_limit","valid_time","group_id"},msg_body)
     if not isok then
         return false,string.format("缺少字段: %s.", key)
     end
     local current_time = os.date("%Y-%m-%d %H:%M:%S")
     msg_body.create_time = current_time
-    local sql = string.format("INSERT INTO `tg_main` (distributor_id,is_delete,ad_convert_type,aweme_id,tg_app_index,butler_id,mini_program_platform_id,landing_page,valid_timer_time,valid_timer_number,channelId,no_bid_budget,max_ad_quantity,tg_link_config,tg_platform_id,app_id,main_name,running_status,ad_quantity,cpa_bid,bid_type,bid_ratio,custom_budget,daily_new_limit,valid_time,group_id)  VALUES ('%s',%d,'%s','%s', %d, %d, %d,'%s', %d, '%s', '%s',%d, %d, '%s', %d, '%s', '%s', %d, %d, %d,%d, '%s', %d, %d, '%s', '%s')",
-    msg_body.distributor_id,msg_body.is_delete,msg_body.ad_convert_type,msg_body.aweme_id,msg_body.tg_app_index,msg_body.butler_id, msg_body.mini_program_platform_id,msg_body.landing_page, msg_body.valid_timer_time, msg_body.valid_timer_number,msg_body.channelId, msg_body.no_bid_budget,msg_body.max_ad_quantity,cjson.encode(msg_body.tg_link_config),msg_body.tg_platform_id,msg_body.app_id,msg_body.main_name
+    local sql = string.format("INSERT INTO `tg_main` (parent_platform_id,platform_shared_id,distributor_id,is_delete,ad_convert_type,aweme_id,tg_app_index,butler_id,mini_program_platform_id,landing_page,valid_timer_time,valid_timer_number,channelId,no_bid_budget,max_ad_quantity,tg_link_config,tg_platform_id,app_id,main_name,running_status,ad_quantity,cpa_bid,bid_type,bid_ratio,custom_budget,daily_new_limit,valid_time,group_id)  VALUES (%d,%d,'%s',%d,'%s','%s', %d, %d, %d,'%s', %d, '%s', '%s',%d, %d, '%s', %d, '%s', '%s', %d, %d, %d,%d, '%s', %d, %d, '%s', '%s')",
+    msg_body.parent_platform_id,msg_body.platform_shared_id,msg_body.distributor_id,msg_body.is_delete,msg_body.ad_convert_type,msg_body.aweme_id,msg_body.tg_app_index,msg_body.butler_id, msg_body.mini_program_platform_id,msg_body.landing_page, msg_body.valid_timer_time, msg_body.valid_timer_number,msg_body.channelId, msg_body.no_bid_budget,msg_body.max_ad_quantity,cjson.encode(msg_body.tg_link_config),msg_body.tg_platform_id,msg_body.app_id,msg_body.main_name
     ,msg_body.running_status,msg_body.ad_quantity,msg_body.cpa_bid,msg_body.bid_type,msg_body.bid_ratio,msg_body.custom_budget,msg_body.daily_new_limit,msg_body.valid_time,msg_body.group_id)
     skynet.error(sql)
     tools.dump(mysqldbx.query(sql))
@@ -190,16 +190,16 @@ function pushAddMainMsg(msg_body)
    
 end
 function M.modifyMain(msg_body)
-    local isok ,key =  tools.checkData({"distributor_id","is_delete","ad_convert_type","aweme_id","tg_app_index","butler_id","mini_program_platform_id","landing_page","valid_timer_time","valid_timer_number","channelId","no_bid_budget","max_ad_quantity","tg_link_config","id","tg_platform_id","app_id","main_name","running_status","ad_quantity","cpa_bid","bid_type","bid_ratio","custom_budget","daily_new_limit","valid_time","group_id"},msg_body)
+    local isok ,key =  tools.checkData({"parent_platform_id","platform_shared_id","distributor_id","is_delete","ad_convert_type","aweme_id","tg_app_index","butler_id","mini_program_platform_id","landing_page","valid_timer_time","valid_timer_number","channelId","no_bid_budget","max_ad_quantity","tg_link_config","id","tg_platform_id","app_id","main_name","running_status","ad_quantity","cpa_bid","bid_type","bid_ratio","custom_budget","daily_new_limit","valid_time","group_id"},msg_body)
     if not isok then
         return false,string.format("缺少字段: %s.", key)
     end
     local current_time = os.date("%Y-%m-%d %H:%M:%S")
     msg_body.update_time = current_time
-    local sql = string.format("UPDATE  `tg_main` SET distributor_id = '%s' , is_delete = %d , ad_convert_type = '%s', aweme_id = '%s' ,tg_app_index = %d , butler_id = %d , mini_program_platform_id = %d , landing_page = '%s' , valid_timer_time = %d , valid_timer_number = %d ,channelId = '%s' , no_bid_budget = %d , max_ad_quantity = %d ,tg_platform_id = %d , app_id = '%s' ,main_name = '%s' , update_time = '%s' , running_status = %d ,ad_quantity = %d ,cpa_bid = %d ,bid_type = %d ,bid_ratio = '%s' ,custom_budget = %d ,daily_new_limit = %d ,valid_time = %d ,tg_link_config = '%s' ,group_id = '%s' WHERE id = %d ",
-    msg_body.distributor_id,msg_body.is_delete,msg_body.ad_convert_type,msg_body.aweme_id,msg_body.tg_app_index,msg_body.butler_id,msg_body.mini_program_platform_id,msg_body.landing_page,tonumber(msg_body.valid_timer_time),tonumber(msg_body.valid_timer_number),msg_body.channelId,msg_body.no_bid_budget,msg_body.max_ad_quantity,msg_body.tg_platform_id,msg_body.app_id,msg_body.main_name,msg_body.update_time,msg_body.running_status,msg_body.ad_quantity,msg_body.cpa_bid,msg_body.bid_type,msg_body.bid_ratio,msg_body.custom_budget,
+    local sql = string.format("UPDATE  `tg_main` SET parent_platform_id = %d , platform_shared_id = %d ,distributor_id = '%s' , is_delete = %d , ad_convert_type = '%s', aweme_id = '%s' ,tg_app_index = %d , butler_id = %d , mini_program_platform_id = %d , landing_page = '%s' , valid_timer_time = %d , valid_timer_number = %d ,channelId = '%s' , no_bid_budget = %d , max_ad_quantity = %d ,tg_platform_id = %d , app_id = '%s' ,main_name = '%s' , update_time = '%s' , running_status = %d ,ad_quantity = %d ,cpa_bid = %d ,bid_type = %d ,bid_ratio = '%s' ,custom_budget = %d ,daily_new_limit = %d ,valid_time = %d ,tg_link_config = '%s' ,group_id = '%s' WHERE id = %d ",
+    msg_body.parent_platform_id,msg_body.platform_shared_id,msg_body.distributor_id,msg_body.is_delete,msg_body.ad_convert_type,msg_body.aweme_id,msg_body.tg_app_index,msg_body.butler_id,msg_body.mini_program_platform_id,msg_body.landing_page,tonumber(msg_body.valid_timer_time),tonumber(msg_body.valid_timer_number),msg_body.channelId,msg_body.no_bid_budget,msg_body.max_ad_quantity,msg_body.tg_platform_id,msg_body.app_id,msg_body.main_name,msg_body.update_time,msg_body.running_status,msg_body.ad_quantity,msg_body.cpa_bid,msg_body.bid_type,msg_body.bid_ratio,msg_body.custom_budget,
     tonumber(msg_body.daily_new_limit),tonumber(msg_body.valid_time),cjson.encode(msg_body.tg_link_config),msg_body.group_id,msg_body.id)
-    mysqldbx.query(sql)
+    tools.dump(mysqldbx.query(sql))
     skynet.send("backmgr","lua","on_recv",nil,"ws_push_msg",cjson.encode({cmd="updateMainConfig"}))
     return true
 end

+ 8 - 0
service/agent.lua

@@ -49,6 +49,7 @@ function  M.status_task(id, msg)
         -- skynet.sleep(200)
         RECV_TASK.updatePlatformConfig()
         RECV_TASK.updateFqKeyList()
+        RECV_TASK.updateFqMfKeyList()
         RECV_TASK.updateBlackBooks()
         RECV_TASK.getPullDataConfig()
     end)
@@ -176,6 +177,13 @@ function RECV_TASK.updateFqKeyList(msg_body)
     end
 end
 
+function RECV_TASK.updateFqMfKeyList(msg_body)
+    if AGENT_ID~=0 then
+        isRunTask = true --工人进入工作状态
+        websocket.write(AGENT_ID, cjson.encode({cmd="updateFqMfKeyList",data=msg_body}))
+    end
+end
+
 function RECV_TASK.updateBlackBooks(msg_body)
     if AGENT_ID~=0 then
         isRunTask = true --工人进入工作状态

+ 9 - 0
service/agent_manager.lua

@@ -104,6 +104,15 @@ function CMD.updateFqKeyList(_,msg_body)
     end
 end
 
+function CMD.updateFqMfKeyList(_,msg_body)
+    local agent = getOneAgent()
+    if agent~=nil then
+        skynet.call(agent,"lua",nil,nil,"updateFqMfKeyList",msg_body)
+    else
+        skynet.error("把任务放到队列")
+    end
+end
+
 --更新黑名单的书
 function CMD.updateBlackBooks(_,msg_body) 
     local agent = getOneAgent()

+ 0 - 82
service/backmgr/filter_task.lua

@@ -498,88 +498,6 @@ end
 
 
 
---搜索小程序书
---tg_platform_id 平台id
---product_id 书id
---product_name 书名
---main_id 主体ID
---dy_small_applet_app_id 小程序ID
-function M.search_app_book_data(msg_body)
-    local isok ,key =  tools.checkData({
-    "product_name",
-    "product_id",
-    "tg_platform_id",
-    "main_id",
-    "app_id",
-    "page_size",
-    "page_number"},msg_body)
-    if not isok then
-        return false,string.format("缺少字段: %s.", key)
-    end
-    local page_size = msg_body.page_size
-    local page_number = msg_body.page_number
-    local offset = (page_number - 1) * page_size
-    local isFirst = false
-    local product_param = ""
-    if msg_body.product_id~="" then
-        isFirst = true
-        product_param =string.format(" product_id = '%s' ",msg_body.product_id)
-    end
-    local product_name_param = ""
-    if msg_body.product_name~="" then
-        if isFirst ==true then
-            product_name_param = string.format("AND product_name = '%s' ",msg_body.product_name)
-        else
-            isFirst = true
-            product_name_param = string.format(" product_name = '%s' ",msg_body.product_name)
-        end
-        
-    end
-    local tg_platform_param = ""
-    if msg_body.tg_platform_id~="" then
-        if isFirst ==true then
-            tg_platform_param = "AND book_platform = "..msg_body.tg_platform_id.." "
-        else
-            isFirst = true
-            tg_platform_param = " book_platform = "..msg_body.tg_platform_id.." "
-        end
-  
-    end
-    local main_param = ""
-    if msg_body.main_id~="" then
-        if isFirst == true then
-            main_param = "AND main_id = "..msg_body.main_id.." "
-        else
-            isFirst = true
-            main_param = " main_id = "..msg_body.main_id.." "
-        end
-    end
-    local app_param = ""
-    if msg_body.app_id~="" then
-        if isFirst == true then
-            app_param = string.format("AND dy_small_applet_app_id = '%s' ",msg_body.app_id) 
-        else
-            app_param = string.format(" dy_small_applet_app_id = '%s' ",msg_body.app_id) 
-        end
-    end
-
-    local param = product_param..product_name_param..tg_platform_param..main_param..app_param;
-
-    if param ~= "" then
-        param = " WHERE "..param
-    end
-
-
-    local sql = "SELECT * FROM video_applet_product "..param.." ORDER BY id DESC "..string.format(" LIMIT %d OFFSET %d ",page_size, offset)
-    local list = mysqldtaskbx.Singleton().query(sql)
-
-    sql = "SELECT   COUNT(*) AS total  FROM video_applet_product "..param.." ORDER BY id DESC "
-
-    local total = mysqldtaskbx.Singleton().query(sql)
-
-    return true,list,total[1].total
-end
-
 --添加书籍数据
 function M.add_book_data(msg_body)
     local isok ,key =  tools.checkData({"tg_platform_id","product_id","product_name"

+ 64 - 0
service/backmgr/video_applet_product.lua

@@ -33,6 +33,70 @@ function M.open_app_book_task(msg_body)
     end
     return true,{}
 end
+
+
+--搜索小程序书
+--tg_platform_id 平台id
+--product_id 书id
+--product_name 书名
+--main_id 主体ID
+--dy_small_applet_app_id 小程序ID
+function M.search_app_book_data(msg_body)
+    local isok ,key =  tools.checkData({
+    "status",
+    "product_name",
+    "product_id",
+    "tg_platform_id",
+    "main_id",
+    "app_id",
+    "page_size",
+    "page_number"},msg_body)
+    if not isok then
+        return false,string.format("缺少字段: %s.", key)
+    end
+    local page_size = msg_body.page_size
+    local page_number = msg_body.page_number
+    local offset = (page_number - 1) * page_size
+    local product_param = ""
+    if msg_body.product_id~="" then
+        product_param =string.format(" AND product_id = '%s' ",msg_body.product_id)
+    end
+    local product_name_param = ""
+    if msg_body.product_name~="" then
+        product_name_param = string.format("AND product_name = '%s' ",msg_body.product_name)
+    end
+    local tg_platform_param = ""
+    if msg_body.tg_platform_id~="" then
+        tg_platform_param = "AND book_platform = "..msg_body.tg_platform_id.." "
+    end
+    local main_param = ""
+    if msg_body.main_id~="" then
+        main_param = "AND main_id = "..msg_body.main_id.." "
+    end
+    local app_param = ""
+    if msg_body.app_id~="" then
+        app_param = string.format("AND dy_small_applet_app_id = '%s' ",msg_body.app_id) 
+    end
+
+    local status_param = ""
+
+    if msg_body.status~="" then
+        status_param = " AND status = "..msg_body.status.." "
+    end
+
+    local param = product_param..product_name_param..tg_platform_param..main_param..app_param..status_param;
+
+
+    local sql = "SELECT * FROM video_applet_product WHERE 1=1 "..param.." ORDER BY id DESC "..string.format(" LIMIT %d OFFSET %d ",page_size, offset)
+    local list = mysqldtaskbx.Singleton().query(sql)
+
+    sql = "SELECT   COUNT(*) AS total  FROM video_applet_product  WHERE 1=1 "..param.." ORDER BY id DESC "
+
+    local total = mysqldtaskbx.Singleton().query(sql)
+
+    return true,list,total[1].total
+end
+
 function mysqldtaskbx.start()
     local function on_connect(db)
         db:query("set charset utf8mb4");