904118851 8 місяців тому
батько
коміт
7c0bf55f33

+ 6 - 6
common/dbproxy/tg_main.lua

@@ -42,14 +42,14 @@ end
 -- `daily_new_limit` int DEFAULT '0' COMMENT '今天新上数量上限',
 
 function M.addMain(msg_body)
-    local isok ,key =  tools.checkData({"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({"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` (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,'%s',%d,%d,'%s',%d,'%s','%s',%d,%d,%d,%d,'%s',%d,%d,%d,'%s')",
-    msg_body.landing_page, msg_body.valid_timer_time, msg_body.valid_timer_number,msg_body.channelId, msg_body.no_bid_budget,msg_body.max_ad_quantity,cjson.encode(msg_body.tg_link_config),msg_body.tg_platform_id,msg_body.app_id,msg_body.main_name
+    local sql = string.format("INSERT INTO `tg_main` (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,%d,'%s',%d,%d,'%s',%d,%d,'%s',%d,'%s','%s',%d,%d,%d,%d,'%s',%d,%d,%d,'%s')",
+    msg_body.butler_id, msg_body.mini_program_platform_id,msg_body.landing_page, msg_body.valid_timer_time, msg_body.valid_timer_number,msg_body.channelId, msg_body.no_bid_budget,msg_body.max_ad_quantity,cjson.encode(msg_body.tg_link_config),msg_body.tg_platform_id,msg_body.app_id,msg_body.main_name
     ,msg_body.running_status,msg_body.ad_quantity,msg_body.cpa_bid,msg_body.bid_type,msg_body.bid_ratio,msg_body.custom_budget,msg_body.daily_new_limit,msg_body.valid_time,msg_body.group_id)
     mysqldbx.query(sql)
     skynet.send("backmgr","lua","on_recv",nil,"ws_push_msg",cjson.encode({cmd="updateMainConfig"}))
@@ -158,14 +158,14 @@ function pushAddMainMsg(msg_body)
    
 end
 function M.modifyMain(msg_body)
-    local isok ,key =  tools.checkData({"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({"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
     local current_time = os.date("%Y-%m-%d %H:%M:%S")
     msg_body.update_time = current_time
-    local sql = string.format("UPDATE  `tg_main` SET landing_page = '%s' , valid_timer_time = %d , valid_timer_number = %d ,channelId = '%s' , no_bid_budget = %d , max_ad_quantity = %d ,tg_platform_id = %d , app_id = '%s' ,main_name = '%s' , update_time = '%s' , running_status = %d ,ad_quantity = %d ,cpa_bid = %d ,bid_type = %d ,bid_ratio = '%s' ,custom_budget = %d ,daily_new_limit = %d ,valid_time = %d ,tg_link_config = '%s' ,group_id = '%s' WHERE id = %d ",
-    msg_body.landing_page,msg_body.valid_timer_time,msg_body.valid_timer_number,msg_body.channelId,msg_body.no_bid_budget,msg_body.max_ad_quantity,msg_body.tg_platform_id,msg_body.app_id,msg_body.main_name,msg_body.update_time,msg_body.running_status,msg_body.ad_quantity,msg_body.cpa_bid,msg_body.bid_type,msg_body.bid_ratio,msg_body.custom_budget,
+    local sql = string.format("UPDATE  `tg_main` SET butler_id = %d , mini_program_platform_id = %d , landing_page = '%s' , valid_timer_time = %d , valid_timer_number = %d ,channelId = '%s' , no_bid_budget = %d , max_ad_quantity = %d ,tg_platform_id = %d , app_id = '%s' ,main_name = '%s' , update_time = '%s' , running_status = %d ,ad_quantity = %d ,cpa_bid = %d ,bid_type = %d ,bid_ratio = '%s' ,custom_budget = %d ,daily_new_limit = %d ,valid_time = %d ,tg_link_config = '%s' ,group_id = '%s' WHERE id = %d ",
+    msg_body.butler_id,msg_body.mini_program_platform_id,msg_body.landing_page,msg_body.valid_timer_time,msg_body.valid_timer_number,msg_body.channelId,msg_body.no_bid_budget,msg_body.max_ad_quantity,msg_body.tg_platform_id,msg_body.app_id,msg_body.main_name,msg_body.update_time,msg_body.running_status,msg_body.ad_quantity,msg_body.cpa_bid,msg_body.bid_type,msg_body.bid_ratio,msg_body.custom_budget,
     msg_body.daily_new_limit,msg_body.valid_time,cjson.encode(msg_body.tg_link_config),msg_body.group_id,msg_body.id)
     mysqldbx.query(sql)
     skynet.send("backmgr","lua","on_recv",nil,"ws_push_msg",cjson.encode({cmd="updateMainConfig"}))

+ 4 - 1
service/backmgr/init.lua

@@ -27,6 +27,8 @@ 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 tg_butler = require "tg_butler"
+local tg_mini_program_platform = require "tg_mini_program_platform"
 local status_200 = 200
 local CMD = {
     
@@ -52,7 +54,8 @@ 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;
-
+CMD["tg_butler"] = tg_butler;
+CMD["tg_mini_program_platform"] = tg_mini_program_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)

+ 1 - 1
service/backmgr/origin_video_titles.lua

@@ -20,7 +20,7 @@ function M.delete_origin_video_titles(msg_body)
 end
 
 function M.publish_origin_video_titles(msg_body)
-    local isok ,key =  tools.checkData({"id_list"},msg_body)
+    local isok ,key =  tools.checkData({"title_list"},msg_body)
     if not isok then
         return false,string.format("缺少字段: %s.", key)
     end

+ 53 - 0
service/backmgr/tg_butler.lua

@@ -0,0 +1,53 @@
+--管家
+local M = {}
+local mysqldbx = require "mysqldbx"
+local tools = require "tools"
+local skynet = require "skynet"
+local cjson = require "cjson"
+
+function M.add_butler(msg_body)
+    local isok ,key =  tools.checkData({"butler_name","butler_id","mail"},msg_body)
+    if not isok then
+        return false,string.format("缺少字段: %s.", key)
+    end
+    local sql = string.format("INSERT INTO `tg_butler` (butler_name,butler_id,mail)  VALUES ('%s',%d,'%s')",
+    msg_body.butler_name, msg_body.butler_id, msg_body.mail)
+    mysqldbx.query(sql)
+    return true
+end
+
+function M.modify_butler(msg_body)
+    local isok ,key =  tools.checkData({"butler_name","butler_id","mail","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.update_time = current_time
+    local sql = string.format("UPDATE  `tg_butler` SET butler_name = '%s' , butler_id = %d ,mail = '%s'  WHERE id = %d ",
+    msg_body.butler_name,msg_body.butler_id,msg_body.mail,msg_body.id)
+    mysqldbx.query(sql)
+    return true
+end
+
+function M.search_butler(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 tg_butler WHERE 1=1 "..string.format(" LIMIT %d OFFSET %d ",page_size, offset)
+   
+    local list = mysqldbx.query(sql)
+
+    sql = "SELECT   COUNT(*) AS total  FROM tg_butler WHERE 1=1  "
+
+    local total = mysqldbx.query(sql)
+
+    return true,list,total[1].total
+end
+
+return M

+ 53 - 0
service/backmgr/tg_mini_program_platform.lua

@@ -0,0 +1,53 @@
+--小程序平台
+local M = {}
+local mysqldbx = require "mysqldbx"
+local tools = require "tools"
+local skynet = require "skynet"
+local cjson = require "cjson"
+
+function M.add_tg_mini_program_platform(msg_body)
+    local isok ,key =  tools.checkData({"mini_program_platform_name","mini_program_platform_id"},msg_body)
+    if not isok then
+        return false,string.format("缺少字段: %s.", key)
+    end
+    local sql = string.format("INSERT INTO `tg_mini_program_platform` (mini_program_platform_name,mini_program_platform_id)  VALUES ('%s',%d)",
+    msg_body.mini_program_platform_name, msg_body.mini_program_platform_id)
+    mysqldbx.query(sql)
+    return true
+end
+
+function M.modify_tg_mini_program_platform(msg_body)
+    local isok ,key =  tools.checkData({"mini_program_platform_name","mini_program_platform_id","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.update_time = current_time
+    local sql = string.format("UPDATE  `tg_mini_program_platform` SET mini_program_platform_name = '%s' , mini_program_platform_id = %d  WHERE id = %d ",
+    msg_body.mini_program_platform_name,msg_body.mini_program_platform_id,msg_body.id)
+    mysqldbx.query(sql)
+    return true
+end
+
+function M.search_tg_mini_program_platform(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 tg_mini_program_platform WHERE 1=1 "..string.format(" LIMIT %d OFFSET %d ",page_size, offset)
+   
+    local list = mysqldbx.query(sql)
+
+    sql = "SELECT   COUNT(*) AS total  FROM tg_mini_program_platform WHERE 1=1  "
+
+    local total = mysqldbx.query(sql)
+
+    return true,list,total[1].total
+end
+
+return M

+ 14 - 0
service/doc/cmd_sql.sql

@@ -181,4 +181,18 @@ create table other_book (
 	create_time TIMESTAMP DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
 primary key (id));
 
+create table tg_butler (  
+	id int not null auto_increment COMMENT '唯一id',
+	butler_name  varchar(64),	
+	butler_id  int,	
+	mail varchar(500),	
+	create_time TIMESTAMP DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
+primary key (id));
+
 
+create table tg_mini_program_platform (  
+	id int not null auto_increment COMMENT '唯一id',
+	mini_program_platform_name  varchar(64),	
+	mini_program_platform_id  int,	
+	create_time TIMESTAMP DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
+primary key (id));