qingyan 1 день тому
батько
коміт
cf5c743661

Різницю між файлами не показано, бо вона завелика
+ 14 - 4
common/dbproxy/tg_main.lua


+ 1 - 4
service/agent_manager.lua

@@ -152,11 +152,8 @@ function CMD.syncMain(_,msg_body)
     end
 end
 
-skynet.start(function()
+skynet.start(function() 
 	local protocol = "ws" 
-	-- for i= 1, 3 do --开启30个服务用来接收消息
-	-- 	agents[i] = skynet.newservice("agent", "agent", protocol)
-	-- end
 	agents[1] = skynet.newservice("agent", "agent", protocol)
 	local balance = 1
 	local id = socket.listen("0.0.0.0",runconfig.wsProt )

+ 3 - 2
service/backmgr/init.lua

@@ -52,7 +52,7 @@ local log = require "log"
 local product_task = require "product_task"
 local tf_age_tpl = require "tf_age_tpl"
 local tf_region_tpl = require "tf_region_tpl"
-
+local no_filter_origin2 = require "no_filter_origin2"
 local status_200 = 200
 local CMD = {
     
@@ -83,6 +83,7 @@ CMD["tg_mini_program_platform"] = tg_mini_program_platform;
 CMD["task_material_queue_queue"] = task_material_queue_queue;
 CMD["video_product"] = video_product;
 CMD["origin_data"] = origin_data;
+CMD["origin_data2"] = origin_data2;
 CMD["video_product_material"] = video_product_material;
 CMD["aweme_auth_list"] = aweme_auth_list;
 CMD["checks"] = checks;
@@ -103,7 +104,7 @@ CMD["product_task"] = product_task;
 
 CMD["tf_age_tpl"] = tf_age_tpl;
 CMD["tf_region_tpl"] = tf_region_tpl;
-CMD["origin_data2"] = origin_data2;
+CMD["no_filter_origin2"] = no_filter_origin2;
 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)

+ 71 - 0
service/backmgr/no_filter_origin2.lua

@@ -0,0 +1,71 @@
+--无筛选原始数据
+local M = {}
+local mysqldbx = require "mysqldbx"
+local tools = require "tools"
+local skynet = require "skynet"
+local cjson = require "cjson"
+
+function M.check_table_exists(table_name)
+    local sql = string.format("SHOW TABLES LIKE '%s'", table_name)
+    local res = mysqldbx.query(sql)
+    return res and #res > 0
+end
+
+function M.search_no_filter_origin_data(msg_body)
+    local isok ,key =  tools.checkData({"video_id","date","page_size","page_number","materialId"},msg_body)
+    if not isok then
+        return false,string.format("缺少字段: %s.", key)
+    end
+    local table_name = "pull_data2_"..string.gsub(msg_body.date, "-", "")
+
+    if not M.check_table_exists(table_name) then
+        return false,string.format("不存在  %s 这个数据.", table_name)
+    end
+
+    local page_size = msg_body.page_size
+    local page_number = msg_body.page_number
+    local offset = (page_number - 1) * page_size
+
+    local video_id_param = ""
+    if msg_body.video_id~="" then
+        video_id_param =  " AND awemeId = "..msg_body.video_id
+    end
+
+    local materialId_param = ""
+    if msg_body.materialId~="" then
+        materialId_param =  string.format(" AND materialId = '%s' ",msg_body.materialId)
+    end
+
+    local param = video_id_param..materialId_param
+    local up_down_param = " ORDER BY " .." likeCount DESC "
+
+    local sql = "SELECT * FROM "..table_name.." WHERE 1=1 "..param..up_down_param..string.format(" LIMIT %d OFFSET %d ",page_size, offset)
+
+    skynet.error("sql1:",sql)
+
+    local res =  mysqldbx.query(sql)
+
+    sql =  "SELECT  COUNT(*) AS total  FROM "..table_name.." WHERE 1=1 "..param
+
+    skynet.error("sql2:",sql)
+
+    local total = mysqldbx.query(sql)
+
+    return true,res,total[1].total
+end
+
+function M.delete_no_filter_origin_data(msg_body)
+    local isok ,key =  tools.checkData({"date"},msg_body)
+    if not isok then
+        return false,string.format("缺少字段: %s.", key)
+    end
+    local table_name = "pull_data2_"..string.gsub(msg_body.date, "-", "")
+    if not M.check_table_exists(table_name) then
+        return false,string.format("不存在  %s 这个数据.", table_name)
+    end
+    local sql = string.format("DROP TABLE %s", table_name)
+    mysqldbx.query(sql)
+    return true,{}
+end
+
+return M

+ 2 - 6
service/backmgr/origin_data2.lua

@@ -28,7 +28,7 @@ function M.reset_status(msg_body)
 end
 
 function M.search_origin_data(msg_body)
-    local isok ,key =  tools.checkData({"miniseriesName","is_wx_guajian","page_size","page_number","start_create_time","end_create_time","guajian_info","start_publish_time","end_publish_time","materialId"},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
@@ -36,10 +36,6 @@ function M.search_origin_data(msg_body)
     local page_number = msg_body.page_number
     local offset = (page_number - 1) * page_size
 
-    local miniseriesName_param = ""
-    if msg_body.miniseriesName~="" then
-        miniseriesName_param = string.format(" AND miniseriesName = '%s' ",msg_body.miniseriesName)
-    end
 
     local is_wx_guajian_param = ""
     if msg_body.is_wx_guajian~="" then
@@ -71,7 +67,7 @@ function M.search_origin_data(msg_body)
         materialId_param =  string.format(" AND materialId = '%s' ",msg_body.materialId)
     end
 
-    local param = miniseriesName_param..date_param..create_date_param..guajian_info_param..materialId_param..is_wx_guajian_param
+    local param = date_param..create_date_param..guajian_info_param..materialId_param..is_wx_guajian_param
     
     local sql = "SELECT * FROM origin_data2 WHERE 1=1 "..param.."ORDER BY id DESC"..string.format(" LIMIT %d OFFSET %d ",page_size, offset)
     

+ 1 - 1
service/backmgr/product_task.lua

@@ -10,7 +10,7 @@ local db
 local mysqldtaskbx = {}
 function M.task()
 
-    skynet.error("执行一次task")
+    -- skynet.error("执行一次task")
 
     local sql = string.format("SELECT * FROM video_product where status = 10 AND list_time is not null ")
 

Деякі файли не було показано, через те що забагато файлів було змінено