|
@@ -144,7 +144,7 @@ function M.mainFilter(msg_body)
|
|
|
end
|
|
|
|
|
|
function M.search(msg_body)
|
|
|
- local isok ,key = tools.checkData({"advertiser_id_list","avatar_status","property_status","main_id","content","page_size","page_number","status"},msg_body)
|
|
|
+ local isok ,key = tools.checkData({"advertiser_grant_balance_valid","stat_cost","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
|
|
@@ -152,6 +152,25 @@ function M.search(msg_body)
|
|
|
local page_number = msg_body.page_number
|
|
|
local offset = (page_number - 1) * page_size
|
|
|
|
|
|
+
|
|
|
+ local advertiser_grant_balance_valid_param = ""
|
|
|
+ if msg_body.advertiser_grant_balance_valid~="" then
|
|
|
+ if msg_body.advertiser_grant_balance_valid>0 then
|
|
|
+ advertiser_grant_balance_valid_param = string.format(" advertiser_grant_balance_valid DESC ")
|
|
|
+ else
|
|
|
+ advertiser_grant_balance_valid_param = string.format(" advertiser_grant_balance_valid ASC ")
|
|
|
+ end
|
|
|
+ end
|
|
|
+
|
|
|
+ local stat_cost_param = ""
|
|
|
+ if msg_body.stat_cost~="" then
|
|
|
+ if msg_body.stat_cost>0 then
|
|
|
+ stat_cost_param = string.format(" stat_cost DESC ")
|
|
|
+ else
|
|
|
+ stat_cost_param = string.format(" stat_cost ASC ")
|
|
|
+ end
|
|
|
+ end
|
|
|
+
|
|
|
local advertiser_id_list_param = ""
|
|
|
if msg_body.advertiser_id_list~="" then
|
|
|
local idString = table.concat(msg_body.advertiser_id_list, ",")
|
|
@@ -184,12 +203,17 @@ 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 order_param = advertiser_grant_balance_valid_param..stat_cost_param
|
|
|
+ if order_param == "" then
|
|
|
+ order_param = " id DESC "
|
|
|
+ end
|
|
|
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)
|
|
|
|
|
|
- sql = "SELECT * FROM advertiser WHERE 1=1 "..param..string.format(" ORDER BY id LIMIT %d OFFSET %d ",page_size, offset)
|
|
|
+ sql = "SELECT * FROM advertiser WHERE 1=1 "..param..string.format(" ORDER BY %s LIMIT %d OFFSET %d ",order_param,page_size, offset)
|
|
|
local res;
|
|
|
+ skynet.error(sql)
|
|
|
res = mysqldbx.query(sql)
|
|
|
return true,res,total[1].total
|
|
|
end
|