|
@@ -6,7 +6,7 @@ local skynet = require "skynet"
|
|
local cjson = require "cjson"
|
|
local cjson = require "cjson"
|
|
|
|
|
|
function M.search_filter_data(msg_body)
|
|
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)
|
|
"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
|
|
if not isok then
|
|
return false,string.format("缺少字段: %s.", key)
|
|
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)
|
|
source_param = string.format(" AND source = '%s' ",msg_body.source)
|
|
end
|
|
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 = ""
|
|
local date_param = ""
|
|
if msg_body.start_publish_time~="" and msg_body.end_publish_time~="" then
|
|
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) .. "))"
|
|
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
|
|
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
|
|
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)
|
|
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)
|
|
skynet.error("sql:",sql)
|
|
-
|
|
|
|
|
|
+
|
|
local res = mysqldbx.query(sql)
|
|
local res = mysqldbx.query(sql)
|
|
|
|
|
|
sql = "SELECT COUNT(*) AS total FROM filter_data WHERE status!=2 "..param
|
|
sql = "SELECT COUNT(*) AS total FROM filter_data WHERE status!=2 "..param
|