904118851 4 luni în urmă
părinte
comite
4c1ad855ac

+ 24 - 6
common/dbproxy/tg_main.lua

@@ -64,7 +64,7 @@ end
 
 function M.search(msg_body)
 
-    local isok ,key =  tools.checkData({"cbo_status","project_type","oce_product_id",
+    local isok ,key =  tools.checkData({"statistics_platform_id","converted_time_duration","cbo_status","project_type","oce_product_id",
     "oce_product_platform_id",
     "delivery_mode","material_platform_id","wx_miniapp_create_status","template_bid","cpa_bid","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)
    
@@ -78,7 +78,16 @@ function M.search(msg_body)
 
     local offset = (page_number - 1) * page_size
 
-    
+    local statistics_platform_id_param = ""
+    if msg_body.statistics_platform_id~=""  then
+        statistics_platform_id_param = string.format(" AND statistics_platform_id =  %d ",msg_body.statistics_platform_id) 
+    end
+
+    local converted_time_duration_param = ""
+    if msg_body.converted_time_duration~=""  then
+        converted_time_duration_param = string.format(" AND converted_time_duration = '%s' ",msg_body.converted_time_duration) 
+    end
+
     local infra_status_param = ""
     if msg_body.infra_status~=""  then
         infra_status_param = string.format(" AND infra_status =  %d ",msg_body.infra_status) 
@@ -185,7 +194,7 @@ function M.search(msg_body)
     --     genre_param =  string.format(" AND genre = %d ",msg_body.genre) 
     -- end
 
-    local param = infra_status_param..cbo_script_status_param..cbo_status_param..project_type_param..oce_product_platform_id_param..oce_product_id_param..delivery_mode_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..cpa_bid_param..template_bid_param..wx_miniapp_create_status_param..material_platform_id_param;
+    local param = statistics_platform_id_param..converted_time_duration_param..infra_status_param..cbo_script_status_param..cbo_status_param..project_type_param..oce_product_platform_id_param..oce_product_id_param..delivery_mode_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..cpa_bid_param..template_bid_param..wx_miniapp_create_status_param..material_platform_id_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)
     skynet.error("sql:",sql)
@@ -208,13 +217,16 @@ end
 -- `daily_new_limit` int DEFAULT '0' COMMENT '今天新上数量上限',
 
 function M.addMain(msg_body)
-    local isok ,key =  tools.checkData({"cbo_script_time","cbo_script_status","cbo_status","project_type","tf_status","tf_start_time","stat_cost","oce_product_id","oce_product_platform_id","material_platform_id","strategy_config","delivery_mode","price","pack_strategy_status","start_chapter","advertiser_id","wx_miniapp_create_status","ad_act","template_bid","zh_id","roi_goal","ql_bid","infra_status","pay_type","qm_id","ldy_template_site_id","yw_id","parent_platform_id","platform_shared_id","distributor_id","is_delete","ad_convert_type","aweme_id","tg_app_index","butler_id","mini_program_platform_id","landing_page","valid_timer_time","valid_timer_number","channelId","no_bid_budget","max_ad_quantity","tg_link_config","tg_platform_id","app_id","main_name","running_status","ad_quantity","cpa_bid","bid_type","bid_ratio","custom_budget","daily_new_limit","valid_time","group_id"},msg_body)
+    local isok ,key =  tools.checkData({"statistics_platform_id","hide_if_converted","converted_time_duration","cbo_script_time","cbo_script_status","cbo_status","project_type","tf_status","tf_start_time","stat_cost","oce_product_id","oce_product_platform_id","material_platform_id","strategy_config","delivery_mode","price","pack_strategy_status","start_chapter","advertiser_id","wx_miniapp_create_status","ad_act","template_bid","zh_id","roi_goal","ql_bid","infra_status","pay_type","qm_id","ldy_template_site_id","yw_id","parent_platform_id","platform_shared_id","distributor_id","is_delete","ad_convert_type","aweme_id","tg_app_index","butler_id","mini_program_platform_id","landing_page","valid_timer_time","valid_timer_number","channelId","no_bid_budget","max_ad_quantity","tg_link_config","tg_platform_id","app_id","main_name","running_status","ad_quantity","cpa_bid","bid_type","bid_ratio","custom_budget","daily_new_limit","valid_time","group_id"},msg_body)
     if not isok then
         return false,string.format("缺少字段: %s.", key)
     end
     local current_time = os.date("%Y-%m-%d %H:%M:%S")
     msg_body.create_time = current_time
-    local sql = string.format("INSERT INTO `tg_main` (cbo_script_time,cbo_script_status,cbo_status,project_type,tf_status,tf_start_time,stat_cost,oce_product_id,oce_product_platform_id,material_platform_id,strategy_config,delivery_mode,price,pack_strategy_status,start_chapter,advertiser_id,wx_miniapp_create_status,genre,ad_act,template_bid,zh_id,roi_goal,ql_bid,infra_status,pay_type,qm_id,ldy_template_site_id,yw_id,parent_platform_id,platform_shared_id,distributor_id,is_delete,ad_convert_type,aweme_id,tg_app_index,butler_id,mini_program_platform_id,landing_page,valid_timer_time,valid_timer_number,channelId,no_bid_budget,max_ad_quantity,tg_link_config,tg_platform_id,app_id,main_name,running_status,ad_quantity,cpa_bid,bid_type,bid_ratio,custom_budget,daily_new_limit,valid_time,group_id)  VALUES ( '%s',%d,%d,%d,%d,'%s',%d,'%s','%s',%d,'%s','%s',%d,%d,%d,%s,%d,%d,%d,%d,'%s',%d,%d,%d,%d,'%s','%s','%s',%d,%d,'%s',%d,'%s','%s', %d, %d, %d,'%s', %d, '%s', '%s',%d, %d, '%s', %d, '%s', '%s', %d, %d, %d,%d, '%s', %d, %d, '%s', '%s')",
+    local sql = string.format("INSERT INTO `tg_main` (statistics_platform_id,hide_if_converted,converted_time_duration,cbo_script_time,cbo_script_status,cbo_status,project_type,tf_status,tf_start_time,stat_cost,oce_product_id,oce_product_platform_id,material_platform_id,strategy_config,delivery_mode,price,pack_strategy_status,start_chapter,advertiser_id,wx_miniapp_create_status,genre,ad_act,template_bid,zh_id,roi_goal,ql_bid,infra_status,pay_type,qm_id,ldy_template_site_id,yw_id,parent_platform_id,platform_shared_id,distributor_id,is_delete,ad_convert_type,aweme_id,tg_app_index,butler_id,mini_program_platform_id,landing_page,valid_timer_time,valid_timer_number,channelId,no_bid_budget,max_ad_quantity,tg_link_config,tg_platform_id,app_id,main_name,running_status,ad_quantity,cpa_bid,bid_type,bid_ratio,custom_budget,daily_new_limit,valid_time,group_id)  VALUES (%d, '%s','%s','%s',%d,%d,%d,%d,'%s',%d,'%s','%s',%d,'%s','%s',%d,%d,%d,%s,%d,%d,%d,%d,'%s',%d,%d,%d,%d,'%s','%s','%s',%d,%d,'%s',%d,'%s','%s', %d, %d, %d,'%s', %d, '%s', '%s',%d, %d, '%s', %d, '%s', '%s', %d, %d, %d,%d, '%s', %d, %d, '%s', '%s')",
+    msg_body.statistics_platform_id,
+    msg_body.hide_if_converted,
+    msg_body.converted_time_duration,
     msg_body.cbo_script_time,
     msg_body.cbo_script_status,
     msg_body.cbo_status,
@@ -394,7 +406,7 @@ local function combine_query_and_params(query, params)
     return combined_query
 end
 function M.modifyMain(msg_body)
-    local isok ,key =  tools.checkData({ "cbo_script_time","cbo_script_status","cbo_status","project_type","tf_status","tf_start_time","stat_cost","oce_product_id","oce_product_platform_id","material_platform_id","strategy_config","delivery_mode","price","pack_strategy_status","start_chapter","advertiser_id","wx_miniapp_create_status","ad_act","template_bid","zh_id","roi_goal","ql_bid","infra_status","pay_type","pay_type","qm_id","ldy_template_site_id","yw_id","parent_platform_id","platform_shared_id","distributor_id","is_delete","ad_convert_type","aweme_id","tg_app_index","butler_id","mini_program_platform_id","landing_page","valid_timer_time","valid_timer_number","channelId","no_bid_budget","max_ad_quantity","tg_link_config","id","tg_platform_id","app_id","main_name","running_status","ad_quantity","cpa_bid","bid_type","bid_ratio","custom_budget","daily_new_limit","valid_time","group_id"},msg_body)
+    local isok ,key =  tools.checkData({ "statistics_platform_id","hide_if_converted","converted_time_duration","cbo_script_time","cbo_script_status","cbo_status","project_type","tf_status","tf_start_time","stat_cost","oce_product_id","oce_product_platform_id","material_platform_id","strategy_config","delivery_mode","price","pack_strategy_status","start_chapter","advertiser_id","wx_miniapp_create_status","ad_act","template_bid","zh_id","roi_goal","ql_bid","infra_status","pay_type","pay_type","qm_id","ldy_template_site_id","yw_id","parent_platform_id","platform_shared_id","distributor_id","is_delete","ad_convert_type","aweme_id","tg_app_index","butler_id","mini_program_platform_id","landing_page","valid_timer_time","valid_timer_number","channelId","no_bid_budget","max_ad_quantity","tg_link_config","id","tg_platform_id","app_id","main_name","running_status","ad_quantity","cpa_bid","bid_type","bid_ratio","custom_budget","daily_new_limit","valid_time","group_id"},msg_body)
     if not isok then
         return false,string.format("缺少字段: %s.", key)
     end
@@ -404,6 +416,9 @@ function M.modifyMain(msg_body)
 
     local query = [[
     UPDATE `tg_main` SET
+        statistics_platform_id = ?,
+        hide_if_converted = ?,
+        converted_time_duration = ?,
         cbo_script_time = ?,
         cbo_script_status = ?,
         cbo_status = ?,
@@ -465,6 +480,9 @@ function M.modifyMain(msg_body)
 ]]
 
 local params = {
+    msg_body.statistics_platform_id,
+    msg_body.hide_if_converted,
+    msg_body.converted_time_duration,
     msg_body.cbo_script_time,
     msg_body.cbo_script_status,
     msg_body.cbo_status,

+ 2 - 0
service/backmgr/init.lua

@@ -45,6 +45,7 @@ local yw_book = require "yw_book"
 local wechat_miniapp_product = require "wechat_miniapp_product"
 local material_platform = require "material_platform"
 local xs_origin_data = require "xs_origin_data"
+local statistics_platform = require "statistics_platform"
 local status_200 = 200
 local CMD = {
     
@@ -88,6 +89,7 @@ CMD["yw_book"] = yw_book;
 CMD["wechat_miniapp_product"] = wechat_miniapp_product;
 CMD["material_platform"] = material_platform;
 CMD["xs_origin_data"] = xs_origin_data;
+CMD["statistics_platform"] = statistics_platform;
 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)

+ 45 - 0
service/backmgr/statistics_platform.lua

@@ -0,0 +1,45 @@
+--统计平台
+local M = {}
+local mysqldbx = require "mysqldbx"
+local tools = require "tools"
+local skynet = require "skynet"
+
+
+function M.add_platform(msg_body)
+    local isok ,key =  tools.checkData({"tg_platform_name","tg_platform_id"},msg_body)
+    if not isok then
+        return false,string.format("缺少字段: %s.", key)
+    end
+    local sql = string.format("INSERT INTO `statistics_platform` (tg_platform_name)  VALUES ('%s',%d)",msg_body.tg_platform_name,msg_body.tg_platform_id)
+    mysqldbx.query(sql)
+    return true, {}
+end
+
+
+function M.modify(msg_body)
+    local isok ,key =  tools.checkData({"tg_platform_name","id","tg_platform_id"},msg_body)
+    if not isok then
+        return false,string.format("缺少字段: %s.", key)
+    end
+    local sql = string.format("UPDATE  statistics_platform SET  tg_platform_name = '%s' , tg_platform_id = %d  WHERE id = %d ",msg_body.tg_platform_name, msg_body.tg_platform_id,msg_body.id)
+    mysqldbx.query(sql)
+    return true, {}
+end
+
+function M.search(msg_body)
+    local isok ,key =  tools.checkData({"page_size","page_number"},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 sql = "SELECT * FROM statistics_platform "..string.format(" LIMIT %d OFFSET %d ",page_size, offset)
+    local list = mysqldbx.query(sql)
+    sql = "SELECT   COUNT(*) AS total  FROM statistics_platform "
+    local total = mysqldbx.query(sql)
+    return true,list,total[1].total
+end
+
+return M