904118851 7 months ago
parent
commit
823015ab06

+ 73 - 0
common/dbproxy/tg_main.lua

@@ -61,6 +61,79 @@ function M.getMainList()
     end
     return true, res
 end
+
+function M.search(msg_body)
+
+    local isok ,key =  tools.checkData({"page_size","page_number","main_name","running_status","custom_budget","pay_type","tg_platform_id","butler_id","tg_app_index","is_open_create_link","is_delete"},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 main_name_param = ""
+    if msg_body.main_name~="" then
+        main_name_param = string.format(" AND  ( main_name LIKE CONCAT( '%%%s%%')) ",msg_body.main_name)
+    end
+
+    local tg_platform_param = ""
+    if msg_body.tg_platform_id~="" then
+        tg_platform_param = string.format(" AND tg_platform_id = %d ",msg_body.tg_platform_id) 
+    end
+
+    local running_status_param = ""
+    if msg_body.running_status~="" then
+        running_status_param = string.format(" AND running_status = %d ",msg_body.running_status) 
+    end
+
+    local pay_type_param = ""
+    if msg_body.pay_type~="" then
+        pay_type_param = string.format(" AND pay_type = %d ",msg_body.pay_type) 
+    end
+
+    local butler_id_param = ""
+    if msg_body.butler_id~="" then
+        butler_id_param = string.format(" AND butler_id = %d ",msg_body.butler_id) 
+    end
+
+    local tg_app_index_param = ""
+    if msg_body.tg_app_index~="" then
+        tg_app_index_param = string.format(" AND tg_app_index = %d ",msg_body.tg_app_index) 
+    end
+
+    local is_open_create_link_param = ""
+    if msg_body.is_open_create_link~="" then
+        is_open_create_link_param = string.format(" AND is_open_create_link = %d ",msg_body.is_open_create_link) 
+    end
+
+
+    local is_delete_param = ""
+    if msg_body.is_delete~="" then
+        is_delete_param = string.format(" AND is_delete = %d ",msg_body.is_delete) 
+    end
+
+    local custom_budget_param = ""
+    if msg_body.custom_budget~="" then
+        custom_budget_param = string.format(" AND custom_budget = %d ",msg_body.custom_budget) 
+    end
+
+    local param = main_name_param..tg_platform_param..running_status_param..pay_type_param..butler_id_param..tg_app_index_param..is_open_create_link_param..is_delete_param..custom_budget_param;
+
+    local sql = "SELECT * FROM tg_main where 1=1 "..param..string.format(" LIMIT %d OFFSET %d ",page_size, offset)
+    local res = mysqldbx.query(sql)
+
+    sql =  "SELECT  COUNT(*) AS total  FROM tg_main where 1=1 "..param
+
+    local total = mysqldbx.query(sql)
+
+    return true,res,total[1].total
+
+end
 -- `main_name` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '主体名称',
 -- `app_id` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT '' COMMENT '小程序ID',
 -- `running_status` tinyint(1) DEFAULT '1' COMMENT '运行状态 0-停止 1-运行中',

+ 0 - 203
service/backmgr/filter_task.lua

@@ -185,209 +185,6 @@ function M.tui_guang_zeng_liang(msg_body)
 end
 
 
---搜索推广数据
---oce_material_id 推广素材id
---book_platform 平台id
---product_id 书id
---sync_status 状态
-function M.search_tg_data(msg_body)
-    local isok ,key =  tools.checkData({"end_time_date",
-    "start_time_date",
-    "sync_status",
-    "product_id",
-    "tg_platform_id",
-    "oce_material_id",
-    "product_name",
-    "material_id",
-    "page_size",
-    "page_number",
-    "dy_id",
-"d_z","comment","collect","forward","status","signature","dy_id_1",},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 = ""
-    if msg_body.product_id~="" then
-        product_param =  string.format(" AND product_id = %d ",tonumber(msg_body.product_id))
-    end
-
-
-    local product_name_param = ""
-    if msg_body.product_name~="" then
-        product_name_param = string.format("AND product_name = '%s' ",msg_body.product_name) 
-    end
-
-    local is_auto_param = ""
-    if msg_body.dy_id~="" then
-        if msg_body.dy_id~=0 then
-            is_auto_param = " AND dy_id != 0"
-        else
-            is_auto_param = " AND dy_id = 0"
-        end
-    end
-
-    local material_id_param = ""
-    if msg_body.material_id~="" then
-        material_id_param =  string.format(" AND id = %d ",tonumber(msg_body.material_id)) 
-    end
-
-    local oce_material_param = ""
-    if msg_body.oce_material_id~="" then
-        oce_material_param =string.format("AND oce_material_id =  %d ",tonumber(msg_body.oce_material_id))
-    end
-    local tg_platform_param = ""
-    if msg_body.tg_platform_id~="" then
-        tg_platform_param = "AND book_platform = "..msg_body.tg_platform_id.." "
-    end
-
-    local date_param = ""
-    if msg_body.start_time_date~="" and msg_body.end_time_date~="" then
-        date_param = " AND DATE(create_at) >= DATE(FROM_UNIXTIME(" .. (msg_body.start_time_date / 1000) .. ")) AND DATE(create_at) <= DATE(FROM_UNIXTIME(" .. (msg_body.end_time_date / 1000) .. "))"
-    end
-
-    local sync_status_param = ""
-
-    if msg_body.sync_status~="" then
-        sync_status_param = "AND sync_status = "..msg_body.sync_status.." "
-    end
-
-
-    local status_param = ""
-
-    if msg_body.status~="" then
-        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
-        if(msg_body.d_z == 0) then
-            d_z_param = " d_z_number ASC"
-        else
-            d_z_param = " d_z_number DESC"
-        end
-    end
-   
-    local comment_param = ""
-    if msg_body.comment~="" then
-        if(msg_body.comment == 0) then
-            comment_param = " comment_number ASC"
-        else
-            comment_param = " comment_number DESC"
-        end
-    end
-
-    local forward_param = ""
-    if msg_body.forward~="" then
-        if(msg_body.forward == 0) then
-            forward_param = " forward_number ASC"
-        else
-            forward_param = " forward_number DESC"
-        end
-    end
-    
-    local collect_param = ""
-    if msg_body.collect~="" then
-        if(msg_body.collect == 0) then
-            collect_param = " collect_number ASC"
-        else
-            collect_param = " collect_number DESC"
-        end
-    end
-    
-
-
-    -----
-    local stat_cost_param = ""
-    if msg_body.stat_cost~="" then
-        if(msg_body.stat_cost == 0) then
-            stat_cost_param = " stat_cost ASC"
-        else
-            stat_cost_param = " stat_cost DESC"
-        end
-    end
-   
-    local show_cnt_param = ""
-    if msg_body.show_cnt~="" then
-        if(msg_body.show_cnt == 0) then
-            show_cnt_param = " comment_number ASC"
-        else
-            show_cnt_param = " comment_number DESC"
-        end
-    end
-
-    local click_cnt_param = ""
-    if msg_body.click_cnt~="" then
-        if(msg_body.click_cnt == 0) then
-            click_cnt_param = " click_cnt ASC"
-        else
-            click_cnt_param = " click_cnt DESC"
-        end
-    end
-    
-    local convert_cnt_param = ""
-    if msg_body.convert_cnt~="" then
-        if(msg_body.convert_cnt == 0) then
-            convert_cnt_param = " convert_cnt ASC"
-        else
-            convert_cnt_param = " convert_cnt DESC"
-        end
-    end
-
-
-    local cvr_param = ""
-    if msg_body.cvr~="" then
-        if(msg_body.cvr == 0) then
-            cvr_param = " cvr ASC"
-        else
-            cvr_param = " cvr DESC"
-        end
-    end
-    
-    local ctr_param = ""
-    if msg_body.ctr~="" then
-        if(msg_body.ctr == 0) then
-            ctr_param = " ctr ASC"
-        else
-            ctr_param = " ctr DESC"
-        end
-    end
-
-    local new_param = stat_cost_param..show_cnt_param..click_cnt_param..convert_cnt_param..cvr_param..ctr_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..new_param
-
-    if up_down_param ~= "" then
-        up_down_param = " ORDER BY " ..up_down_param
-    else
-        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)
-
-    sql =  "SELECT COUNT(*) AS total FROM video_material  WHERE  1=1 "..param.." ORDER BY id DESC "
-    
-    local total = mysqldbx.query(sql)
-
-    return true,res,total[1].total
-end
-
 
 --获取爆量数据总数
 function M.get_bao_liang_total()

+ 2 - 0
service/backmgr/init.lua

@@ -40,6 +40,7 @@ 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 platform_shared = require "platform_shared"
+local material_review = require "material_review"
 local status_200 = 200
 local CMD = {
     
@@ -78,6 +79,7 @@ CMD["tg_main_price_template"] = tg_main_price_template;
 CMD["ad_convert_type"] = ad_convert_type;
 CMD["other_book"] = other_book;
 CMD["platform_shared"] = platform_shared;
+CMD["material_review"] = material_review;
 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)

+ 88 - 0
service/backmgr/material_review.lua

@@ -0,0 +1,88 @@
+--素材审核表
+local M = {}
+local mysqldbx = require "mysqldbx"
+local tools = require "tools"
+local skynet = require "skynet"
+local mysql = require "skynet.db.mysql"
+local config = require "run_config"
+local cjson = require "cjson"
+local db
+local mysqldtaskbx = {}
+
+function M.search(msg_body)
+    local isok ,key =  tools.checkData({"page_size","page_number","material_id","oce_material_id",
+    "is_sexual_inducement_content","is_bad_value_view","start_time_date","end_time_date"},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 material_id_param = ""
+    if msg_body.material_id~="" then
+        material_id_param =  string.format(" AND material_id = %d ",tonumber(msg_body.material_id)) 
+    end
+
+    local oce_material_param = ""
+    if msg_body.oce_material_id~="" then
+        oce_material_param =string.format("AND oce_material_id =  %d ",tonumber(msg_body.oce_material_id))
+    end
+
+    local is_sexual_inducement_content_param = ""
+    if msg_body.is_sexual_inducement_content~="" then
+        is_sexual_inducement_content_param = "AND is_sexual_inducement_content = "..msg_body.is_sexual_inducement_content.." "
+    end
+
+    local is_bad_value_view_param = ""
+    if msg_body.is_bad_value_view~="" then
+        is_bad_value_view_param = "AND is_bad_value_view = "..msg_body.is_bad_value_view.." "
+    end
+
+    local date_param = ""
+    if msg_body.start_time_date~="" and msg_body.end_time_date~="" then
+        date_param = " AND DATE(create_at) >= DATE(FROM_UNIXTIME(" .. (msg_body.start_time_date / 1000) .. ")) AND DATE(create_at) <= DATE(FROM_UNIXTIME(" .. (msg_body.end_time_date / 1000) .. "))"
+    end
+
+    local param = material_id_param..oce_material_param..is_sexual_inducement_content_param..is_bad_value_view_param..date_param
+
+    local sql = "SELECT * FROM video_material_review where 1=1 "..param..string.format(" LIMIT %d OFFSET %d ",page_size, offset)
+    skynet.error("sql:",sql)
+    local list = mysqldtaskbx.Singleton().query(sql)
+    sql = "SELECT   COUNT(*) AS total  FROM video_material_review where 1=1 "..param
+    local total = mysqldtaskbx.Singleton().query(sql)
+    return true,list,total[1].total
+end
+
+function mysqldtaskbx.start()
+    local function on_connect(db)
+        db:query("set charset utf8mb4");
+    end
+    local conf = config.db_cnf.book_server.mysqldb_material_review_cnf
+    db = mysql.connect{
+        host=conf.ip,
+        port=conf.port,
+        database=conf.db,
+        user=conf.user,
+        password=conf.password,
+        charset="utf8mb4",
+        max_packet_size = 1024 * 1024,
+        on_connect = on_connect
+    }
+    if not db then
+       skynet.error("mysql connect fail")
+    end
+end
+
+function mysqldtaskbx.Singleton()
+    if db == nil then
+        mysqldtaskbx.start()
+    end
+    return mysqldtaskbx
+end
+function mysqldtaskbx.query(sql)
+    return db:query(sql)
+end
+
+return M

+ 232 - 0
service/backmgr/video_material.lua

@@ -28,4 +28,236 @@ function M.set_tui_guang_status(msg_body)
     return true,{}
 end
 
+--设置审核状态
+function M.set_artificial_status(msg_body)
+    local isok ,key =  tools.checkData({"id_list","artificial_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 video_material 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  video_material SET artificial_status = %d WHERE id =%d ",msg_body.artificial_status,id)
+        mysqldbx.query(sql)
+    end
+    
+    return true,{}
+end
+
+--搜索推广数据
+--oce_material_id 推广素材id
+--book_platform 平台id
+--product_id 书id
+--sync_status 状态
+function M.search(msg_body)
+    local isok ,key =  tools.checkData({"end_time_date",
+    "start_time_date",
+    "sync_status",
+    "product_id",
+    "tg_platform_id",
+    "oce_material_id",
+    "product_name",
+    "material_id",
+    "page_size",
+    "page_number",
+    "dy_id",
+"d_z","comment","collect","forward","status","signature","dy_id_1","artificial_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 product_param = ""
+    if msg_body.product_id~="" then
+        product_param =  string.format(" AND product_id = %d ",tonumber(msg_body.product_id))
+    end
+
+
+    local product_name_param = ""
+    if msg_body.product_name~="" then
+        product_name_param = string.format("AND product_name = '%s' ",msg_body.product_name) 
+    end
+
+    local is_auto_param = ""
+    if msg_body.dy_id~="" then
+        if msg_body.dy_id~=0 then
+            is_auto_param = " AND dy_id != 0"
+        else
+            is_auto_param = " AND dy_id = 0"
+        end
+    end
+
+    local material_id_param = ""
+    if msg_body.material_id~="" then
+        material_id_param =  string.format(" AND id = %d ",tonumber(msg_body.material_id)) 
+    end
+
+    local oce_material_param = ""
+    if msg_body.oce_material_id~="" then
+        oce_material_param =string.format("AND oce_material_id =  %d ",tonumber(msg_body.oce_material_id))
+    end
+    local tg_platform_param = ""
+    if msg_body.tg_platform_id~="" then
+        tg_platform_param = " AND book_platform = "..msg_body.tg_platform_id.." "
+    end
+
+    local date_param = ""
+    if msg_body.start_time_date~="" and msg_body.end_time_date~="" then
+        date_param = " AND DATE(create_at) >= DATE(FROM_UNIXTIME(" .. (msg_body.start_time_date / 1000) .. ")) AND DATE(create_at) <= DATE(FROM_UNIXTIME(" .. (msg_body.end_time_date / 1000) .. "))"
+    end
+
+    local sync_status_param = ""
+
+    if msg_body.sync_status~="" then
+        sync_status_param = " AND sync_status = "..msg_body.sync_status.." "
+    end
+
+
+    local status_param = ""
+
+    if msg_body.status~="" then
+        status_param = " AND status = "..msg_body.status.." "
+    end
+
+    local artificial_status_param = ""
+
+    if msg_body.artificial_status~="" then
+        artificial_status_param = " AND artificial_status = "..msg_body.artificial_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
+        if(msg_body.d_z == 0) then
+            d_z_param = " d_z_number ASC"
+        else
+            d_z_param = " d_z_number DESC"
+        end
+    end
+   
+    local comment_param = ""
+    if msg_body.comment~="" then
+        if(msg_body.comment == 0) then
+            comment_param = " comment_number ASC"
+        else
+            comment_param = " comment_number DESC"
+        end
+    end
+
+    local forward_param = ""
+    if msg_body.forward~="" then
+        if(msg_body.forward == 0) then
+            forward_param = " forward_number ASC"
+        else
+            forward_param = " forward_number DESC"
+        end
+    end
+    
+    local collect_param = ""
+    if msg_body.collect~="" then
+        if(msg_body.collect == 0) then
+            collect_param = " collect_number ASC"
+        else
+            collect_param = " collect_number DESC"
+        end
+    end
+    
+
+
+    -----
+    local stat_cost_param = ""
+    if msg_body.stat_cost~="" then
+        if(msg_body.stat_cost == 0) then
+            stat_cost_param = " stat_cost ASC"
+        else
+            stat_cost_param = " stat_cost DESC"
+        end
+    end
+   
+    local show_cnt_param = ""
+    if msg_body.show_cnt~="" then
+        if(msg_body.show_cnt == 0) then
+            show_cnt_param = " comment_number ASC"
+        else
+            show_cnt_param = " comment_number DESC"
+        end
+    end
+
+    local click_cnt_param = ""
+    if msg_body.click_cnt~="" then
+        if(msg_body.click_cnt == 0) then
+            click_cnt_param = " click_cnt ASC"
+        else
+            click_cnt_param = " click_cnt DESC"
+        end
+    end
+    
+    local convert_cnt_param = ""
+    if msg_body.convert_cnt~="" then
+        if(msg_body.convert_cnt == 0) then
+            convert_cnt_param = " convert_cnt ASC"
+        else
+            convert_cnt_param = " convert_cnt DESC"
+        end
+    end
+
+
+    local cvr_param = ""
+    if msg_body.cvr~="" then
+        if(msg_body.cvr == 0) then
+            cvr_param = " cvr ASC"
+        else
+            cvr_param = " cvr DESC"
+        end
+    end
+    
+    local ctr_param = ""
+    if msg_body.ctr~="" then
+        if(msg_body.ctr == 0) then
+            ctr_param = " ctr ASC"
+        else
+            ctr_param = " ctr DESC"
+        end
+    end
+
+    local new_param = stat_cost_param..show_cnt_param..click_cnt_param..convert_cnt_param..cvr_param..ctr_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..artificial_status_param
+
+    local up_down_param = d_z_param..comment_param..forward_param..collect_param..new_param
+
+    if up_down_param ~= "" then
+        up_down_param = " ORDER BY " ..up_down_param
+    else
+        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)
+
+    skynet.error("sql:",sql)
+
+    sql =  "SELECT COUNT(*) AS total FROM video_material  WHERE  1=1 "..param.." ORDER BY id DESC "
+    
+    local total = mysqldbx.query(sql)
+
+    return true,res,total[1].total
+end
+
 return M