904118851 8 kuukautta sitten
vanhempi
sitoutus
91a1d12478

+ 35 - 0
common/dbproxy/tg_main.lua

@@ -56,8 +56,43 @@ function M.addMain(msg_body)
     pushAddMainMsg(msg_body)
     return true
 end
+--此主体将书库的书都发布到小程序书籍
+function M.syncMain(msg_body)
+    local isok ,key =  tools.checkData({"id"},msg_body)
+    if not isok then
+        return false,string.format("缺少字段: %s.", key)
+    end
+    local sql = string.format("select * from `tg_main` where id = %d LIMIT 1 ",msg_body.id)
+    local res = mysqldbx.query(sql)
+    syncMainAppletProduct(res[1])
+    return true,{}
+end
+
+function syncMainAppletProduct(main_info)
+    local tg_platform_id = main_info.tg_platform_id
+    local app_id = main_info.app_id
+    local sql = string.format("SELECT * FROM video_product where book_platform = %d ",tg_platform_id)
+    local video_product_list = mysqldtaskbx.Singleton().query(sql)
 
 
+    function isHaveAppletProdut(product_id)
+        local s = string.format("SELECT * FROM video_applet_product where dy_small_applet_app_id = '%s' and product_id = '%s' and main_id = %d and book_platform = %d LIMIT 1",app_id,product_id,main_info.id,tg_platform_id)
+        local r = mysqldtaskbx.Singleton().query(sql)
+        return #r>0
+    end
+
+    local need_create_link_list = {}
+    local verify_list = {}
+    for i = 1, #video_product_list, 1 do
+        local product = video_product_list[i]
+        if not isHaveAppletProdut(product.product_id) and not verify_list[product.product_id] then
+            verify_list[product.product_id] = true
+            table.insert(need_create_link_list,#need_create_link_list+1,{product_name=product.product_name,product_id=product.product_id,book_platform=product.book_platform})
+        end
+    end
+    skynet.send("backmgr","lua","on_recv",nil,"ws_push_msg",cjson.encode({cmd="syncMain",data={list=need_create_link_list,main_info=main_info}}))
+end
+
 function pushAddMainMsg(msg_body)
     local sql = string.format("select * from `tg_main` where main_name = '%s' and app_id = '%s'  LIMIT 1 ",msg_body.main_name,msg_body.app_id)
     local isok,res;

+ 1 - 1
service/backmgr/filter_data.lua

@@ -91,7 +91,7 @@ function M.search_filter_data(msg_body)
     end
     
 
-    local param = date_param..tg_platform_id_param..product_param..source_param
+    local param = tg_platform_id_param..date_param..product_param..source_param
 
     local up_down_param = d_z_param..comment_param..forward_param..collect_param
 

+ 5 - 1
service/backmgr/pull_data_config.lua

@@ -30,7 +30,11 @@ function M.add_pull_data_list_config(msg_body)
     end
     for i = 1, #msg_body.config_list, 1 do
         local config_item = msg_body.config_list[i]
-        local sql = string.format("INSERT INTO `pull_data_config` (start,name,interval_minute)  VALUES ('%s','%s',%d)",config_item.start,config_item.name,config_item.interval_minute)
+        local start_time = config_item.start
+        if config_item.start_time~=nil then
+            start_time = config_item.start_time
+        end
+        local sql = string.format("INSERT INTO `pull_data_config` (start,name,interval_minute,start_time)  VALUES ('%s','%s',%d,'%s')",config_item.start,config_item.name,config_item.interval_minute,start_time)
         skynet.error(sql)
         mysqldbx.query(sql)
     end