Commit 39e1d431 authored by liyuanhong's avatar liyuanhong

修改了结果文件的写入

parent 6cc572f0
Pipeline #136 canceled with stages
{"time": {"dateTime": "2020-04-22 15:12:03", "date": "2020-04-22", "time": "15:12:03"}, "curDayTravel": {"todayTotalMilleage": 1166, "todayTotalOil": 106, "todayTotalTime": 53, "theMilleage": 5962, "theOil": 542, "theTime": 271}, "travelData": {"totalMilleage": 5962, "totalOil": 542, "totalTime": 271}}
\ No newline at end of file
{"time": {"dateTime": "2020-04-22 15:12:03", "date": "2020-04-22", "time": "15:12:03"}, "curDayTravel": {"todayTotalMilleage": 2552, "todayTotalOil": 232, "todayTotalTime": 116, "theMilleage": 7348, "theOil": 668, "theTime": 334}, "travelData": {"totalMilleage": 7348, "totalOil": 668, "totalTime": 334}}
\ No newline at end of file
......@@ -430,9 +430,13 @@ class AutoCarTimerService():
# 启动模拟程序服务
########################################################
def startService(self,year=0,month=0,day=0,hour=0,minute=0,second=2):
timeS = int(time.time())
timeArray = time.localtime(timeS)
datetime = time.strftime("%Y-%m-%d %H:%M:%S", timeArray)
info = "[" + datetime + "]" + " 启动了模拟程序"
self.writeToFile("result.txt", info, 0)
while True:
if self.isTimerStart(year=0,month=0,day=0,hour=0,minute=0,second=2):
self.writeToFile("result.txt","",0)
self.connectService()
# self.startRevService() #启动接收消息服务
self.sendLoginMsg()
......@@ -449,11 +453,11 @@ class AutoCarTimerService():
if __name__ == "__main__":
temp = True
while True:
temp = AutoCarTimerService().isTimerStart(year=0,month=0,day=0,hour=0,minute=0,second="2")
temp = AutoCarTimerService().isTimerStart(year=0,month=0,day=0,hour=0,minute=50,second=0)
if temp:
timeS = int(time.time())
timeArray = time.localtime(timeS)
datetime = time.strftime("%Y-%m-%d %H:%M:%S", timeArray)
print(datetime)
time.sleep(0.1)
time.sleep(5)
[2020-04-22 15:13:02] 建立了连接
[2020-04-22 15:13:02] 进行了登录操作
[2020-04-22 15:13:02] 发送了版本信息
[2020-04-22 15:13:03] 当前设置了GPS轨迹:1_sample(短).json
[2020-04-22 15:13:03] 发送了点火事件
[2020-04-22 15:13:05] 纬度:29.569133 经度:106.586571
[2020-04-22 15:13:06] 纬度:29.569215 经度:106.586935
[2020-04-22 15:13:07] 纬度:29.569215 经度:106.587114
[2020-04-22 15:13:08] 纬度:29.569231 经度:106.587424
[2020-04-22 15:13:09] 纬度:29.569278 经度:106.587685
[2020-04-22 15:13:11] 纬度:29.569298 经度:106.587981
[2020-04-22 15:13:12] 纬度:29.569341 经度:106.588098
[2020-04-22 15:13:13] 纬度:29.569392 经度:106.588287
[2020-04-22 15:13:14] 纬度:29.569439 经度:106.588435
[2020-04-22 15:13:15] 纬度:29.569506 经度:106.588565
[2020-04-22 15:13:16] 纬度:29.569565 经度:106.588646
[2020-04-22 16:00:30] 启动了模拟程序[2020-04-22 16:01:02] 建立了连接
[2020-04-22 16:01:02] 进行了登录操作
[2020-04-22 16:01:02] 发送了版本信息
[2020-04-22 16:01:03] 当前设置了GPS轨迹:gpsLine3.txt
[2020-04-22 16:01:03] 发送了点火事件
[2020-04-22 16:01:05] 纬度:29.519863 经度:106.484645
[2020-04-22 16:01:06] 纬度:29.519863 经度:106.484645
[2020-04-22 16:01:07] 纬度:29.519863 经度:106.484645
[2020-04-22 16:01:08] 纬度:29.519863 经度:106.484645
[2020-04-22 16:01:09] 纬度:29.519863 经度:106.484645
[2020-04-22 16:01:11] 纬度:29.519863 经度:106.484645
[2020-04-22 16:01:12] 纬度:29.519863 经度:106.484645
......@@ -19,7 +19,7 @@ def startSimulaterService():
如果想要每天的9点自动执行一次轨迹行驶,则设置:year=0,month=0,day=0,hour=9,minute=0,second=0
如果想要每天的9点30自动执行一次轨迹行驶,则设置:year=0,month=0,day=0,hour=9,minute=30,second=0
'''
autoCarObj.startService(year=0,month=0,day=0,hour=0,minute=0,second=2)
autoCarObj.startService(year=0,month=0,day=0,hour=0,minute=1,second=0)
if __name__ == "__main__":
startSimulaterService()
......
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