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

+ 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({"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({"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` (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,%d,'%s',%d,%d,'%s',%d,%d,'%s',%d,'%s','%s',%d,%d,%d,%d,'%s',%d,%d,%d,'%s')",
-    msg_body.tg_app_index,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
+    local sql = string.format("INSERT INTO `tg_main` (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,'%s',%d,%d,'%s',%d,%d,'%s',%d,'%s','%s',%d,%d,%d,%d,'%s',%d,%d,%d,'%s')",
+    msg_body.aweme_id,msg_body.tg_app_index,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({"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({"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
     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 tg_app_index = %d , 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.tg_app_index,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,
+    local sql = string.format("UPDATE  `tg_main` SET aweme_id = '%s' ,tg_app_index = %d , 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.aweme_id,msg_body.tg_app_index,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"}))

+ 58 - 0
service/backmgr/aweme_auth_list.lua

@@ -0,0 +1,58 @@
+--抖音授权
+local M = {}
+local mysqldbx = require "mysqldbx"
+local tools = require "tools"
+local skynet = require "skynet"
+local md5 =	require	"md5"
+
+
+function M.add_aweme_auth_list(msg_body)
+    local isok ,key =  tools.checkData({"aweme_id","aweme_name"},msg_body)
+    if not isok then
+        return false,string.format("缺少字段: %s.", key)
+    end
+
+    local sql  = string.format("INSERT INTO `aweme_auth_list` (aweme_id,aweme_name)  VALUES ('%s','%s')",
+    msg_body.aweme_id,msg_body.aweme_name)
+    mysqldbx.query(sql)
+    return true, {}
+end
+
+function M.modify_aweme_auth_list(msg_body)
+    local isok ,key =  tools.checkData({"aweme_id","aweme_name"},msg_body)
+    if not isok then
+        return false,string.format("缺少字段: %s.", key)
+    end
+    local sql = string.format("UPDATE  `aweme_auth_list` SET aweme_id = '%s' ,aweme_name = '%s'  WHERE id = %d ",
+    msg_body.aweme_id,msg_body.aweme_name,msg_body.id)
+    mysqldbx.query(sql)
+    return true, {}
+end
+
+function M.search_aweme_auth_list(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 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 aweme_auth_list WHERE 1=1 "..string.format(" LIMIT %d OFFSET %d ",page_size, offset)
+    local list = mysqldbx.query(sql)
+    sql = "SELECT   COUNT(*) AS total  FROM aweme_auth_list  WHERE 1=1 "
+    local total = mysqldbx.query(sql)
+    return true,list,total[1].total
+end
+
+return M

+ 2 - 0
service/backmgr/init.lua

@@ -33,6 +33,7 @@ local task_material_queue_queue = require "task_material_queue_queue"
 local video_product = require "video_product"
 local origin_data = require "origin_data"
 local video_product_material = require "video_product_material"
+local aweme_auth_list = require "aweme_auth_list"
 local status_200 = 200
 local CMD = {
     
@@ -64,6 +65,7 @@ CMD["task_material_queue_queue"] = task_material_queue_queue;
 CMD["video_product"] = video_product;
 CMD["origin_data"] = origin_data;
 CMD["video_product_material"] = video_product_material;
+CMD["aweme_auth_list"] = aweme_auth_list;
 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)