Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
L
laravelzh
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
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
冯超鹏
laravelzh
Commits
dcba312d
Commit
dcba312d
authored
Jul 02, 2020
by
冯超鹏
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
报警弹出
parent
0a9a7abc
Pipeline
#69
canceled with stages
Changes
4
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
26 additions
and
6 deletions
+26
-6
swooleMeTcp.php
app/Console/Commands/swooleMeTcp.php
+16
-2
Navbar.vue
resources/js/layout/components/Navbar.vue
+2
-0
index.vue
resources/js/layout/components/TagsView/index.vue
+7
-4
index.vue
resources/js/views/login/index.vue
+1
-0
No files found.
app/Console/Commands/swooleMeTcp.php
View file @
dcba312d
...
...
@@ -80,8 +80,11 @@ class swooleMeTcp extends Command
});
//监听数据接收事件
$this
->
tcp
->
on
(
'Receive'
,
function
(
$serv
,
$fd
,
$from_id
,
$data
)
{
$swooletcp
=
new
SwooleCommandMeTcpController
();
$swooletcp
->
swooletcplist
(
$data
);
//验证数据格式
if
(
$this
->
formatData
(
$data
)){
$swooletcp
=
new
SwooleCommandMeTcpController
();
$swooletcp
->
swooletcplist
(
$data
);
}
});
//监听连接关闭事件
...
...
@@ -92,5 +95,16 @@ class swooleMeTcp extends Command
//启动服务器
$this
->
tcp
->
start
();
}
public
function
formatData
(
$str
){
$str
=
preg_replace
(
"/[^a-z,A-Z,0-9,\/,\.,-]/"
,
''
,
$str
);
$str
=
rtrim
(
trim
(
$str
),
'/'
);
$str
=
str_replace
(
'null'
,
-
1
,
$str
);
preg_match
(
"/^[a-z,A-Z,0-9,\-]
{
6,32}\/(\d{1,2})\/(\-?)([0-9,\.]{1,8
}
)$/"
,
$str
,
$out
);
if
(
count
(
$out
)
>
0
){
return
$str
;
}
else
{
return
false
;
}
}
}
\ No newline at end of file
resources/js/layout/components/Navbar.vue
View file @
dcba312d
...
...
@@ -80,6 +80,8 @@ export default {
},
async
logout
()
{
await
this
.
$store
.
dispatch
(
'user/logout'
);
this
.
$notify
.
closeAll
();
this
.
webscoket
.
onclose
();
this
.
$router
.
push
(
`/login?redirect=
${
this
.
$route
.
fullPath
}
`
);
},
},
...
...
resources/js/layout/components/TagsView/index.vue
View file @
dcba312d
...
...
@@ -71,6 +71,9 @@ export default {
}
},
},
created
()
{
window
.
addEventListener
(
'beforeunload'
,
e
=>
this
.
beforeun
(
e
));
},
mounted
()
{
this
.
initTags
();
this
.
addTags
();
...
...
@@ -140,7 +143,6 @@ export default {
websocketonmessage
(
e
){
// 数据接收
const
redata
=
JSON
.
parse
(
e
.
data
);
if
(
redata
.
code
===
200
)
{
localStorage
.
removeItem
(
'isalam'
);
if
(
localStorage
.
getItem
(
'isalam'
)
===
null
||
localStorage
.
getItem
(
'isalam'
)
===
undefined
)
{
// 第一次没有的话
localStorage
.
setItem
(
'isalam'
,
JSON
.
stringify
(
redata
.
data
));
for
(
let
i
=
0
;
i
<
redata
.
data
.
length
;
i
++
)
{
...
...
@@ -151,18 +153,16 @@ export default {
duration
:
0
,
message
:
redata
.
data
[
i
].
devicenumber
+
'正在报警请尽快处理'
,
onClose
:
function
(){
console
.
log
(
redata
.
data
[
i
].
devicenumber
);
},
});
},
3
);
}
}
else
{
for
(
let
j
=
0
;
j
<
redata
.
data
.
length
;
j
++
)
{
console
.
log
(
redata
.
data
[
j
].
devicenumber
,
JSON
.
parse
(
localStorage
.
getItem
(
'isalam'
)));
if
(
!
this
.
isarray
(
redata
.
data
[
j
].
devicenumber
,
JSON
.
parse
(
localStorage
.
getItem
(
'isalam'
))))
{
setTimeout
(()
=>
{
this
.
$notify
.
error
({
title
:
'报警提示!点击
X
可消警'
,
title
:
'报警提示!点击
右侧x
可消警'
,
dangerouslyUseHTMLString
:
true
,
duration
:
0
,
message
:
redata
.
data
[
j
].
devicenumber
+
'正在报警请尽快处理'
,
...
...
@@ -176,6 +176,9 @@ export default {
}
}
},
beforeun
(
e
)
{
localStorage
.
removeItem
(
'isalam'
);
},
websocketsend
(){
// 数据发送
this
.
websock
.
send
(
JSON
.
stringify
(
this
.
type
));
},
...
...
resources/js/views/login/index.vue
View file @
dcba312d
...
...
@@ -183,6 +183,7 @@ export default {
this
.
$store
.
dispatch
(
'user/login'
,
this
.
loginForm
)
.
then
(()
=>
{
this
.
$router
.
push
({
path
:
this
.
redirect
||
'/'
});
localStorage
.
removeItem
(
'isalam'
);
this
.
loading
=
false
;
})
.
catch
(()
=>
{
...
...
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