904118851 há 8 meses atrás
pai
commit
6853c7507a

+ 12 - 0
service/backmgr/fq_book.lua

@@ -39,6 +39,18 @@ function M.delete_fq_book_sid_tt(msg_body)
     return true, {}
 end
 
+
+function M.set_use_status(msg_body)
+    local isok ,key =  tools.checkData({"canUse","id"},msg_body)
+    if not isok then
+        return false,string.format("缺少字段: %s.", key)
+    end
+    local sql = string.format("UPDATE  fq_book_config SET canUse = %d WHERE id =%d ",msg_body.canUse,msg_body.id)
+    mysqldbx.query(sql)
+    skynet.send("backmgr","lua","on_recv",nil,"ws_push_msg",cjson.encode({cmd="updateFqKeyList"}))
+    return true, {}
+end
+
 function M.fq_book_list(msg_body)
     local isok ,key =  tools.checkData({"page_size","page_number"},msg_body)
     if not isok then

+ 5 - 0
service/backmgr/init.lua

@@ -25,6 +25,8 @@ local video_applet_product = require "video_applet_product"
 local filter_data = require "filter_data"
 local video_material = require "video_material"
 local no_filter_origin = require "no_filter_origin"
+local origin_video_titles = require "origin_video_titles"
+local promotion_audit_suggestions = require "promotion_audit_suggestions"
 local status_200 = 200
 local CMD = {
     
@@ -48,6 +50,9 @@ CMD["video_applet_product"] = video_applet_product;
 CMD["filter_data"] = filter_data;
 CMD["video_material"] = video_material;
 CMD["no_filter_origin"] = no_filter_origin;
+CMD["origin_video_titles"] = origin_video_titles;
+CMD["promotion_audit_suggestions"] = promotion_audit_suggestions;
+
 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)

+ 16 - 0
service/backmgr/origin_data.lua

@@ -0,0 +1,16 @@
+--原始数据
+local M = {}
+local mysqldbx = require "mysqldbx"
+local tools = require "tools"
+local skynet = require "skynet"
+local cjson = require "cjson"
+
+function M.delete_origin_data_by_time(msg_body)
+    local isok ,key =  tools.checkData({"start_create_time","end_create_time"},msg_body)
+    if not isok then
+        return false,string.format("缺少字段: %s.", key)
+    end
+    local delete_time_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
+
+return M

+ 10 - 4
service/backmgr/origin_video_titles.lua

@@ -1,4 +1,4 @@
---视频标题
+--原始视频标题
 local M = {}
 local mysqldbx = require "mysqldbx"
 local tools = require "tools"
@@ -36,7 +36,8 @@ function M.publish_origin_video_titles(msg_body)
 end
 
 function M.search_origin_video_titles(msg_body)
-    local isok ,key =  tools.checkData({"page_size","page_number","content","start_create_time","end_create_time"},msg_body)
+    local isok ,key =  tools.checkData({"page_size","page_number","content","start_create_time",
+    "end_create_time"},msg_body)
     if not isok then
         return false,string.format("缺少字段: %s.", key)
     end
@@ -44,14 +45,19 @@ function M.search_origin_video_titles(msg_body)
     local page_number = msg_body.page_number
     local offset = (page_number - 1) * page_size
     
+    local content_param = ""
+    if msg_body.content~="" then
+        content_param =  string.format(" AND  ( title LIKE CONCAT( '%%%s%%')) ",msg_body.content)
+    end
+
     local create_date_param = ""
     if msg_body.start_create_time~="" and msg_body.end_create_time~="" then
         create_date_param = " AND DATE(create_time) >= DATE(FROM_UNIXTIME(" .. (msg_body.start_create_time / 1000) .. ")) AND DATE(create_time) <= DATE(FROM_UNIXTIME(" .. (msg_body.end_create_time / 1000) .. "))"
     end
 
-    local sql = "SELECT * FROM origin_video_titles WHERE 1=1 "..create_date_param..string.format("  AND (title LIKE CONCAT( '%%%s%%')) ",msg_body.content)..string.format(" LIMIT %d OFFSET %d ",page_size, offset)
+    local sql = "SELECT * FROM origin_video_titles WHERE 1=1 "..create_date_param..content_param..string.format("  AND (title LIKE CONCAT( '%%%s%%')) ",msg_body.content)..string.format(" LIMIT %d OFFSET %d ",page_size, offset)
     local list = mysqldbx.query(sql)
-    sql = "SELECT   COUNT(*) AS total  FROM origin_video_titles  WHERE 1=1 "..create_date_param..string.format(" AND  (title LIKE CONCAT( '%%%s%%')) ",msg_body.content)
+    sql = "SELECT   COUNT(*) AS total  FROM origin_video_titles  WHERE 1=1 "..create_date_param..content_param..string.format(" AND  (title LIKE CONCAT( '%%%s%%')) ",msg_body.content)
     local total = mysqldbx.query(sql)
     return true,list,total[1].total
 end

+ 82 - 0
service/backmgr/promotion_audit_suggestions.lua

@@ -0,0 +1,82 @@
+--审核建议列表
+local M = {}
+local mysqldbx = require "mysqldbx"
+local tools = require "tools"
+local skynet = require "skynet"
+local cjson = require "cjson"
+
+function M.set_status(msg_body)
+    local isok ,key =  tools.checkData({"id_list","status"},msg_body)
+    if not isok then
+        return false,string.format("缺少字段: %s.", key)
+    end
+
+    local idString = table.concat(msg_body.id_list, ",")
+    local sql = string.format("SELECT * FROM promotion_audit_suggestions WHERE id IN (%s)",idString)
+    local isok,res;
+    res = mysqldbx.query(sql)
+
+    for i = 1, #res, 1 do
+        local id =   res[i].id
+        sql = string.format("UPDATE  promotion_audit_suggestions SET status = %d WHERE id =%d ",msg_body.status,id)
+        mysqldbx.query(sql)
+    end
+
+    return true,{}
+end
+
+function M.search_promotion_audit_suggestions(msg_body)
+    local isok ,key =  tools.checkData({"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)
+    end
+    local page_size = msg_body.page_size
+    local page_number = msg_body.page_number
+    local offset = (page_number - 1) * page_size
+
+
+    local advertiser_id_param = ""
+    if msg_body.advertiser_id~="" then
+        advertiser_id_param =  " AND advertiser_id = "..msg_body.advertiser_id
+    end
+
+    local promotion_id_param = ""
+    if msg_body.promotion_id~="" then
+        promotion_id_param =  " AND promotion_id = "..msg_body.promotion_id
+    end
+
+    local material_type_param = ""
+    if msg_body.material_type~="" then
+        material_type_param =  " AND material_type = "..msg_body.material_type
+    end
+
+    local material_item_param = ""
+    if msg_body.material_item~="" then
+        material_item_param =  string.format(" AND  ( material_item LIKE CONCAT( '%%%s%%')) ",msg_body.material_item)
+    end
+
+    local status_param = ""
+    if msg_body.status~="" then
+        status_param = " AND status = "..msg_body.status
+    end
+
+    local create_date_param = ""
+    if msg_body.start_create_time~="" and msg_body.end_create_time~="" then
+        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
+
+    local sql = "SELECT * FROM promotion_audit_suggestions WHERE 1=1 "..param..string.format(" LIMIT %d OFFSET %d ",page_size, offset)
+   
+    local list = mysqldbx.query(sql)
+
+    sql = "SELECT   COUNT(*) AS total  FROM promotion_audit_suggestions WHERE 1=1  "..param
+
+    local total = mysqldbx.query(sql)
+
+    return true,list,total[1].total
+end
+
+return M