904118851 8 月之前
父节点
当前提交
b46e874d08
共有 2 个文件被更改,包括 136 次插入2 次删除
  1. 1 0
      common/dbproxy/db_filter_config.lua
  2. 135 2
      service/backmgr/filter_task.lua

+ 1 - 0
common/dbproxy/db_filter_config.lua

@@ -24,6 +24,7 @@ function M.modifyConfig(msg_body)
     local sql = string.format("UPDATE `db_filter_config` SET  config = '%s'  WHERE config_id = 1 ",
     cjson.encode(msg_body))
     local res = mysqldbx.query(sql) 
+    tools.dump(res)
     if res.Warnings == 0 then
         shaixuan_config = msg_body
     end

+ 135 - 2
service/backmgr/filter_task.lua

@@ -193,7 +193,7 @@ function M.search_tg_data(msg_body)
     "start_time_date",
     "sync_status",
     "product_id",
-    "book_platform",
+    "tg_platform_id",
     "oce_material_id",
     "page_size",
     "page_number"},msg_body)
@@ -203,7 +203,21 @@ function M.search_tg_data(msg_body)
     local page_size = msg_body.page_size
     local page_number = msg_body.page_number
     local offset = (page_number - 1) * page_size
-    -- local sql = "SELECT id FROM generate_video_list_tab WHERE DATE(create_time) >= DATE(FROM_UNIXTIME(" .. (msg_body.start_time_date / 1000) .. ")) AND DATE(create_time) <= DATE(FROM_UNIXTIME(" .. (msg_body.end_time_date / 1000) .. "))".." AND video_state=1"..param
+    local product_param = ""
+    if msg_body.product_id~="" then
+        product_param = "AND product_id = "..msg_body.product_id.." "
+    end
+    local oce_material_param = ""
+    if msg_body.oce_material_id~="" then
+        oce_material_param = "AND oce_material_id = "..msg_body.oce_material_id.." "
+    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 sql = "SELECT id FROM video_material ORDER BY id DESC WHERE DATE(create_at) >= DATE(FROM_UNIXTIME(" .. (msg_body.start_time_date / 1000) .. ")) AND DATE(create_time) <= DATE(FROM_UNIXTIME(" .. (msg_body.end_time_date / 1000) .. "))"..product_param..oce_material_param..tg_platform_param..string.format(" LIMIT %d OFFSET %d ",page_size, offset)
+    local res = mysqldbx.query(sql)
+    return true,res
 end
 
 
@@ -230,6 +244,125 @@ function M.get_bao_liang(msg_body)
     return true,res
 end
 
+--搜索爆量
+--tg_main_id 主体
+--tg_platform_id 平台id
+--product_id 书id
+--product_name 书名
+--oce_material_id 巨量素材ID
+function M.search_bao_liang_data(msg_body)
+    local isok ,key =  tools.checkData({"end_time_date",
+    "start_time_date",
+    "product_name",
+    "product_id",
+    "tg_platform_id",
+    "oce_material_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 = "AND product_id = "..msg_body.product_id.." "
+    end
+    local oce_material_param = ""
+    if msg_body.oce_material_id~="" then
+        oce_material_param = "AND oce_material_id = "..msg_body.oce_material_id.." "
+    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 sql = "SELECT id FROM video_material ORDER BY id DESC WHERE DATE(create_at) >= DATE(FROM_UNIXTIME(" .. (msg_body.start_time_date / 1000) .. ")) AND DATE(create_time) <= DATE(FROM_UNIXTIME(" .. (msg_body.end_time_date / 1000) .. "))"..product_param..oce_material_param..tg_platform_param..string.format(" LIMIT %d OFFSET %d ",page_size, offset)
+    local res = mysqldbx.query(sql)
+    return true,res
+end
+
+--搜索书
+--tg_platform_id 平台id
+--product_id 书id
+--product_name 书名
+function M.search_book_data(msg_body)
+    local isok ,key =  tools.checkData({
+    "product_name",
+    "product_id",
+    "tg_platform_id",
+    "oce_material_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 = "AND product_id = "..msg_body.product_id.." "
+    end
+    local product_name_param = ""
+    if msg_body.product_name~="" then
+        product_name_param = "AND product_name = "..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 sql = "SELECT id FROM video_product ORDER BY id DESC WHERE "..product_param..product_name_param..tg_platform_param..string.format(" LIMIT %d OFFSET %d ",page_size, offset)
+    local res = mysqldbx.query(sql)
+    return true,res
+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 product_param = ""
+    if msg_body.product_id~="" then
+        product_param = "AND product_id = "..msg_body.product_id.." "
+    end
+    local product_name_param = ""
+    if msg_body.product_name~="" then
+        product_name_param = "AND product_name = "..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 = "AND dy_small_applet_app_id = "..msg_body.app_id.." "
+    end
+    local sql = "SELECT id FROM video_product ORDER BY id DESC WHERE "..product_param..product_name_param..tg_platform_param..main_param..app_param..string.format(" LIMIT %d OFFSET %d ",page_size, offset)
+    local res = mysqldbx.query(sql)
+    return true,res
+end
+
 function mysqldtaskbx.start()
     local function on_connect(db)
         db:query("set charset utf8mb4");