Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
O
OpenCPS
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
joliu
OpenCPS
Commits
f00be769
Commit
f00be769
authored
Mar 22, 2018
by
joliu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
实现查询周期更新功能
parent
92f3dd5a
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
2 deletions
+18
-2
hfv/listenSer.py
hfv/listenSer.py
+18
-2
No files found.
hfv/listenSer.py
View file @
f00be769
...
...
@@ -156,8 +156,9 @@ def executeCommand(command, information):
# 清空任务队列
(
status
,
output
)
=
clearDB
()
elif
command
==
"period"
:
ctime
=
information
[
0
]
# 设置查询循环周期
(
status
,
output
)
=
setPeriod
(
cT
ime
)
(
status
,
output
)
=
updatePeriod
(
ct
ime
)
elif
command
==
"show"
:
(
status
,
output
)
=
showDB
()
print
(
output
)
...
...
@@ -181,7 +182,22 @@ def createDB():
# 设置时间周期
def
updatePeriod
(
cTime
):
return
(
1
,
"tiem"
)
try
:
sql
=
'update task set ctime='
+
str
(
cTime
)
conn
=
sqlite3
.
connect
(
"task.db"
)
cursor
=
conn
.
cursor
()
cursor
.
execute
(
sql
)
conn
.
commit
()
(
status
,
output
)
=
(
1
,
cTime
)
except
sqlite3
.
Error
as
err_msg
:
print
(
"Database error: %s"
,
err_msg
)
(
status
,
output
)
=
(
-
1
,
err_msg
)
except
Exception
as
err_msg
:
(
status
,
output
)
=
(
-
1
,
err_msg
)
finally
:
cursor
.
close
()
conn
.
close
()
return
(
status
,
output
)
# 插入任务到数据库
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment