|
@@ -215,7 +215,7 @@ function M.search_tg_data(msg_body)
|
|
|
"page_size",
|
|
|
"page_number",
|
|
|
"dy_id",
|
|
|
-"d_z","comment","collect","forward","status"},msg_body)
|
|
|
+"d_z","comment","collect","forward","status","signature","dy_id_1",},msg_body)
|
|
|
if not isok then
|
|
|
return false,string.format("缺少字段: %s.", key)
|
|
|
end
|
|
@@ -274,6 +274,15 @@ function M.search_tg_data(msg_body)
|
|
|
status_param = "AND status = "..msg_body.status.." "
|
|
|
end
|
|
|
|
|
|
+ local signature_param = ""
|
|
|
+ if msg_body.signature~="" then
|
|
|
+ signature_param = string.format("AND signature = '%s' ",msg_body.signature)
|
|
|
+ end
|
|
|
+
|
|
|
+ local dy_id_1_param = ""
|
|
|
+ if msg_body.dy_id_1~="" then
|
|
|
+ dy_id_1_param = " AND dy_id = "..tonumber(msg_body.dy_id_1)
|
|
|
+ end
|
|
|
|
|
|
local d_z_param = ""
|
|
|
if msg_body.d_z~="" then
|
|
@@ -311,7 +320,7 @@ function M.search_tg_data(msg_body)
|
|
|
end
|
|
|
end
|
|
|
|
|
|
- local param = date_param..product_param..oce_material_param..status_param..tg_platform_param..sync_status_param..product_name_param..is_auto_param..material_id_param
|
|
|
+ local param = date_param..product_param..oce_material_param..status_param..tg_platform_param..sync_status_param..product_name_param..is_auto_param..material_id_param..signature_param..dy_id_1_param
|
|
|
|
|
|
local up_down_param = d_z_param..comment_param..forward_param..collect_param
|
|
|
|
|
@@ -321,8 +330,6 @@ function M.search_tg_data(msg_body)
|
|
|
up_down_param = " ORDER BY id DESC "
|
|
|
end
|
|
|
|
|
|
-
|
|
|
-
|
|
|
local sql = "SELECT * FROM video_material WHERE 1=1 "..param..up_down_param..string.format(" LIMIT %d OFFSET %d ",page_size, offset)
|
|
|
|
|
|
local res = mysqldbx.query(sql)
|
|
@@ -442,97 +449,7 @@ function M.search_bao_liang_data(msg_body)
|
|
|
return true,res,total[1].total
|
|
|
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","is_auto"},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 = ""
|
|
|
- local isFirst = false
|
|
|
- local and_param = " AND "
|
|
|
- if msg_body.product_id~="" then
|
|
|
- isFirst = true;
|
|
|
- product_param = string.format(" product_id = '%s' ",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 tg_platform_param = ""
|
|
|
- if msg_body.tg_platform_id~="" then
|
|
|
- if isFirst==true then
|
|
|
- tg_platform_param = string.format("AND book_platform = %d ",msg_body.tg_platform_id)
|
|
|
- else
|
|
|
- isFirst = true;
|
|
|
- tg_platform_param = string.format(" book_platform = %d ",msg_body.tg_platform_id)
|
|
|
- end
|
|
|
-
|
|
|
- end
|
|
|
- local is_auto_param = ""
|
|
|
- if msg_body.is_auto~="" then
|
|
|
- if isFirst==true then
|
|
|
- is_auto_param = "AND is_auto = "..msg_body.is_auto.." "
|
|
|
- else
|
|
|
- isFirst = true;
|
|
|
- is_auto_param = " is_auto = "..msg_body.is_auto.." "
|
|
|
- end
|
|
|
-
|
|
|
- end
|
|
|
-
|
|
|
- local is_store_param = ""
|
|
|
- if msg_body.is_store~="" then
|
|
|
- if isFirst==true then
|
|
|
- is_store_param = "AND is_store = "..msg_body.is_store.." "
|
|
|
- else
|
|
|
- isFirst = true;
|
|
|
- is_store_param = " is_store = "..msg_body.is_store.." "
|
|
|
- end
|
|
|
-
|
|
|
- end
|
|
|
-
|
|
|
- local genre_param = ""
|
|
|
- if msg_body.genre~="" then
|
|
|
- if isFirst==true then
|
|
|
- genre_param = "AND genre = "..msg_body.genre.." "
|
|
|
- else
|
|
|
- isFirst = true;
|
|
|
- genre_param = " genre = "..msg_body.genre.." "
|
|
|
- end
|
|
|
-
|
|
|
- end
|
|
|
|
|
|
- local param = product_param..product_name_param..tg_platform_param..is_auto_param..is_store_param..genre_param;
|
|
|
-
|
|
|
- if param ~= "" then
|
|
|
- param = " WHERE "..param
|
|
|
- end
|
|
|
- local sql = "SELECT * FROM video_product "..param.." ORDER BY id DESC "..string.format(" LIMIT %d OFFSET %d ",page_size, offset)
|
|
|
- local res = mysqldtaskbx.Singleton().query(sql)
|
|
|
-
|
|
|
- sql = "SELECT COUNT(*) AS total FROM video_product "..param.."ORDER BY id DESC"
|
|
|
-
|
|
|
- local total = mysqldtaskbx.Singleton().query(sql)
|
|
|
-
|
|
|
- return true,res,total[1].total
|
|
|
-end
|
|
|
|
|
|
--搜索小程序书
|
|
|
--tg_platform_id 平台id
|