904118851 7 månader sedan
förälder
incheckning
299cf79db4

+ 2 - 0
service/backmgr/init.lua

@@ -38,6 +38,7 @@ local checks = require "checks"
 local fq_mf_book = require "fq_mf_book"
 local tg_main_price_template = require "tg_main_price_template"
 local ad_convert_type = require "ad_convert_type"
+local other_book = require "other_book"
 local status_200 = 200
 local CMD = {
     
@@ -74,6 +75,7 @@ CMD["checks"] = checks;
 CMD["fq_mf_book"] = fq_mf_book;
 CMD["tg_main_price_template"] = tg_main_price_template;
 CMD["ad_convert_type"] = ad_convert_type;
+CMD["other_book"] = other_book;
 function run(target,fun,msg_body,fd)
     if target~=nil and fun~=nil and target[fun]~=nil then
         local isok,data,total = target[fun](msg_body)

+ 2 - 2
service/backmgr/origin_data.lua

@@ -51,13 +51,13 @@ function M.search_origin_data(msg_body)
 
     local create_date_param = ""
     if msg_body.start_create_time~="" and msg_body.end_create_time~="" then
-        create_date_param = " AND create_day >= DATE(FROM_UNIXTIME(" .. (msg_body.start_create_time / 1000) .. ")) AND create_day <= DATE(FROM_UNIXTIME(" .. (msg_body.end_create_time / 1000) .. "))"
+        create_date_param = " AND create_day >= DATE(FROM_UNIXTIME(" .. (msg_body.start_create_time / 1000) .. ")) AND create_day <= DATE(FROM_UNIXTIME(" .. (msg_body.end_create_time / 1000) .. ")) "
     end
 
     local guajian_info_param = ""
     -- 挂件信息条件
     if msg_body.guajian_info ~= "" then
-        guajian_info_param = string.format(" AND (guajian_link LIKE '%%%s%%' ) ",msg_body.guajian_info)
+        guajian_info_param = string.format("  AND guajian_link LIKE CONCAT('%%', '%s', '%%')  ",msg_body.guajian_info)
     end
 
     local materialId_param = ""

+ 43 - 0
service/backmgr/other_book.lua

@@ -0,0 +1,43 @@
+--失败书籍
+local M = {}
+local mysqldbx = require "mysqldbx"
+local tools = require "tools"
+local skynet = require "skynet"
+local cjson = require "cjson"
+
+function M.delete_other_book(msg_body)
+    local isok ,key =  tools.checkData({"id_list"},msg_body)
+    if not isok then
+        return false,string.format("缺少字段: %s.", key)
+    end
+    for i = 1, #msg_body.id_list, 1 do
+        local id = msg_body.id_list[i]
+        local sql = string.format("DELETE FROM other_book WHERE id = %d ",id)
+        mysqldbx.query(sql)
+    end
+    return true, {}
+end
+
+
+function M.search_other_book(msg_body)
+    local isok ,key =  tools.checkData({"page_size","page_number","tg_platform_id"},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 tg_platform_id_param = ""
+    if msg_body.tg_platform_id~="" then
+        tg_platform_id_param =  " AND tg_platform_id = "..msg_body.tg_platform_id.." "
+    end
+
+    local sql = "SELECT * FROM other_book "..tg_platform_id_param..string.format(" LIMIT %d OFFSET %d ",page_size, offset)
+    local list = mysqldbx.query(sql)
+    sql = "SELECT   COUNT(*) AS total  FROM other_book "..tg_platform_id_param
+    local total = mysqldbx.query(sql)
+    return true,list,total[1].total
+end
+
+return M

+ 7 - 2
service/backmgr/promotion_audit_suggestions.lua

@@ -26,7 +26,7 @@ function M.set_status(msg_body)
 end
 
 function M.search_promotion_audit_suggestions(msg_body)
-    local isok ,key =  tools.checkData({"page_size","page_number","start_create_time","end_create_time",
+    local isok ,key =  tools.checkData({"butler_id","page_size","page_number","start_create_time","end_create_time",
     "advertiser_id","promotion_id","material_type","material_item","status"},msg_body)
     if not isok then
         return false,string.format("缺少字段: %s.", key)
@@ -35,6 +35,11 @@ function M.search_promotion_audit_suggestions(msg_body)
     local page_number = msg_body.page_number
     local offset = (page_number - 1) * page_size
 
+    
+    local butler_id_param = ""
+    if msg_body.butler_id~="" then
+        butler_id_param =  " AND butler_id = "..msg_body.butler_id
+    end
 
     local advertiser_id_param = ""
     if msg_body.advertiser_id~="" then
@@ -76,7 +81,7 @@ function M.search_promotion_audit_suggestions(msg_body)
         create_date_param = " AND DATE(created_at) >= DATE(FROM_UNIXTIME(" .. (msg_body.start_create_time / 1000) .. ")) AND DATE(created_at) <= DATE(FROM_UNIXTIME(" .. (msg_body.end_create_time / 1000) .. "))"
     end
 
-    local param = create_date_param..advertiser_id_param..promotion_id_param..material_type_param..material_item_param..status_param..product_id_param..product_library_id_param
+    local param = create_date_param..advertiser_id_param..promotion_id_param..material_type_param..material_item_param..status_param..product_id_param..product_library_id_param..butler_id_param
 
     local sql = "SELECT * FROM promotion_audit_suggestions WHERE 1=1 "..param.. " ORDER BY cost DESC "..string.format(" LIMIT %d OFFSET %d ",page_size, offset)