Commit 5faea552 authored by liyuanhong's avatar liyuanhong

多人在线面板,日志打印,增加了ip和连接时间

parent fc54f847
{"time": {"dateTime": "2020-05-13 10:53:36", "date": "2020-05-13", "time": "10:53:36"}, "curDayTravel": {"todayTotalMilleage": 24791, "todayTotalOil": 2386, "todayTotalTime": 1479, "theMilleage": 1698, "theOil": 158, "theTime": 88}, "travelData": {"totalMilleage": 249738, "totalOil": 23752, "totalTime": 14743}, "event": {"threeRapid": {"totalRapidlyAccelerate": 22, "totalSharpSlowdown": 19, "totalSharpTurn": 24}}} {"time": {"dateTime": "2020-05-14 01:29:40", "date": "2020-05-14", "time": "01:29:40"}, "curDayTravel": {"todayTotalMilleage": 9487, "todayTotalOil": 757, "todayTotalTime": 582, "theMilleage": 528, "theOil": 48, "theTime": 32}, "travelData": {"totalMilleage": 262817, "totalOil": 24827, "totalTime": 15522}, "event": {"threeRapid": {"totalRapidlyAccelerate": 14, "totalSharpSlowdown": 13, "totalSharpTurn": 13}}}
\ No newline at end of file \ No newline at end of file
#coding:utf-8 #coding:utf-8
import os import os
import time
from time import sleep from time import sleep
from flask import Blueprint ,Response,request,send_from_directory from flask import Blueprint ,Response,request,send_from_directory
...@@ -85,6 +86,11 @@ def porcessConnect(): ...@@ -85,6 +86,11 @@ def porcessConnect():
service.setGpsLine(params["gpsLine"]) service.setGpsLine(params["gpsLine"])
connect["service"] = connect connect["service"] = connect
connects[sessionId]["service"] = service connects[sessionId]["service"] = service
timeArray = time.localtime(int(time.time()))
curTime = time.strftime("%Y-%m-%d %H:%M:%S", timeArray)
connects[sessionId]["time"] = curTime
ip = request.remote_addr
connects[sessionId]["ip"] = ip
data["status"] = "200" data["status"] = "200"
data["message"] = "创建连接成功!" data["message"] = "创建连接成功!"
else: else:
......
#coding:utf-8 #coding:utf-8
import os import os
import time
from time import sleep from time import sleep
from flask import Blueprint ,Response,request,send_from_directory from flask import Blueprint ,Response,request,send_from_directory
...@@ -89,6 +90,11 @@ def createConect(): ...@@ -89,6 +90,11 @@ def createConect():
service.addNewWebsocket() #创建一个新的websocket连接 service.addNewWebsocket() #创建一个新的websocket连接
connect["service"] = connect connect["service"] = connect
connects[sessionId]["service"] = service connects[sessionId]["service"] = service
timeArray = time.localtime(int(time.time()))
curTime = time.strftime("%Y-%m-%d %H:%M:%S", timeArray)
connects[sessionId]["time"] = curTime
ip = request.remote_addr
connects[sessionId]["ip"] = ip
data["status"] = "200" data["status"] = "200"
data["message"] = "创建连接成功!" data["message"] = "创建连接成功!"
else: else:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment