|
@@ -31,6 +31,26 @@ function M.getTotal()
|
|
|
return true,res[1]
|
|
|
end
|
|
|
|
|
|
+
|
|
|
+function M.advertiserListOfMain(msg_body)
|
|
|
+ local isok ,key = tools.checkData({"id_list","main_id"},msg_body)
|
|
|
+ if not isok then
|
|
|
+ return false,string.format("缺少字段: %s.", key)
|
|
|
+ end
|
|
|
+ local fail_list = {}
|
|
|
+ for i = 1, #msg_body.id_list, 1 do
|
|
|
+ local id = msg_body.id_list[i]
|
|
|
+ local sql = string.format("SELECT * FROM advertiser where advertiser_id = '%s' and main_id = %d ", id,msg_body.main_id)
|
|
|
+ local isok,res;
|
|
|
+ res = mysqldbx.query(sql)
|
|
|
+ if #res <1 then
|
|
|
+ table.insert(fail_list,#fail_list+1,id)
|
|
|
+ end
|
|
|
+ end
|
|
|
+ return true,fail_list
|
|
|
+end
|
|
|
+
|
|
|
+
|
|
|
function M.setZhanghuOfMain(msg_body)
|
|
|
local isok ,key = tools.checkData({"id_list","main_id"},msg_body)
|
|
|
if not isok then
|
|
@@ -124,7 +144,7 @@ function M.mainFilter(msg_body)
|
|
|
end
|
|
|
|
|
|
function M.search(msg_body)
|
|
|
- local isok ,key = tools.checkData({"main_id","content","page_size","page_number","status"},msg_body)
|
|
|
+ local isok ,key = tools.checkData({"advertiser_id_list","avatar_status","property_status","main_id","content","page_size","page_number","status"},msg_body)
|
|
|
if not isok then
|
|
|
return false,string.format("缺少字段: %s.", key)
|
|
|
end
|
|
@@ -132,6 +152,23 @@ function M.search(msg_body)
|
|
|
local page_number = msg_body.page_number
|
|
|
local offset = (page_number - 1) * page_size
|
|
|
|
|
|
+ local advertiser_id_list_param = ""
|
|
|
+ if msg_body.advertiser_id_list~="" then
|
|
|
+ local idString = table.concat(msg_body.advertiser_id_list, ",")
|
|
|
+ advertiser_id_list_param = string.format(" AND advertiser_id IN (%s) ",idString)
|
|
|
+ end
|
|
|
+
|
|
|
+
|
|
|
+ local property_status_param = ""
|
|
|
+ if msg_body.property_status~="" then
|
|
|
+ property_status_param = "AND property_status = "..msg_body.property_status.." "
|
|
|
+ end
|
|
|
+
|
|
|
+ local avatar_status_param = ""
|
|
|
+ if msg_body.avatar_status~="" then
|
|
|
+ avatar_status_param = "AND avatar_status = "..msg_body.avatar_status.." "
|
|
|
+ end
|
|
|
+
|
|
|
local statuss_param = ""
|
|
|
if msg_body.status~="" then
|
|
|
statuss_param = "AND status = "..msg_body.status.." "
|
|
@@ -147,7 +184,7 @@ function M.search(msg_body)
|
|
|
content_param = string.format(" AND (advertiser_name LIKE CONCAT( '%%%s%%')) OR (advertiser_id LIKE CONCAT('%%%s%%'))",msg_body.content,msg_body.content)
|
|
|
end
|
|
|
|
|
|
- local param = statuss_param..main_id_param..content_param
|
|
|
+ local param = advertiser_id_list_param..avatar_status_param..property_status_param..statuss_param..main_id_param..content_param
|
|
|
local sql = "SELECT COUNT(*) AS total FROM advertiser WHERE 1=1 "..param
|
|
|
local total = mysqldbx.query(sql)
|
|
|
|
|
@@ -198,24 +235,6 @@ function searchZhanghuName(name,id)
|
|
|
M.setZhanghuOfMain({id_list=id_list,main_id=id})
|
|
|
end
|
|
|
end
|
|
|
-
|
|
|
-function M.advertiserListOfMain(msg_body)
|
|
|
- local isok ,key = tools.checkData({"id_list","main_id"},msg_body)
|
|
|
- if not isok then
|
|
|
- return false,string.format("缺少字段: %s.", key)
|
|
|
- end
|
|
|
- local fail_list = {}
|
|
|
- for i = 1, #msg_body.id_list, 1 do
|
|
|
- local id = msg_body.id_list[i]
|
|
|
- local sql = string.format("SELECT * FROM advertiser where advertiser_id = '%s' and main_id = %d ", id,msg_body.main_id)
|
|
|
- local isok,res;
|
|
|
- res = mysqldbx.query(sql)
|
|
|
- if #res <1 then
|
|
|
- table.insert(fail_list,#fail_list+1,id)
|
|
|
- end
|
|
|
- end
|
|
|
- return true,fail_list
|
|
|
-end
|
|
|
function M.init()
|
|
|
local sql = string.format("select * from `tg_main` ")
|
|
|
local isok,res;
|