Commit 89b4380e by 潘建波

提交code服务

1 parent cc1c2b35
# coding: utf-8 # coding: utf-8
def _init():#初始化 def _init():#初始化
global database global dbs
database = None database = None
def set_value(value): def set_value(value):
""" 定义一个全局变量 """ """ 定义一个全局变量 """
global database global dbs
database = value dbs = value
def get_value(): def get_value():
global database
return database
\ No newline at end of file \ No newline at end of file
global dbs
return dbs
...@@ -3,12 +3,13 @@ ...@@ -3,12 +3,13 @@
from flask import Flask,Blueprint from flask import Flask,Blueprint
import flask import flask
import threading import threading
from api.http_serv import tx1_box from apps.api.http_serv import tx1_box
from api.task import task from apps.api.task import task
from api.ws_serv import Server from apps.api.ws_serv import Server
import gbvar.ws_serv_global as sv_global import apps.gbvar.ws_serv_global as sv_global
import gbvar.database_global as database import apps.gbvar.database_global as database
import gbvar.dict_properties as dict_p import apps.gbvar.dict_properties as dict_p
from apps.api.code_serv import code_sev
import fdb import fdb
import sys import sys
import os import os
...@@ -25,6 +26,8 @@ dictProperties=Properties(con_path).getProperties() ...@@ -25,6 +26,8 @@ dictProperties=Properties(con_path).getProperties()
app.register_blueprint(tx1_box, url_prefix='/api/v1/tx1_box') app.register_blueprint(tx1_box, url_prefix='/api/v1/tx1_box')
#注册task路由 #注册task路由
app.register_blueprint(task, url_prefix='/api/v1/tx1_box/task') app.register_blueprint(task, url_prefix='/api/v1/tx1_box/task')
#注册code路由
app.register_blueprint(code_sev, url_prefix='/api/v1/codes')
@app.route('/', methods=["GET"]) @app.route('/', methods=["GET"])
def index(): def index():
...@@ -47,17 +50,16 @@ def init(): ...@@ -47,17 +50,16 @@ def init():
database._init() database._init()
dict_p._init() dict_p._init()
dict_p.set_value(dictProperties) dict_p.set_value(dictProperties)
###===================database============================= con = fdb.connect ( host=dictProperties['tx1_host'], database=dictProperties['datasource_url'], user='sysdba',password='masterkey',charset='UTF8' )
con = fdb.connect ( host=dictProperties['tx1_host'], database=dictProperties['datasource_url'], user='sysdba',
password='masterkey',
charset='UTF8' )
cur = con.cursor () cur = con.cursor ()
database.set_value(cur) print (con)
database.set_value(con)
print database.get_value()
'''newLanguages = [ '''newLanguages = [
(1, 'Dylan') (1, 'Dylan')
] ]
cur.executemany ( "insert into tb_traffic(id,name) VALUES(?,?)", cur.executeman hjj ( "insert into tb_traffic(id,name) VALUES(?,?)",
newLanguages newLanguages
) )
con.commit () con.commit ()
...@@ -75,7 +77,7 @@ def init(): ...@@ -75,7 +77,7 @@ def init():
if __name__=='__main__': if __name__=='__main__':
dict_p._init () dict_p._init ()
dict_p.set_value ( dictProperties ) dict_p.set_value ( dictProperties )
#init() init()
_h=dictProperties['tx1_host'] _h=dictProperties['tx1_host']
_p=int(dictProperties['tx1_ws_port']) _p=int(dictProperties['tx1_ws_port'])
start_ws(_h,_p) start_ws(_h,_p)
......
#系统参数 #系统参数
tx1_host=192.168.9.61 tx1_host=192.168.9.32
tx1_http_port=20090 tx1_http_port=20090
tx1_ws_port=20080 tx1_ws_port=20080
#firebird数据库 #firebird数据库
datasource_url=F:/firebird/database/EVENT.FDB datasource_url=F:/ssss/TT.FDB
#初始化任务列表(说明:路径@任务名称 #初始化任务列表(说明:路径@任务名称
task_1=F:\TASK1\tasks.xml@F:\TASK1\TASK1\@F:\TASK1\TASK1\TASK1\@F:\TrafficConfig.xml task_1=F:\司项目目录\mini_fanxin\config\TASK1\tasks.xml@F:\公司项目目录\mini_fanxin\config\TASK1\TASK1\@F:\公司项目目录\mini_fanxin\config\TASK1\TASK1\TASK1\@F:\公司项目目录\mini_fanxin\config\TrafficConfig.xml
task_2= task_2=
task_3= task_3=
task_4=/root/UserApp/vioncfg/Ops/ServerConfig.xml@运维服务@./start.sh task_4=/root/UserApp/vioncfg/Ops/ServerConfig.xml@运维服务@./start.sh
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!