904118851 7 сар өмнө
parent
commit
8e1314358b

+ 6 - 4
common/dbproxy/tg_platform.lua

@@ -18,13 +18,13 @@ end
 
 --添加平台
 function M.addPlatform(msg_body)
-    local isok ,key ,id=  tools.checkData({"tg_platform_name","filter_guajian_logic"},msg_body)
+    local isok ,key ,id=  tools.checkData({"platform_shared_id","mini_program_platform_id","tg_platform_name","filter_guajian_logic"},msg_body)
     if not isok then
         return false,string.format("缺少字段: %s.", key)
     end
     local _,data = M.getTotal()
     local id = data.total + 1
-    local sql = string.format("INSERT INTO `tg_platform` (tg_platform_id,tg_platform_name,filter_guajian_logic)  VALUES (%d,'%s','%s')",id,msg_body.tg_platform_name,msg_body.filter_guajian_logic)
+    local sql = string.format("INSERT INTO `tg_platform` (platform_shared_id,mini_program_platform_id,tg_platform_id,tg_platform_name,filter_guajian_logic)  VALUES (%d,%d,%d,'%s','%s')",msg_body.platform_shared_id,msg_body.mini_program_platform_id,id,msg_body.tg_platform_name,msg_body.filter_guajian_logic)
     skynet.error(sql)
     mysqldbx.query(sql)
     skynet.send("backmgr","lua","on_recv",nil,"ws_push_msg",cjson.encode({cmd="updatePlatformConfig"}))
@@ -34,11 +34,13 @@ end
 
 --修改平台
 function M.modifyPlatform(msg_body)
-    local isok ,key =  tools.checkData({"tg_platform_name","id","filter_guajian_logic"},msg_body)
+    local isok ,key =  tools.checkData({"platform_shared_id","mini_program_platform_id","tg_platform_name","id","filter_guajian_logic"},msg_body)
     if not isok then
         return false,string.format("缺少字段: %s.", key)
     end
-    local sql = string.format("UPDATE `tg_platform` SET filter_guajian_logic = '%s' , tg_platform_name = '%s'  WHERE id = %d ",
+    local sql = string.format("UPDATE `tg_platform` SET platform_shared_id = %d , mini_program_platform_id = %d , filter_guajian_logic = '%s' , tg_platform_name = '%s'  WHERE id = %d ",
+    msg_body.platform_shared_id,
+    msg_body.mini_program_platform_id,
     msg_body.filter_guajian_logic,
     msg_body.tg_platform_name,msg_body.id)
     mysqldbx.query(sql)

+ 1 - 1
service/backmgr/filter_task.lua

@@ -172,7 +172,7 @@ function M.tui_guang_zeng_liang(msg_body)
 
     for i = 1, #res, 1 do
         local id =   res[i].id
-        local material_id = res[i].material_id
+        local material_id = id
         sql = string.format("UPDATE  video_material SET bl_status = 1 WHERE id =%d ",id)
         mysqldbx.query(sql)
 

+ 2 - 0
service/backmgr/init.lua

@@ -39,6 +39,7 @@ local fq_mf_book = require "fq_mf_book"
 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 status_200 = 200
 local CMD = {
     
@@ -76,6 +77,7 @@ CMD["fq_mf_book"] = fq_mf_book;
 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;
 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)

+ 63 - 0
service/backmgr/platform_shared.lua

@@ -0,0 +1,63 @@
+--共享平台
+local M = {}
+local mysqldbx = require "mysqldbx"
+local tools = require "tools"
+local skynet = require "skynet"
+local cjson = require "cjson"
+
+
+--获取所有平台
+function M.gePlatformSharedList()
+    local sql = string.format("select * from `platform_shared` ")
+    local isok,res;
+    res = mysqldbx.query(sql)
+    if #res <= 0 then
+        return true , {}
+    end
+    return true, res
+end
+
+function M.addPlatformShared(msg_body)
+    local isok ,key =  tools.checkData({"name","info"},msg_body)
+    if not isok then
+        return false,string.format("缺少字段: %s.", key)
+    end
+    local sql = string.format("INSERT INTO `platform_shared` (name,info)  VALUES ('%s','%s')",msg_body.name,cjson.encode(msg_body.info))
+    mysqldbx.query(sql)
+    skynet.send("backmgr","lua","on_recv",nil,"ws_push_msg",cjson.encode({cmd="updatePlatformConfig"}))
+    return true, {}
+end
+
+function M.modifyPlatformShared(msg_body)
+    local isok ,key =  tools.checkData({"name","info","id"},msg_body)
+    if not isok then
+        return false,string.format("缺少字段: %s.", key)
+    end
+    local sql = string.format("UPDATE `platform_shared` SET name = '%s' , info = '%s'  WHERE id = %d ",
+    msg_body.name,
+    cjson.encode(msg_body.info),
+    msg_body.id)
+    mysqldbx.query(sql)
+    skynet.send("backmgr","lua","on_recv",nil,"ws_push_msg",cjson.encode({cmd="updatePlatformConfig"}))
+    return true, {}
+end
+
+function M.search_platform_shared(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 param = ""
+    local sql = "SELECT * FROM platform_shared where 1=1 "..param..string.format(" LIMIT %d OFFSET %d ",page_size, offset)
+    local list = mysqldbx.query(sql)
+    sql = "SELECT   COUNT(*) AS total  FROM platform_shared  where 1=1 "..param
+    local total = mysqldbx.query(sql)
+    return true,list,total[1].total
+end
+
+return M

+ 9 - 0
service/doc/cmd_sql.sql

@@ -204,3 +204,12 @@ create table ad_convert_type (
 	ad_convert_type  int,	
 	create_time TIMESTAMP DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
 primary key (id));
+
+
+create table platform_shared (  
+	id int not null auto_increment COMMENT '唯一id',
+	name  varchar(64),	
+	info JSON  COMMENT  '共享体',
+	create_time TIMESTAMP DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
+primary key (id));
+