Commit 9e896ed0 by 熊付

Merge branch 'develop' of http://192.168.9.26/platform/tx1_box_serv into develop

# Conflicts:
#	code/tx1_box_serv/apps/api/ws_serv.py
2 parents 53936aa9 4865325a
......@@ -5,12 +5,12 @@ from werkzeug import secure_filename
import json,re,time,io
import sys
import os
from apps.commons.util import *
import apps.gbvar.ws_serv_global as sv_global
import apps.gbvar.database_global as database
import apps.gbvar.dict_properties as dict_p
import apps.commons.editXml as editXml
import apps.commons.event_to_local as etl
from commons.util import *
import gbvar.ws_serv_global as sv_global
import gbvar.database_global as database
import gbvar.dict_properties as dict_p
import commons.editXml as editXml
import commons.event_to_local as etl
tx1_box = Blueprint('tx1_box', __name__)
......@@ -25,11 +25,14 @@ def dataRecv():
print(res)
send_all_data(sv_global.get_value(),data)
#存入本地数据库
push_dbs(data)
#push_dbs(data)
else:
print('error: data to dict failed, data:{}'.format(data))
responseDict = {'enode':"OK", 'ecode':200};
response = json.dumps(responseDict)
return ''
return data
@tx1_box.route('/test', methods=["GET"])
def test():
print 'test'
......@@ -37,6 +40,10 @@ def test():
return "111"
# 给所有用户发送信息
def send_all_data(sv, data):
if sv is None:
print('not ready')
pass
else:
if sv.users is not None and len ( sv.users ) > 0:
for addr in sv.users:
print ('addr=%s' % addr)
......
......@@ -2,7 +2,7 @@
# coding=utf-8
from flask import Blueprint, request
import time,json
import apps.gbvar.dict_properties as dict_p
import gbvar.dict_properties as dict_p
login = Blueprint('login', __name__)
register = Blueprint('register', __name__)
......
......@@ -4,10 +4,10 @@ from flask import Blueprint, request
import flask
import json,re,time,io
import os
from apps.commons.util import *
import apps.gbvar.ws_serv_global as sv_global
import apps.gbvar.dict_properties as dict_p
import apps.commons.editXml as editXml
from commons.util import *
import gbvar.ws_serv_global as sv_global
import gbvar.dict_properties as dict_p
import commons.editXml as editXml
import requests
import re
......
No preview for this file type
......@@ -13,7 +13,7 @@ import os
import json
import uuid
import base64
import apps.gbvar.dict_properties as dict_p
import gbvar.dict_properties as dict_p
class EventToLocalUtil(object):
......@@ -63,6 +63,7 @@ class EventToLocalUtil(object):
if(len(picPath) >0):
if 'pic_base64' in pic:
try:
picPath= picPath.decode('utf8').encode('gb2312')
with open(picPath, 'wb') as f:
f.write(base64.b64decode(pic['pic_base64']))
outPicsPath.append(picPath)
......@@ -87,6 +88,7 @@ class EventToLocalUtil(object):
infoPath = basePath + '/' + infoPath + '.json'
try:
infoPath = infoPath.decode('utf8').encode('gb2312')
with open(infoPath, 'w') as f:
json.dump(dataDict, f)
outInfoPath.append(infoPath)
......@@ -141,13 +143,16 @@ class EventToLocalUtil(object):
eventCate = dataDict['event_cate']
if eventType == 'vehicle' :
# 卡口
if 'illegal' not in dataDict:
if 'illegal' not in dataDict['event_data'] or dataDict['event_data']['illegal']['state'] == 0:
genPath = '%s/kakou/%s/%04d%02d%02d/%02d/%02d'%(self.rootPath,vid,et.year, \
et.month,et.day,et.hour, et.minute)
else:
#违法
illegalType = 'unknow'
if 'code' in dataDict['event_data']['illegal']:
illegalType = 'code' + str(dataDict['event_data']['illegal']['code'])
genPath = '%s/weifa/%s/%04d%02d%02d/%s/%02d'%(self.rootPath,vid,et.year, \
et.month,et.day,dataDict['event_type'], et.hour)
et.month,et.day,illegalType, et.hour)
# 交通参数
elif eventType == 'tflow' \
or eventType == 'pflow' or eventType == 'pdensity':
......
# coding: utf-8
def _init():#初始化
global dbs
global database
database = None
def set_value(value):
""" 定义一个全局变量 """
global dbs
dbs = value
global database
database = value
def get_value():
global dbs
return dbs
global database
return database
......@@ -3,19 +3,21 @@
from flask import Flask,Blueprint
import flask
import threading
from apps.api.http_serv import tx1_box
from apps.api.task import task
from apps.api.ws_serv import Server
import apps.gbvar.ws_serv_global as sv_global
import apps.gbvar.database_global as database
import apps.gbvar.dict_properties as dict_p
from apps.api.code_serv import code_sev
from api.http_serv import tx1_box
from api.task import task
from api.ws_serv import Server
from api.login import login
from api.login import register
import gbvar.ws_serv_global as sv_global
import gbvar.database_global as database
import gbvar.dict_properties as dict_p
from api.code_serv import code_sev
import fdb
import sys
import os
from commons.util import *
import apps.commons.event_to_local as etl
app = Flask(__name__, static_folder='dist')
import commons.event_to_local as etl
app = Flask(__name__, static_folder='static')
# 获取本脚本所在的路径
pro_path = os.path.split(os.path.realpath(__file__))[0]
#配置文件路径
......@@ -38,7 +40,7 @@ app.register_blueprint(register, url_prefix='/api/v1')
@app.route('/', methods=["GET"])
def index():
return flask.send_file ( "dist/index.html" )
return flask.send_file ( "index.html" )
def start_ws(host,port):
try:
......
......@@ -7,16 +7,17 @@ tx1_ws_port=20080
datasource_url=F:/ssss/TT.FDB
#初始化任务列表(说明:路径@任务名称
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_1=/root/UserApp/vioncfg/Device/TASK1/tasks.xml@/root/UserApp/vioncfg/Device/TASK1/TASK1/@/root/UserApp/vioncfg/Device/TASK1/TASK1/TASK1/@/root/UserApp/services/analysis_service/VAServer/TrafficConfig.xml
#task_1=/root/UserApp/vioncfg/Device/d8802881b1fa40a0bca979214acb78d7/tasks.xml@/root/UserApp/vioncfg/Device/d8802881b1fa40a0bca979214acb78d7/d1f69df819a0472bbbe2e5a34806d1a0/@/root/UserApp/vioncfg/Device/d8802881b1fa40a0bca979214acb78d7/d1f69df819a0472bbbe2e5a34806d1a0/ea3ade4d66d04cfa94c289285b05df96/@/root/UserApp/services/analysis_service/VAServer/TrafficConfig.xml
task_2=/root/UserApp/vioncfg/Device/TASK2/tasks.xml@/root/UserApp/vioncfg/Device/TASK2/TASK2/@/root/UserApp/vioncfg/Device/TASK2/TASK2/TASK2/@/root/UserApp/services/analysis_service/VAServer/TrafficConfig.xml
task_3=
task_4=/root/UserApp/vioncfg/Ops/ServerConfig.xml@运维服务@./start.sh
task_4=
#截图接口地址
cut_pic_url=http://192.168.88.109:10088/apiv1/capture
cut_pic_url=http://127.0.0.1:10088/apiv1/capture
#重启任务指令
start_task=./task_start.sh
save_root_path=./datasave
\ No newline at end of file
save_root_path=/root/Log/saveresult
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!