904118851 5 ماه پیش
والد
کامیت
12f0bff845
5فایلهای تغییر یافته به همراه92 افزوده شده و 7 حذف شده
  1. 1 1
      bin/dj_back.pid
  2. 3 3
      etc/run_config.lua
  3. 8 3
      service/backmgr/filter_data.lua
  4. 2 0
      service/backmgr/init.lua
  5. 78 0
      service/backmgr/xs_origin_data.lua

+ 1 - 1
bin/dj_back.pid

@@ -1 +1 @@
-29144
+24414

+ 3 - 3
etc/run_config.lua

@@ -43,21 +43,21 @@ return {
             db = "ml_oceanengine"
         },
         mysqldb_task_cnf = {
-            ip = 'djmysql.rwlb.rds.aliyuncs.com',
+            ip = 'djtext.rwlb.rds.aliyuncs.com',
             port = 3306,
             user = "zdroot",
             password = "p0LTZh&CjMl2023",
             db = "video_task"
         },
         mysqldb_checks_cnf = {
-            ip = 'djmysql.rwlb.rds.aliyuncs.com',
+            ip = 'djtext.rwlb.rds.aliyuncs.com',
             port = 3306,
             user = "zdroot",
             password = "p0LTZh&CjMl2023",
             db = "n8_union"
         },
         mysqldb_material_review_cnf = {
-            ip = 'djmysql.rwlb.rds.aliyuncs.com',
+            ip = 'djtext.rwlb.rds.aliyuncs.com',
             port = 3306,
             user = "zdroot",
             password = "p0LTZh&CjMl2023",

+ 8 - 3
service/backmgr/filter_data.lua

@@ -6,7 +6,7 @@ local skynet = require "skynet"
 local cjson = require "cjson"
 
 function M.search_filter_data(msg_body)
-    local isok ,key =  tools.checkData({"material_sync_status","video_id","tg_platform_id","page_size","page_number",
+    local isok ,key =  tools.checkData({"data_source","material_sync_status","video_id","tg_platform_id","page_size","page_number",
     "d_z","comment","collect","forward","product_id","source","start_publish_time","end_publish_time","start_create_time","end_create_time"},msg_body)
     if not isok then
         return false,string.format("缺少字段: %s.", key)
@@ -43,6 +43,11 @@ function M.search_filter_data(msg_body)
         source_param =  string.format(" AND source = '%s' ",msg_body.source)
     end
 
+    local data_source_param = ""
+    if msg_body.data_source~="" then
+        data_source_param =  string.format(" AND data_source = %d ",msg_body.data_source)
+    end
+    
     local date_param = ""
     if msg_body.start_publish_time~="" and msg_body.end_publish_time~="" then
         date_param = " AND DATE(publish_time) >= DATE(FROM_UNIXTIME(" .. (msg_body.start_publish_time / 1000) .. ")) AND DATE(publish_time) <= DATE(FROM_UNIXTIME(" .. (msg_body.end_publish_time / 1000) .. "))"
@@ -91,7 +96,7 @@ function M.search_filter_data(msg_body)
     end
     
 
-    local param = tg_platform_id_param..date_param..create_date_param..product_param..source_param..video_id_param..material_sync_status_param
+    local param = data_source_param..tg_platform_id_param..date_param..create_date_param..product_param..source_param..video_id_param..material_sync_status_param
 
     local up_down_param = d_z_param..comment_param..forward_param..collect_param
 
@@ -102,7 +107,7 @@ function M.search_filter_data(msg_body)
     local sql = "SELECT * FROM filter_data WHERE status!=2 "..param..up_down_param.." ORDER BY id DESC"..string.format(" LIMIT %d OFFSET %d ",page_size, offset)
 
     skynet.error("sql:",sql)
-    
+
     local res =  mysqldbx.query(sql)
 
     sql =  "SELECT  COUNT(*) AS total  FROM filter_data WHERE status!=2 "..param

+ 2 - 0
service/backmgr/init.lua

@@ -44,6 +44,7 @@ local material_review = require "material_review"
 local yw_book = require "yw_book"
 local wechat_miniapp_product = require "wechat_miniapp_product"
 local material_platform = require "material_platform"
+local xs_origin_data = require "xs_origin_data"
 local status_200 = 200
 local CMD = {
     
@@ -86,6 +87,7 @@ CMD["material_review"] = material_review;
 CMD["yw_book"] = yw_book;
 CMD["wechat_miniapp_product"] = wechat_miniapp_product;
 CMD["material_platform"] = material_platform;
+CMD["xs_origin_data"] = xs_origin_data;
 function run(target,fun,msg_body,fd)
     if target~=nil and fun~=nil and target[fun]~=nil then
         local isok,data,total = target[fun](msg_body)

+ 78 - 0
service/backmgr/xs_origin_data.lua

@@ -0,0 +1,78 @@
+--来源小说原始数据
+local M = {}
+local mysqldbx = require "mysqldbx"
+local tools = require "tools"
+local skynet = require "skynet"
+local cjson = require "cjson"
+
+
+function M.reset_status(msg_body)
+    local isok ,key =  tools.checkData({"id_list"},msg_body)
+    if not isok then
+        return false,string.format("缺少字段: %s.", key)
+    end
+    for i = 1, #msg_body.id_list, 1 do
+        local res,sql,id;
+        id = msg_body.id_list[i]
+        sql = string.format("UPDATE  xs_origin_data SET sync_info_status = 0 WHERE id = %d ",id)
+        res = mysqldbx.query(sql)
+    end
+    return true,{}
+end
+
+function M.search(msg_body)
+    local isok ,key =  tools.checkData({"is_wx_guajian","page_size","page_number","start_create_time","end_create_time","guajian_info","start_publish_time","end_publish_time","materialId"},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 is_wx_guajian_param = ""
+    if msg_body.is_wx_guajian~="" then
+        is_wx_guajian_param = string.format(" AND is_wx_guajian = %d ",msg_body.is_wx_guajian)
+    end
+
+
+    local date_param = ""
+    if msg_body.start_publish_time~="" and msg_body.end_publish_time~="" then
+        date_param = " AND DATE(publish_time) >= DATE(FROM_UNIXTIME(" .. (msg_body.start_publish_time / 1000) .. ")) AND DATE(publish_time) <= DATE(FROM_UNIXTIME(" .. (msg_body.end_publish_time / 1000) .. ")) "
+    end
+
+
+    local create_date_param = ""
+    if msg_body.start_create_time~="" and msg_body.end_create_time~="" then
+        create_date_param = " AND create_day >= DATE(FROM_UNIXTIME(" .. (msg_body.start_create_time / 1000) .. ")) AND create_day <= DATE(FROM_UNIXTIME(" .. (msg_body.end_create_time / 1000) .. ")) "
+    end
+
+    local guajian_info_param = ""
+    -- 挂件信息条件
+    if msg_body.guajian_info ~= "" then
+        local searchTerm = string.gsub(msg_body.guajian_info, "%%", "\\%%")
+        guajian_info_param = string.format("  AND guajian_link LIKE CONCAT('%%', '%s', '%%')  ",searchTerm)
+    end
+
+    local materialId_param = ""
+    -- 材料ID条件
+    if msg_body.materialId ~= "" then
+        materialId_param =  string.format(" AND materialId = '%s' ",msg_body.materialId)
+    end
+
+    local param = date_param..create_date_param..guajian_info_param..materialId_param..is_wx_guajian_param
+    
+    local sql = "SELECT * FROM xs_origin_data WHERE 1=1 "..param.."ORDER BY id DESC"..string.format(" LIMIT %d OFFSET %d ",page_size, offset)
+    
+    skynet.error("sql:",sql)
+    -- 执行查询
+    local res = mysqldbx.query(sql)
+    -- 使用 COUNT(*) 优化总数查询
+    sql =  "SELECT  COUNT(*) AS total  FROM xs_origin_data WHERE 1=1 "..param
+
+    local total = mysqldbx.query(sql)
+
+    return true, res, total[1].total
+end
+
+return M