904118851 hace 7 meses
padre
commit
eed5a48091

+ 6 - 5
common/dbproxy/tg_app.lua

@@ -21,13 +21,14 @@ end
 --小程序名称 name
 --添加小程序
 function M.addApp(msg_body)
-    local isok ,key =  tools.checkData({"butler_id","tg_platform_id","app_id","instance_id","name","advertiser_id","landing_page","titles"},msg_body)
+    local isok ,key =  tools.checkData({"wx_origin_id","butler_id","tg_platform_id","app_id","instance_id","name","advertiser_id","landing_page","titles"},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_app` (butler_id,tg_platform_id,app_id, instance_id, name,advertiser_id,landing_page,titles)  VALUES (%d,%d,'%s','%s','%s','%s','%s','%s')",
+    local sql = string.format("INSERT INTO `tg_app` (wx_origin_id,butler_id,tg_platform_id,app_id, instance_id, name,advertiser_id,landing_page,titles)  VALUES ('%s',%d,%d,'%s','%s','%s','%s','%s','%s')",
+    msg_body.wx_origin_id,
     msg_body.butler_id,
     msg_body.tg_platform_id,
     msg_body.app_id,
@@ -40,14 +41,14 @@ end
 
 --修改小程序
 function M.modifyApp(msg_body)
-    local isok ,key =  tools.checkData({"butler_id","id","tg_platform_id","app_id","instance_id","name","advertiser_id","landing_page","titles"},msg_body)
+    local isok ,key =  tools.checkData({"wx_origin_id","butler_id","id","tg_platform_id","app_id","instance_id","name","advertiser_id","landing_page","titles"},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_app` SET butler_id = %d , tg_platform_id =%d ,app_id ='%s' , instance_id ='%s' , name ='%s' , advertiser_id ='%s'  , update_time ='%s'   , landing_page ='%s'  , titles ='%s' WHERE id = %d ",
-    msg_body.butler_id,msg_body.tg_platform_id,msg_body.app_id,msg_body.instance_id,msg_body.name,msg_body.advertiser_id,msg_body.update_time,msg_body.landing_page,msg_body.titles,msg_body.id)
+    local sql = string.format("UPDATE `tg_app` SET wx_origin_id = '%s' , butler_id = %d , tg_platform_id =%d ,app_id ='%s' , instance_id ='%s' , name ='%s' , advertiser_id ='%s'  , update_time ='%s'   , landing_page ='%s'  , titles ='%s' WHERE id = %d ",
+    msg_body.wx_origin_id,msg_body.butler_id,msg_body.tg_platform_id,msg_body.app_id,msg_body.instance_id,msg_body.name,msg_body.advertiser_id,msg_body.update_time,msg_body.landing_page,msg_body.titles,msg_body.id)
     mysqldbx.query(sql)
     skynet.send("backmgr","lua","on_recv",nil,"ws_push_msg",cjson.encode({cmd="updateAppConfig"}))
     return true

+ 2 - 2
common/dbproxy/tg_platform.lua

@@ -18,13 +18,13 @@ end
 
 --添加平台
 function M.addPlatform(msg_body)
-    local isok ,key ,id=  tools.checkData({"tg_platform_name"},msg_body)
+    local isok ,key ,id=  tools.checkData({"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)  VALUES (%d,'%s')",id,msg_body.tg_platform_name)
+    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)
     skynet.error(sql)
     mysqldbx.query(sql)
     skynet.send("backmgr","lua","on_recv",nil,"ws_push_msg",cjson.encode({cmd="updatePlatformConfig"}))

+ 9 - 4
service/backmgr/other_book.lua

@@ -20,7 +20,7 @@ end
 
 
 function M.search_other_book(msg_body)
-    local isok ,key =  tools.checkData({"page_size","page_number","tg_platform_id"},msg_body)
+    local isok ,key =  tools.checkData({"page_size","page_number","tg_platform_id","product_id"},msg_body)
     if not isok then
         return false,string.format("缺少字段: %s.", key)
     end
@@ -28,15 +28,20 @@ function M.search_other_book(msg_body)
     local page_number = msg_body.page_number
     local offset = (page_number - 1) * page_size
     
+    local product_id_param = ""
+    if msg_body.product_id~="" then
+        product_id_param = string.format(" AND product_id = '%s' " ,msg_body.product_id )
+    end
+    
     local tg_platform_id_param = ""
     if msg_body.tg_platform_id~="" then
         tg_platform_id_param =  " AND tg_platform_id = "..msg_body.tg_platform_id.." "
     end
 
-    local sql = "SELECT * FROM other_book where 1=1 "..tg_platform_id_param..string.format(" LIMIT %d OFFSET %d ",page_size, offset)
+    local param = product_id_param..tg_platform_id_param
+    local sql = "SELECT * FROM other_book where 1=1 "..param..string.format(" LIMIT %d OFFSET %d ",page_size, offset)
     local list = mysqldbx.query(sql)
-    skynet.error("sql:",sql)
-    sql = "SELECT   COUNT(*) AS total  FROM other_book  where 1=1 "..tg_platform_id_param
+    sql = "SELECT   COUNT(*) AS total  FROM other_book  where 1=1 "..param
     local total = mysqldbx.query(sql)
     return true,list,total[1].total
 end

+ 4 - 3
service/backmgr/tg_butler.lua

@@ -17,12 +17,13 @@ local cjson = require "cjson"
 -- end
 
 function M.modify_butler(msg_body)
-    local isok ,key =  tools.checkData({"cc_account_id","mail","id","tg_platform_ids"},msg_body)
+    local isok ,key =  tools.checkData({"butler_name","cc_account_id","mail","id","tg_platform_ids"},msg_body)
     if not isok then
         return false,string.format("缺少字段: %s.", key)
     end
-    local sql = string.format("UPDATE  `advertiser_butler` SET cc_account_id = %d ,email = '%s' , tg_platform_ids = '%s'  WHERE id = %d ",
-    msg_body.cc_account_id,msg_body.mail,msg_body.tg_platform_ids,msg_body.id)
+    local sql = string.format("UPDATE  `advertiser_butler` SET name = '%s', cc_account_id = %d ,email = '%s' , tg_platform_ids = '%s'  WHERE id = %d ",
+    msg_body.butler_name,msg_body.cc_account_id,msg_body.mail,msg_body.tg_platform_ids,msg_body.id)
+    skynet.error("sql:",sql)
     mysqldbx.query(sql)
     return true
 end