904118851 2 сар өмнө
parent
commit
e20c4fcf68

+ 13 - 9
service/backmgr/filter_task.lua

@@ -326,7 +326,7 @@ end
 
 --发送书籍数据到主体
 function M.send_book_data(msg_body)
-    local isok ,key =  tools.checkData({"tg_platform_id","app_id","id_list","main_id"},msg_body)
+    local isok ,key =  tools.checkData({"tg_platform_id","app_id","id_list","main_id_list"},msg_body)
     if not isok then
         return false,string.format("缺少字段: %s.", key)
     end
@@ -338,14 +338,18 @@ function M.send_book_data(msg_body)
     for i = 1, #res, 1 do
         local product_id =   res[i].product_id
         local product_name = res[i].product_name
-        local sql = string.format("SELECT * FROM video_applet_product where product_id = '%s' and book_platform  = %d and dy_small_applet_app_id = '%s' and main_id = %d ",product_id,msg_body.tg_platform_id,msg_body.app_id,msg_body.main_id)
-        local result = mysqldtaskbx.Singleton().query(sql)
-        if #result<=0 then 
-            local butler_info = mysqldbx.query( "SELECT  butler_id  FROM tg_main WHERE id = "..msg_body.main_id.." LIMIT 1")
-            sql = string.format("INSERT INTO `video_applet_product` (product_id,product_name,book_platform,dy_small_applet_app_id,main_id,wait_status,status,butler_id)  VALUES ('%s','%s',%d,'%s',%d,%d,%d,%d)",
-            product_id,product_name,msg_body.tg_platform_id,msg_body.app_id,msg_body.main_id,0,0, butler_info[1].butler_id)
-            mysqldtaskbx.Singleton().query(sql)
-            skynet.error("sql:",sql)
+
+        for j = 1, #msg_body.main_id_list, 1 do
+            local main_id = msg_body.main_id_list[j]
+            local sql = string.format("SELECT * FROM video_applet_product where product_id = '%s' and book_platform  = %d and dy_small_applet_app_id = '%s' and main_id = %d ",product_id,msg_body.tg_platform_id,msg_body.app_id,main_id)
+            local result = mysqldtaskbx.Singleton().query(sql)
+            if #result<=0 then 
+                local butler_info = mysqldbx.query( "SELECT  butler_id  FROM tg_main WHERE id = "..main_id.." LIMIT 1")
+                sql = string.format("INSERT INTO `video_applet_product` (product_id,product_name,book_platform,dy_small_applet_app_id,main_id,wait_status,status,butler_id)  VALUES ('%s','%s',%d,'%s',%d,%d,%d,%d)",
+                product_id,product_name,msg_body.tg_platform_id,msg_body.app_id,main_id,0,0, butler_info[1].butler_id)
+                mysqldtaskbx.Singleton().query(sql)
+                skynet.error("sql:",sql)
+            end
         end
     end
     return true,{}