904118851 2 місяців тому
батько
коміт
d816f25d12
1 змінених файлів з 15 додано та 9 видалено
  1. 15 9
      service/backmgr/filter_task.lua

+ 15 - 9
service/backmgr/filter_task.lua

@@ -328,7 +328,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
@@ -341,14 +341,20 @@ function M.send_book_data(msg_body)
         local product_id =   res[i].product_id
         local product_name = res[i].product_name
         local product_parent_id = res[i].product_parent_id
-        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,product_parent_id)  VALUES ('%s','%s',%d,'%s',%d,%d,%d,%d,'%s')",
-            product_id,product_name,msg_body.tg_platform_id,msg_body.app_id,msg_body.main_id,0,0, butler_info[1].butler_id,product_parent_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,product_parent_id)  VALUES ('%s','%s',%d,'%s',%d,%d,%d,%d,'%s')",
+                product_id,product_name,msg_body.tg_platform_id,msg_body.app_id,main_id,0,0, butler_info[1].butler_id,product_parent_id)
+                mysqldtaskbx.Singleton().query(sql)
+                skynet.error("sql:",sql)
+            end
+  
         end
     end
     return true,{}