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
45ed0789
Commit
45ed0789
authored
Dec 18, 2020
by
Administrator
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'hotfix/swoole_tcp'
parents
ec382860
2d05d9e1
Pipeline
#217
failed with stage
Changes
3
Pipelines
2
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
21 additions
and
6 deletions
+21
-6
AlarmOrderController.php
app/Http/Controllers/AlarmOrderController.php
+3
-3
SwooleCommandMeTcpController.php
app/Http/Controllers/Auth/SwooleCommandMeTcpController.php
+11
-2
ZehongTcpController.php
app/Http/Controllers/Auth/ZehongTcpController.php
+7
-1
No files found.
app/Http/Controllers/AlarmOrderController.php
View file @
45ed0789
...
...
@@ -59,7 +59,7 @@ class AlarmOrderController extends Controller
->
leftjoin
(
'reportpolice AS r'
,
'r.id'
,
'='
,
'alarm_order.reportpolice_id'
)
->
leftjoin
(
'device AS d'
,
'd.id'
,
'='
,
'alarm_order.device_id'
)
->
leftjoin
(
'users AS u'
,
'alarm_order.user_id'
,
'='
,
'u.id'
)
->
leftjoin
(
'status AS s'
,
's.id'
,
'='
,
'
alarm_order.reportpolice_id
'
)
->
leftjoin
(
'status AS s'
,
's.id'
,
'='
,
'
r.policestatus
'
)
->
leftjoin
(
'device_type AS t'
,
'r.policestatus'
,
'='
,
't.tid'
)
->
offset
(
$offset
)
->
where
(
$where
)
...
...
@@ -93,7 +93,7 @@ class AlarmOrderController extends Controller
->
leftjoin
(
'reportpolice AS r'
,
'r.id'
,
'='
,
'alarm_order.reportpolice_id'
)
->
leftjoin
(
'device AS d'
,
'd.id'
,
'='
,
'alarm_order.device_id'
)
->
leftjoin
(
'users AS u'
,
'alarm_order.user_id'
,
'='
,
'u.id'
)
->
leftjoin
(
'status AS s'
,
's.id'
,
'='
,
'
alarm_order.reportpolice_id
'
)
->
leftjoin
(
'status AS s'
,
's.id'
,
'='
,
'
r.policestatus
'
)
->
leftjoin
(
'device_type AS t'
,
'r.policestatus'
,
'='
,
't.tid'
)
->
whereIn
(
'alarm_order.state'
,
explode
(
','
,
$request
->
input
(
'userstate'
)))
->
where
(
'u.id'
,
'='
,
Auth
::
id
())
...
...
@@ -164,7 +164,7 @@ class AlarmOrderController extends Controller
$order
=
AlarmOrder
::
leftjoin
(
'reportpolice AS r'
,
'r.id'
,
'='
,
'alarm_order.reportpolice_id'
)
->
leftjoin
(
'device AS d'
,
'd.id'
,
'='
,
'alarm_order.device_id'
)
->
leftjoin
(
'users AS u'
,
'alarm_order.user_id'
,
'='
,
'u.id'
)
->
leftjoin
(
'status AS s'
,
's.id'
,
'='
,
'
alarm_order.reportpolice_id
'
)
->
leftjoin
(
'status AS s'
,
's.id'
,
'='
,
'
r.policestatus
'
)
->
leftjoin
(
'device_type AS t'
,
'r.policestatus'
,
'='
,
't.tid'
)
->
leftjoin
(
'gas AS g'
,
'd.status'
,
'='
,
'g.id'
)
->
leftjoin
(
'danwei AS w'
,
'd.devicemonad'
,
'='
,
'w.id'
)
...
...
app/Http/Controllers/Auth/SwooleCommandMeTcpController.php
View file @
45ed0789
...
...
@@ -6,6 +6,7 @@ use Illuminate\Support\Facades\DB;
use
App\Laravue\Models\Users
;
use
Illuminate\Http\Request
;
use
App\Http\Controllers\Controller
;
use
Illuminate\Support\Facades\Log
;
use
Illuminate\Support\Facades\Redis
;
use
App\Http\Controllers\DevicesController
;
use
Illuminate\Support\Facades\Config
;
...
...
@@ -15,6 +16,7 @@ class SwooleCommandMeTcpController extends Controller
//获取tcp链接返回数据 //进去redis
public
function
swooletcplist
(
$data
=
''
)
{
Log
::
channel
(
'slack'
)
->
info
(
'接收数据 =>'
.
$data
);
if
(
$data
!=
''
)
{
$datadevice
=
$this
->
stringdata
(
$data
);
Redis
::
set
(
'dbtype'
,
0
);
...
...
@@ -119,7 +121,7 @@ class SwooleCommandMeTcpController extends Controller
if
(
$type
[
'status'
]
==
1
&&
$type
[
'endtime'
]
==
''
&&
$davicedata
[
1
]
==
1
){
$up
=
DB
::
table
(
'reportpolice'
)
->
where
(
'devicenumber'
,
'='
,
$davicedata
[
0
])
->
update
([
'endtime'
=>
time
(),
'status'
=>
2
,
'policestatus'
=>
$davicedata
[
1
]
]);
->
update
([
'endtime'
=>
time
(),
'status'
=>
2
]);
}
if
(
$isdavice
)
{
//改成报警状态
...
...
@@ -131,7 +133,14 @@ class SwooleCommandMeTcpController extends Controller
}
else
{
if
(
$davicedata
[
1
]
!=
1
)
{
$add
=
DB
::
table
(
'reportpolice'
)
->
insertGetId
([
'devicenumber'
=>
$davicedata
[
0
],
'starttime'
=>
time
(),
'concentration'
=>
$davicedata
[
2
],
'policestatus'
=>
$davicedata
[
1
],
'status'
=>
1
]);
->
insertGetId
([
'devicenumber'
=>
$davicedata
[
0
],
'starttime'
=>
time
(),
'concentration'
=>
$davicedata
[
2
],
'policestatus'
=>
$davicedata
[
1
],
'status'
=>
1
,
'location'
=>
$isdevicenumm
->
deviceinfo
,
]);
}
}
...
...
app/Http/Controllers/Auth/ZehongTcpController.php
View file @
45ed0789
...
...
@@ -9,6 +9,7 @@ use App\Http\Controllers\Controller;
use
Illuminate\Support\Facades\Redis
;
use
App\Http\Controllers\DevicesController
;
use
Illuminate\Support\Facades\Config
;
use
App\Http\Controllers\Auth\SwooleCommandMeTcpController
;
class
ZehongTcpController
extends
Controller
{
...
...
@@ -85,6 +86,11 @@ class ZehongTcpController extends Controller
//获取上报数据从数据库查询
public
function
mysqldb
(
$data
){
if
(
$data
!=
[]){
// 报警提醒
$meTcp
=
new
SwooleCommandMeTcpController
();
$alarmData
=
$data
[
'id'
]
.
'/'
.
$data
[
'status'
]
.
'/'
.
$data
[
'np'
];
$meTcp
->
swooletcplist
(
$alarmData
);
$datainfo
=
DB
::
table
(
'device'
)
->
where
(
'devicenum'
,
'='
,
$data
[
'id'
])
->
update
([
'nd'
=>
intval
(
$data
[
'np'
]),
'devicepolice'
=>
$data
[
'status'
]
==
0
?
'1'
:
$data
[
'status'
],
'update_time'
=>
time
(),
'shutoff_status'
=>
$data
[
'famen'
]]);
...
...
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