|
@@ -160,7 +160,7 @@ end
|
|
|
|
|
|
--推广增量
|
|
|
function M.tui_guang_zeng_liang(msg_body)
|
|
|
- local isok ,key = tools.checkData({"main_id","quantity","bid_type","id_list","is_rise"},msg_body)
|
|
|
+ local isok ,key = tools.checkData({"main_id","quantity","bid_type","id_list","is_rise","is_new"},msg_body)
|
|
|
if not isok then
|
|
|
return false,string.format("缺少字段: %s.", key)
|
|
|
end
|
|
@@ -175,8 +175,8 @@ function M.tui_guang_zeng_liang(msg_body)
|
|
|
sql = string.format("UPDATE video_material SET bl_status = 1 WHERE id =%d ",id)
|
|
|
mysqldbx.query(sql)
|
|
|
|
|
|
- sql = string.format("INSERT INTO `task_boost_material_queue` (material_id,main_id,quantity,bid_type,is_rise) VALUES (%d,%d,%d,%d,%d)",
|
|
|
- material_id,msg_body.main_id,msg_body.quantity,msg_body.bid_type,msg_body.is_rise)
|
|
|
+ sql = string.format("INSERT INTO `task_boost_material_queue` (material_id,main_id,quantity,bid_type,is_rise,is_new) VALUES (%d,%d,%d,%d,%d,%d)",
|
|
|
+ material_id,msg_body.main_id,msg_body.quantity,msg_body.bid_type,msg_body.is_rise,msg_body.is_new)
|
|
|
mysqldbx.query(sql)
|
|
|
|
|
|
end
|
|
@@ -195,8 +195,12 @@ function M.search_tg_data(msg_body)
|
|
|
"product_id",
|
|
|
"tg_platform_id",
|
|
|
"oce_material_id",
|
|
|
+ "product_name",
|
|
|
+ "material_id",
|
|
|
"page_size",
|
|
|
- "page_number"},msg_body)
|
|
|
+ "page_number",
|
|
|
+ "dy_id",
|
|
|
+"d_z","comment","collect","forward"},msg_body)
|
|
|
if not isok then
|
|
|
return false,string.format("缺少字段: %s.", key)
|
|
|
end
|
|
@@ -209,6 +213,48 @@ function M.search_tg_data(msg_body)
|
|
|
isFirst = true
|
|
|
product_param = string.format(" product_id = %d ",tonumber(msg_body.product_id))
|
|
|
end
|
|
|
+
|
|
|
+
|
|
|
+ local product_name_param = ""
|
|
|
+ if msg_body.product_name~="" then
|
|
|
+ if isFirst==true then
|
|
|
+ product_name_param = string.format("AND product_name = '%s' ",msg_body.product_name)
|
|
|
+ else
|
|
|
+ isFirst = true;
|
|
|
+ product_name_param = string.format(" product_name = '%s' ",msg_body.product_name)
|
|
|
+ end
|
|
|
+ end
|
|
|
+
|
|
|
+ local is_auto_param = ""
|
|
|
+ if msg_body.dy_id~="" then
|
|
|
+ if isFirst==true then
|
|
|
+ if msg_body.dy_id~=0 then
|
|
|
+ is_auto_param = " AND dy_id != 0"
|
|
|
+ else
|
|
|
+ is_auto_param = " AND dy_id = 0"
|
|
|
+ end
|
|
|
+
|
|
|
+ else
|
|
|
+ isFirst = true;
|
|
|
+ if msg_body.dy_id~=0 then
|
|
|
+ is_auto_param = " dy_id != 0"
|
|
|
+ else
|
|
|
+ is_auto_param = " dy_id = 0"
|
|
|
+ end
|
|
|
+
|
|
|
+ end
|
|
|
+ end
|
|
|
+
|
|
|
+ local material_id_param = ""
|
|
|
+ if msg_body.material_id~="" then
|
|
|
+ if isFirst==true then
|
|
|
+ material_id_param = string.format(" AND material_id = %d ",tonumber(msg_body.material_id))
|
|
|
+ else
|
|
|
+ isFirst = true;
|
|
|
+ material_id_param = string.format(" material_id = %d ",tonumber(msg_body.material_id))
|
|
|
+ end
|
|
|
+ end
|
|
|
+
|
|
|
local oce_material_param = ""
|
|
|
if msg_body.oce_material_id~="" then
|
|
|
if isFirst == true then
|
|
@@ -248,14 +294,53 @@ function M.search_tg_data(msg_body)
|
|
|
sync_status_param = " sync_status = "..msg_body.sync_status.." "
|
|
|
end
|
|
|
end
|
|
|
+
|
|
|
+
|
|
|
+ local d_z_param = ""
|
|
|
+ if msg_body.d_z~="" then
|
|
|
+ if(msg_body.d_z == 0) then
|
|
|
+ d_z_param = ", d_z_number ASC"
|
|
|
+ else
|
|
|
+ d_z_param = ", d_z_number DESC"
|
|
|
+ end
|
|
|
+ end
|
|
|
+
|
|
|
+ local comment_param = ""
|
|
|
+ if msg_body.comment~="" then
|
|
|
+ if(msg_body.comment == 0) then
|
|
|
+ comment_param = ", comment_number ASC"
|
|
|
+ else
|
|
|
+ comment_param = ", comment_number DESC"
|
|
|
+ end
|
|
|
+ end
|
|
|
+
|
|
|
+ local forward_param = ""
|
|
|
+ if msg_body.forward~="" then
|
|
|
+ if(msg_body.forward == 0) then
|
|
|
+ forward_param = ", forward_number ASC"
|
|
|
+ else
|
|
|
+ forward_param = ", forward_number DESC"
|
|
|
+ end
|
|
|
+ end
|
|
|
|
|
|
- local param = date_param..product_param..oce_material_param..tg_platform_param..sync_status_param
|
|
|
+ local collect_param = ""
|
|
|
+ if msg_body.collect~="" then
|
|
|
+ if(msg_body.collect == 0) then
|
|
|
+ collect_param = ", collect_number ASC"
|
|
|
+ else
|
|
|
+ collect_param = ", collect_number DESC"
|
|
|
+ end
|
|
|
+ end
|
|
|
+
|
|
|
+ local param = date_param..product_param..oce_material_param..tg_platform_param..sync_status_param..product_name_param..is_auto_param..material_id_param
|
|
|
|
|
|
if param ~= "" then
|
|
|
param = " WHERE "..param
|
|
|
end
|
|
|
|
|
|
- local sql = "SELECT * FROM video_material "..param.." ORDER BY id DESC "..string.format(" LIMIT %d OFFSET %d ",page_size, offset)
|
|
|
+ local up_down_param = d_z_param..comment_param..forward_param..collect_param
|
|
|
+
|
|
|
+ local sql = "SELECT * FROM video_material "..param.." ORDER BY id DESC "..up_down_param..string.format(" LIMIT %d OFFSET %d ",page_size, offset)
|
|
|
|
|
|
local res = mysqldbx.query(sql)
|
|
|
|
|
@@ -495,7 +580,6 @@ function M.search_app_book_data(msg_body)
|
|
|
else
|
|
|
app_param = string.format(" dy_small_applet_app_id = '%s' ",msg_body.app_id)
|
|
|
end
|
|
|
-
|
|
|
end
|
|
|
|
|
|
local param = product_param..product_name_param..tg_platform_param..main_param..app_param;
|