Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
N
new-socketemulator
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
李远洪
new-socketemulator
Commits
ea864fb4
Commit
ea864fb4
authored
Feb 08, 2020
by
李远洪
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
完成了心跳消息页面开发以及消息设置页面的开发
parent
511139a1
Changes
9
Show whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
263 additions
and
65 deletions
+263
-65
config/messageTools/messageTools.conf
config/messageTools/messageTools.conf
+4
-0
run.py
run.py
+9
-0
static/js/messageTools/setting.js
static/js/messageTools/setting.js
+14
-0
templates/messageTools/index.html
templates/messageTools/index.html
+5
-5
templates/messageTools/message/heartBeat_msg_page.html
templates/messageTools/message/heartBeat_msg_page.html
+23
-60
templates/messageTools/setting/msgSetting_page.html
templates/messageTools/setting/msgSetting_page.html
+82
-0
views/messageTools/message_process.py
views/messageTools/message_process.py
+56
-0
views/messageTools/msgSetting_process.py
views/messageTools/msgSetting_process.py
+43
-0
views/messageTools/msgSetting_view.py
views/messageTools/msgSetting_view.py
+27
-0
No files found.
config/messageTools/messageTools.conf
0 → 100644
View file @
ea864fb4
[
socket
]
host
=
10
.
100
.
9
.
17
port
=
9001
run.py
View file @
ea864fb4
...
@@ -6,7 +6,12 @@ from views.protocolTools.protocolReport_view import protocolReport_view
...
@@ -6,7 +6,12 @@ from views.protocolTools.protocolReport_view import protocolReport_view
from
views.protocolTools.protocolReport_process
import
protocolReport_process
from
views.protocolTools.protocolReport_process
import
protocolReport_process
from
views.protocolTools.test_view
import
test_view
from
views.protocolTools.test_view
import
test_view
from
views.messageTools.msgSetting_view
import
msgSetting_view
from
views.messageTools.msgSetting_process
import
msgSetting_process
from
views.messageTools.message_view
import
message_view
from
views.messageTools.message_view
import
message_view
from
views.messageTools.message_process
import
message_process
from
views.tab1.style
import
style
from
views.tab1.style
import
style
from
views.tab1.icon
import
icon
from
views.tab1.icon
import
icon
from
views.tab2.login
import
login
from
views.tab2.login
import
login
...
@@ -20,7 +25,11 @@ app.register_blueprint(protocolReport_view,url_prefix = "/protocolTools/protocol
...
@@ -20,7 +25,11 @@ app.register_blueprint(protocolReport_view,url_prefix = "/protocolTools/protocol
app
.
register_blueprint
(
protocolReport_process
,
url_prefix
=
"/protocolTools/protocolReport_process"
)
app
.
register_blueprint
(
protocolReport_process
,
url_prefix
=
"/protocolTools/protocolReport_process"
)
app
.
register_blueprint
(
test_view
,
url_prefix
=
"/protocolTools/test_view"
)
app
.
register_blueprint
(
test_view
,
url_prefix
=
"/protocolTools/test_view"
)
app
.
register_blueprint
(
msgSetting_view
,
url_prefix
=
"/messageTools/msgSetting_view"
)
app
.
register_blueprint
(
msgSetting_process
,
url_prefix
=
"/messageTools/msgSetting_process"
)
app
.
register_blueprint
(
message_view
,
url_prefix
=
"/messageTools/message_view"
)
app
.
register_blueprint
(
message_view
,
url_prefix
=
"/messageTools/message_view"
)
app
.
register_blueprint
(
message_process
,
url_prefix
=
"/messageTools/message_process"
)
app
.
register_blueprint
(
style
,
url_prefix
=
"/tab1/style"
)
app
.
register_blueprint
(
style
,
url_prefix
=
"/tab1/style"
)
app
.
register_blueprint
(
icon
,
url_prefix
=
"/tab1/icon"
)
app
.
register_blueprint
(
icon
,
url_prefix
=
"/tab1/icon"
)
app
.
register_blueprint
(
login
,
url_prefix
=
"/tab2/login"
)
app
.
register_blueprint
(
login
,
url_prefix
=
"/tab2/login"
)
...
...
static/js/messageTools/setting.js
0 → 100644
View file @
ea864fb4
/**
*setting 页面顶部的协议切换
*/
function
settingManTab
(
e
){
var
url
=
window
.
location
.
href
;
var
id
=
$
(
e
).
attr
(
"
id
"
);
if
(
id
==
"
msgSetting
"
){
$
(
location
).
attr
(
'
href
'
,
"
http://
"
+
window
.
location
.
host
+
"
/messageTools/msgSetting_view/msgSetting_page
"
);
}
else
if
(
id
==
"
style_labels1
"
){
$
(
location
).
attr
(
'
href
'
,
"
http://
"
+
window
.
location
.
host
+
"
/tab1/style/labels
"
);
}
else
{
alert
(
id
)
}
}
\ No newline at end of file
templates/messageTools/index.html
View file @
ea864fb4
...
@@ -20,9 +20,9 @@
...
@@ -20,9 +20,9 @@
function
swichLeftTab
(
e
){
function
swichLeftTab
(
e
){
var
id
=
$
(
e
).
attr
(
"
id
"
)
var
id
=
$
(
e
).
attr
(
"
id
"
)
if
(
id
==
"
setting
"
){
if
(
id
==
"
setting
"
){
$
(
location
).
attr
(
'
href
'
,
"
http://
"
+
window
.
location
.
host
+
"
/
protocolTools/setting_view/socket
Setting_page
"
);
$
(
location
).
attr
(
'
href
'
,
"
http://
"
+
window
.
location
.
host
+
"
/
messageTools/msgSetting_view/msg
Setting_page
"
);
}
else
if
(
id
==
"
protocols_report
"
){
}
else
if
(
id
==
"
msg_send
"
){
$
(
location
).
attr
(
'
href
'
,
"
http://
"
+
window
.
location
.
host
+
"
/
protocolTools/protocolReport_view/GPS_protocol
_page
"
);
$
(
location
).
attr
(
'
href
'
,
"
http://
"
+
window
.
location
.
host
+
"
/
messageTools/message_view/heartBeat_msg
_page
"
);
}
else
if
(
id
==
"
test
"
){
}
else
if
(
id
==
"
test
"
){
$
(
location
).
attr
(
'
href
'
,
"
http://
"
+
window
.
location
.
host
+
"
/protocolTools/test_view/test_page
"
);
$
(
location
).
attr
(
'
href
'
,
"
http://
"
+
window
.
location
.
host
+
"
/protocolTools/test_view/test_page
"
);
}
else
if
(
id
==
"
icon
"
){
}
else
if
(
id
==
"
icon
"
){
...
@@ -34,8 +34,8 @@
...
@@ -34,8 +34,8 @@
{% block leftNav %}
{% block leftNav %}
<div
id=
"container1"
class=
"col-sm-3 col-md-2 sidebar"
style=
"margin-top:50px;width:15%;padding:0px;margin-right:15px;"
>
<div
id=
"container1"
class=
"col-sm-3 col-md-2 sidebar"
style=
"margin-top:50px;width:15%;padding:0px;margin-right:15px;"
>
<ul
class=
"nav nav-sidebar"
>
<ul
class=
"nav nav-sidebar"
>
<li
id=
"setting"
onclick=
"swichLeftTab(this)"
><a
{%
if
arg.path[1]=
="
s
etting_view"
%}
class=
"active_left_tab"
{%
endif
%}
><span
class=
"glyphicon glyphicon-cog"
aria-hidden=
"true"
></span>
系统设置
</a></li>
<li
id=
"setting"
onclick=
"swichLeftTab(this)"
><a
{%
if
arg.path[1]=
="
msgS
etting_view"
%}
class=
"active_left_tab"
{%
endif
%}
><span
class=
"glyphicon glyphicon-cog"
aria-hidden=
"true"
></span>
系统设置
</a></li>
<li
id=
"
protocols_report
"
onclick=
"swichLeftTab(this)"
><a
{%
if
arg.path[1]=
="message_view"
%}
class=
"active_left_tab"
{%
endif
%}
><span
class=
"glyphicon glyphicon-list-alt"
aria-hidden=
"true"
></span>
终端消息发送
<span
class=
"sr-only"
></span></a></li>
<li
id=
"
msg_send
"
onclick=
"swichLeftTab(this)"
><a
{%
if
arg.path[1]=
="message_view"
%}
class=
"active_left_tab"
{%
endif
%}
><span
class=
"glyphicon glyphicon-list-alt"
aria-hidden=
"true"
></span>
终端消息发送
<span
class=
"sr-only"
></span></a></li>
</ul>
</ul>
<ul
class=
"nav nav-sidebar"
style=
"margin-top:20px;"
>
<ul
class=
"nav nav-sidebar"
style=
"margin-top:20px;"
>
<li><a><span
class=
"glyphicon glyphicon-eye-open"
aria-hidden=
"true"
></span>
其他页面
</a></li>
<li><a><span
class=
"glyphicon glyphicon-eye-open"
aria-hidden=
"true"
></span>
其他页面
</a></li>
...
...
templates/messageTools/message/heartBeat_msg_page.html
View file @
ea864fb4
...
@@ -42,11 +42,11 @@
...
@@ -42,11 +42,11 @@
<option
value=
"0"
>
不加密
</option>
<option
value=
"0"
>
不加密
</option>
<option
value=
"1024"
>
加密
</option>
<option
value=
"1024"
>
加密
</option>
</select>
</select>
<label>
有无分包:
</label><select
style=
"width:80px;"
id=
"
brakeStatus
"
class=
"form-control"
>
<label>
有无分包:
</label><select
style=
"width:80px;"
id=
"
subPkg
"
class=
"form-control"
>
<option
value=
"0"
>
无
</option>
<option
value=
"0"
>
无
</option>
<option
value=
"8192"
>
有
</option>
<option
value=
"8192"
>
有
</option>
</select>
</select>
<label
id=
"subPkg_label"
style=
"color:grey;"
>
分包个数:
</label><input
disabled=
"disabled"
id=
"
subPkg
"
type=
"text"
class=
"form-control"
value=
"2"
style=
"width:60px;"
>
<label
id=
"subPkg_label"
style=
"color:grey;"
>
分包个数:
</label><input
disabled=
"disabled"
id=
"
pkgCounts
"
type=
"text"
class=
"form-control"
value=
"2"
style=
"width:60px;"
>
</div>
</div>
<H3
style=
"border-bottom: 1px solid #eee;"
>
设置心跳消息内容:
</H3>
<H3
style=
"border-bottom: 1px solid #eee;"
>
设置心跳消息内容:
</H3>
<ul
class=
"protocol_content"
style=
"padding:0px;"
>
<ul
class=
"protocol_content"
style=
"padding:0px;"
>
...
@@ -67,63 +67,38 @@
...
@@ -67,63 +67,38 @@
<script>
<script>
//发送GPS数据
//发送GPS数据
$
(
"
#sendMsgBtn
"
).
click
(
function
(){
$
(
"
#sendMsgBtn
"
).
click
(
function
(){
var
WATER_CODE
=
$
(
"
#WATER_CODE
"
).
val
();
var
msgID
=
$
(
"
#msgID
"
).
val
();
var
DEV_ID
=
$
(
"
#DEV_ID
"
).
val
();
var
phoneNum
=
$
(
"
#phoneNum
"
).
val
();
var
msgCount
=
$
(
"
#msgCount
"
).
val
();
var
msgWaterCode
=
$
(
"
#msgWaterCode
"
).
val
();
var
encryptionType
=
$
(
"
#encryptionType
"
).
val
();
var
UTCTime
=
$
(
"
#UTCTime
"
).
val
();
var
subPkg
=
$
(
"
#subPkg
"
).
val
();
var
latitude
=
$
(
"
#latitude
"
).
val
();
var
pkgCounts
=
""
var
longitude
=
$
(
"
#longitude
"
).
val
();
if
(
subPkg
!=
"
8192
"
){
var
speed
=
$
(
"
#speed
"
).
val
();
pkgCounts
=
"
0
"
var
directionAngle
=
$
(
"
#directionAngle
"
).
val
();
}
else
{
var
elevation
=
$
(
"
#elevation
"
).
val
();
pkgCounts
=
$
(
"
#pkgCounts
"
).
val
();
var
positionStar
=
$
(
"
#positionStar
"
).
val
();
}
var
Pdop
=
$
(
"
#Pdop
"
).
val
();
var
Hdop
=
$
(
"
#Hdop
"
).
val
();
var
Vdop
=
$
(
"
#Vdop
"
).
val
();
var
statusBit
=
$
(
"
#statusBit
"
).
val
();
var
valtage
=
$
(
"
#valtage
"
).
val
();
var
OBDSpeed
=
$
(
"
#OBDSpeed
"
).
val
();
var
engineSpeed
=
$
(
"
#engineSpeed
"
).
val
();
var
GPSTotalMileage
=
$
(
"
#GPSTotalMileage
"
).
val
();
var
totalOil
=
$
(
"
#totalOil
"
).
val
();
var
totalTime
=
$
(
"
#totalTime
"
).
val
();
var
GPSTimestamp
=
$
(
"
#GPSTimestamp
"
).
val
();
var
data
=
{};
var
data
=
{};
data
[
"
WATER_CODE
"
]
=
WATER_CODE
;
data
[
"
msgID
"
]
=
msgID
;
data
[
"
DEV_ID
"
]
=
DEV_ID
;
data
[
"
phoneNum
"
]
=
phoneNum
;
data
[
"
msgCount
"
]
=
msgCount
;
data
[
"
msgWaterCode
"
]
=
msgWaterCode
;
data
[
"
encryptionType
"
]
=
encryptionType
;
data
[
"
UTCTime
"
]
=
UTCTime
;
data
[
"
subPkg
"
]
=
subPkg
;
data
[
"
latitude
"
]
=
latitude
;
data
[
"
pkgCounts
"
]
=
pkgCounts
;
data
[
"
longitude
"
]
=
longitude
;
data
[
"
speed
"
]
=
speed
;
data
[
"
directionAngle
"
]
=
directionAngle
;
data
[
"
elevation
"
]
=
elevation
;
data
[
"
positionStar
"
]
=
positionStar
;
data
[
"
Pdop
"
]
=
Pdop
;
data
[
"
Hdop
"
]
=
Hdop
;
data
[
"
Vdop
"
]
=
Vdop
;
data
[
"
statusBit
"
]
=
statusBit
;
data
[
"
valtage
"
]
=
valtage
;
data
[
"
OBDSpeed
"
]
=
OBDSpeed
;
data
[
"
engineSpeed
"
]
=
engineSpeed
;
data
[
"
GPSTotalMileage
"
]
=
GPSTotalMileage
;
data
[
"
totalOil
"
]
=
totalOil
;
data
[
"
totalTime
"
]
=
totalTime
;
data
[
"
GPSTimestamp
"
]
=
GPSTimestamp
;
var
host
=
window
.
location
.
host
;
var
host
=
window
.
location
.
host
;
$
.
ajax
({
$
.
ajax
({
url
:
"
http://
"
+
host
+
"
/
protocolTools/protocolReport_process/porcessGPS
Msg
"
,
url
:
"
http://
"
+
host
+
"
/
messageTools/message_process/porcessHeartBeat
Msg
"
,
type
:
"
post
"
,
type
:
"
post
"
,
data
:
data
,
data
:
data
,
dataType
:
"
json
"
,
dataType
:
"
json
"
,
success
:
function
(
data
){
success
:
function
(
data
){
if
(
data
.
status
==
200
){
if
(
data
.
status
==
200
){
//window.location.reload()
//window.location.reload()
$
(
"
#showFeedback
"
).
val
(
data
.
result
)
var
theShow
=
"
原始数据:
"
+
data
.
result
+
"
\n
"
theShow
=
theShow
+
"
解析数据:
"
+
JSON
.
stringify
(
data
.
parse
)
+
"
\n
"
$
(
"
#showFeedback
"
).
val
(
theShow
)
}
else
{
}
else
{
$
(
"
#showFeedback
"
).
val
(
data
.
message
)
$
(
"
#showFeedback
"
).
val
(
data
.
message
)
alert
(
data
.
message
);
alert
(
data
.
message
);
...
@@ -131,18 +106,6 @@
...
@@ -131,18 +106,6 @@
}
}
});
});
});
});
//设置当前时间到UTC时间输入框
(
function
(){
var
curTime
=
getCurTime
();
$
(
"
#UTCTime
"
).
val
(
curTime
);
})();
//设置当前时间戳到GPS信息时间戳输入框
(
function
(){
var
curTimestamp
=
getCutTimestamp
();
$
(
"
#GPSTimestamp
"
).
val
(
curTimestamp
);
})();
</script>
</script>
{% endblock %}
{% endblock %}
</div>
</div>
...
...
templates/messageTools/setting/msgSetting_page.html
0 → 100644
View file @
ea864fb4
{% extends "messageTools/index.html" %}
{% block title %}msgSetting{% endblock %}
{% block content_01 %}
<script
src=
"../../static/js/messageTools/setting.js"
></script>
<style>
.nav-pills
li
{
margin-bottom
:
5px
;
}
.form-control
{
display
:
inline
;
width
:
160px
;
}
.protocol_content
:after
{
clear
:
both
;
display
:
block
;
content
:
" "
;
}
.protocol_content
li
{
width
:
250px
;
_background
:
yellow
;
list-style
:
none
;
margin-top
:
5px
;
float
:
left
;
}
.protocol_content
label
{
width
:
90px
;
text-align
:
right
;
}
</style>
<div
id=
"container2"
style=
"width:82%;min-height:750px;float:left;_background:grey;margin-top:50px;"
>
{% block content_02 %}
<ul
class=
"nav nav-pills"
style=
"font-size:14px;"
>
<li
role=
"presentation"
><a
id=
"msgSetting"
{%
if
arg.path[2]=
="msgSetting_page"
%}
class=
"link-tab"
{%
endif
%}
onclick=
"settingManTab(this)"
>
socket设置
</b></a></li>
<li
role=
"presentation"
><a
id=
"style_index1"
{%
if
arg.path[2]=
="1"
%}
class=
"link-tab"
{%
endif
%}
onclick=
"settingManTab(this)"
>
其他设置
</b></a></li>
</ul>
{% endblock %}
{% block content_1 %}
<div
id=
"container3"
style=
"width:100%;min-height:750px;float:left;_background:green;margin-top:10px;_border-top: 1px solid #eee;"
>
<div
style=
"width:100%;_background:green;padding:5px;padding-top:0px;"
>
<h3
style=
"border-bottom: 1px solid #eee;"
>
连接设置:
</h3>
<label>
主机地址:
</label><input
id=
"host"
type=
"text"
class=
"form-control"
value=
"{{ arg['socket']['host']}}"
>
<label
style=
"margin-left:10px;"
>
端口:
</label><input
id=
"port"
type=
"text"
class=
"form-control"
value=
"{{ arg['socket']['port']}}"
style=
"width:100px;"
>
</div>
<H3
style=
"border-bottom: 1px solid #eee;"
>
控制:
</H3>
<div
style=
"width:100%;padding:5px;margin-top:10px;"
>
<button
type=
"button"
class=
"btn btn-primary"
id=
"saveSetting"
>
保存设置
</button>
</div>
</div>
<script>
//保存设置数据
$
(
"
#saveSetting
"
).
click
(
function
(){
var
host
=
$
(
"
#host
"
).
val
();
var
port
=
$
(
"
#port
"
).
val
();
var
data
=
{};
data
[
"
host
"
]
=
host
;
data
[
"
port
"
]
=
port
;
var
host
=
window
.
location
.
host
;
$
.
ajax
({
url
:
"
http://
"
+
host
+
"
/messageTools/msgSetting_process/msgSocketSetting
"
,
type
:
"
post
"
,
data
:
data
,
dataType
:
"
json
"
,
success
:
function
(
data
){
if
(
data
.
status
==
200
){
window
.
location
.
reload
()
}
else
{
$
(
"
#showFeedback
"
).
val
(
data
.
message
)
alert
(
data
.
message
);
}
}
});
});
</script>
{% endblock %}
</div>
{% endblock %}
\ No newline at end of file
views/messageTools/message_process.py
View file @
ea864fb4
#coding:utf-8
from
flask
import
Blueprint
,
Response
,
request
from
configparser
import
ConfigParser
from
lib.protocol.message.TerminalHeartbeat_msg
import
TerminalHeartbeat_msg
from
lib.protocol.messageRes.PlatformCommon_res
import
PlatformCommon_res
from
lib.protocol.report.HeartBeatReport_protocol
import
HeartBeatReport_protocol
from
lib.socket.ClientSocket
import
ClientSocket
import
json
import
traceback
import
binascii
message_process
=
Blueprint
(
'message_process'
,
__name__
)
##########################################
# 【接口类型】处理发送的心跳消息
##########################################
@
message_process
.
route
(
"/porcessHeartBeatMsg"
,
methods
=
[
'POST'
])
def
porcessHeartBeatMsg
():
msgID
=
request
.
form
.
get
(
"msgID"
)
phoneNum
=
request
.
form
.
get
(
"phoneNum"
)
msgWaterCode
=
request
.
form
.
get
(
"msgWaterCode"
)
encryptionType
=
request
.
form
.
get
(
"encryptionType"
)
subPkg
=
request
.
form
.
get
(
"subPkg"
)
pkgCounts
=
request
.
form
.
get
(
"pkgCounts"
)
data
=
{}
if
(
msgID
==
None
or
phoneNum
==
None
or
msgWaterCode
==
None
or
encryptionType
==
None
or
subPkg
==
None
or
pkgCounts
==
None
):
data
[
"status"
]
=
"4003"
data
[
"message"
]
=
"Info: 请检查是否传入了空数据!"
return
Response
(
json
.
dumps
(
data
),
mimetype
=
'application/json'
)
else
:
try
:
conf_R
=
ConfigParser
()
conf_R
.
read
(
"config/messageTools/messageTools.conf"
)
cliSocket
=
ClientSocket
(
conf_R
.
get
(
"socket"
,
"host"
),
conf_R
.
getint
(
"socket"
,
"port"
))
cliSocket
.
connect
()
heartBeatmsgObj
=
TerminalHeartbeat_msg
()
msg
=
heartBeatmsgObj
.
generateMsg
()
cliSocket
.
send
(
msg
)
socRecv_1
=
cliSocket
.
receive
()
socRecv_2
=
str
(
socRecv_1
)
cliSocket
.
close
()
data
[
"status"
]
=
"200"
data
[
"message"
]
=
"Sucess: "
data
[
"result"
]
=
socRecv_2
data
[
"parse"
]
=
PlatformCommon_res
(
socRecv_1
)
.
getMsg
()
except
BaseException
as
e
:
# 打印异常信息
traceback
.
print_exc
()
data
[
"status"
]
=
"4003"
data
[
"message"
]
=
"Error: 处理失败!"
return
Response
(
json
.
dumps
(
data
),
mimetype
=
'application/json'
)
\ No newline at end of file
views/messageTools/msgSetting_process.py
0 → 100644
View file @
ea864fb4
#coding:utf-8
from
flask
import
Blueprint
,
Response
,
request
from
configparser
import
ConfigParser
import
json
import
traceback
msgSetting_process
=
Blueprint
(
'msgSetting_process'
,
__name__
)
##########################################
# 【接口类型】处理发送的GPS上报报文
##########################################
@
msgSetting_process
.
route
(
"/msgSocketSetting"
,
methods
=
[
'POST'
])
def
msgSocketSetting
():
host
=
request
.
form
.
get
(
"host"
)
port
=
request
.
form
.
get
(
"port"
)
data
=
{}
if
(
host
==
None
or
port
==
None
):
data
[
"status"
]
=
"4003"
data
[
"message"
]
=
"Info: 请检查是否传入了空数据!"
return
Response
(
json
.
dumps
(
data
),
mimetype
=
'application/json'
)
else
:
try
:
# d读取config文件
conf_R
=
ConfigParser
()
conf_R
.
read
(
"config/messageTools/messageTools.conf"
)
conf_W
=
conf_R
conf_W
[
"socket"
][
"host"
]
=
host
conf_W
[
"socket"
][
"port"
]
=
port
with
open
(
"config/messageTools/messageTools.conf"
,
"w"
)
as
fi
:
conf_W
.
write
(
fi
)
data
[
"status"
]
=
"200"
data
[
"message"
]
=
"Sucess: "
except
BaseException
as
e
:
# 打印异常信息
traceback
.
print_exc
()
data
[
"status"
]
=
"4003"
data
[
"message"
]
=
"Error: 处理失败!"
return
Response
(
json
.
dumps
(
data
),
mimetype
=
'application/json'
)
views/messageTools/msgSetting_view.py
0 → 100644
View file @
ea864fb4
#coding:utf-8
from
configparser
import
ConfigParser
from
flask
import
Blueprint
,
render_template
,
request
import
re
msgSetting_view
=
Blueprint
(
'msgSetting_view'
,
__name__
)
##########################################
# 【视图类型】访问心跳消息发送页面
##########################################
@
msgSetting_view
.
route
(
'/msgSetting_page'
)
def
msgSetting_page
():
#获取请求的路劲
url
=
request
.
url
reqPath
=
re
.
findall
(
"http://(.*)$"
,
url
)[
0
]
reqPath
=
re
.
findall
(
"/(.*)$"
,
reqPath
)[
0
]
arg
=
{}
path
=
"messageTools/setting/msgSetting_page.html"
arg
[
"path"
]
=
reqPath
.
split
(
"/"
)
# 读取config文件
arg
[
"socket"
]
=
{}
conf_R
=
ConfigParser
()
conf_R
.
read
(
"config/messageTools/messageTools.conf"
)
arg
[
"socket"
][
"host"
]
=
conf_R
.
get
(
"socket"
,
"host"
)
arg
[
"socket"
][
"port"
]
=
conf_R
.
getint
(
"socket"
,
"port"
)
return
render_template
(
path
,
arg
=
arg
)
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