Commit 3fd7c9d5 authored by Administrator's avatar Administrator

Merge tag 'swoole_tcp' into develop

no message
parents 07cc3fe7 45ed0789
...@@ -59,7 +59,7 @@ class AlarmOrderController extends Controller ...@@ -59,7 +59,7 @@ class AlarmOrderController extends Controller
->leftjoin('reportpolice AS r', 'r.id', '=', 'alarm_order.reportpolice_id') ->leftjoin('reportpolice AS r', 'r.id', '=', 'alarm_order.reportpolice_id')
->leftjoin('device AS d', 'd.id', '=', 'alarm_order.device_id') ->leftjoin('device AS d', 'd.id', '=', 'alarm_order.device_id')
->leftjoin('users AS u', 'alarm_order.user_id', '=', 'u.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('device_type AS t', 'r.policestatus', '=', 't.tid')
->offset($offset) ->offset($offset)
->where($where) ->where($where)
...@@ -93,7 +93,7 @@ class AlarmOrderController extends Controller ...@@ -93,7 +93,7 @@ class AlarmOrderController extends Controller
->leftjoin('reportpolice AS r', 'r.id', '=', 'alarm_order.reportpolice_id') ->leftjoin('reportpolice AS r', 'r.id', '=', 'alarm_order.reportpolice_id')
->leftjoin('device AS d', 'd.id', '=', 'alarm_order.device_id') ->leftjoin('device AS d', 'd.id', '=', 'alarm_order.device_id')
->leftjoin('users AS u', 'alarm_order.user_id', '=', 'u.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('device_type AS t', 'r.policestatus', '=', 't.tid')
->whereIn('alarm_order.state',explode(',',$request->input('userstate'))) ->whereIn('alarm_order.state',explode(',',$request->input('userstate')))
->where('u.id','=',Auth::id()) ->where('u.id','=',Auth::id())
...@@ -164,7 +164,7 @@ class AlarmOrderController extends Controller ...@@ -164,7 +164,7 @@ class AlarmOrderController extends Controller
$order = AlarmOrder::leftjoin('reportpolice AS r', 'r.id', '=', 'alarm_order.reportpolice_id') $order = AlarmOrder::leftjoin('reportpolice AS r', 'r.id', '=', 'alarm_order.reportpolice_id')
->leftjoin('device AS d', 'd.id', '=', 'alarm_order.device_id') ->leftjoin('device AS d', 'd.id', '=', 'alarm_order.device_id')
->leftjoin('users AS u', 'alarm_order.user_id', '=', 'u.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('device_type AS t', 'r.policestatus', '=', 't.tid')
->leftjoin('gas AS g', 'd.status', '=', 'g.id') ->leftjoin('gas AS g', 'd.status', '=', 'g.id')
->leftjoin('danwei AS w', 'd.devicemonad', '=', 'w.id') ->leftjoin('danwei AS w', 'd.devicemonad', '=', 'w.id')
......
...@@ -6,6 +6,7 @@ use Illuminate\Support\Facades\DB; ...@@ -6,6 +6,7 @@ use Illuminate\Support\Facades\DB;
use App\Laravue\Models\Users; use App\Laravue\Models\Users;
use Illuminate\Http\Request; use Illuminate\Http\Request;
use App\Http\Controllers\Controller; use App\Http\Controllers\Controller;
use Illuminate\Support\Facades\Log;
use Illuminate\Support\Facades\Redis; use Illuminate\Support\Facades\Redis;
use App\Http\Controllers\DevicesController; use App\Http\Controllers\DevicesController;
use Illuminate\Support\Facades\Config; use Illuminate\Support\Facades\Config;
...@@ -15,6 +16,7 @@ class SwooleCommandMeTcpController extends Controller ...@@ -15,6 +16,7 @@ class SwooleCommandMeTcpController extends Controller
//获取tcp链接返回数据 //进去redis //获取tcp链接返回数据 //进去redis
public function swooletcplist($data = '') public function swooletcplist($data = '')
{ {
Log::channel('slack')->info('接收数据 =>' . $data);
if ($data != '') { if ($data != '') {
$datadevice = $this->stringdata($data); $datadevice = $this->stringdata($data);
Redis::set('dbtype',0); Redis::set('dbtype',0);
...@@ -119,7 +121,7 @@ class SwooleCommandMeTcpController extends Controller ...@@ -119,7 +121,7 @@ class SwooleCommandMeTcpController extends Controller
if($type['status'] == 1 && $type['endtime'] == '' && $davicedata[1] == 1){ if($type['status'] == 1 && $type['endtime'] == '' && $davicedata[1] == 1){
$up = DB::table('reportpolice') $up = DB::table('reportpolice')
->where('devicenumber', '=', $davicedata[0]) ->where('devicenumber', '=', $davicedata[0])
->update(['endtime'=>time(),'status' => 2,'policestatus'=> $davicedata[1]]); ->update(['endtime'=>time(),'status' => 2]);
} }
if ($isdavice) { if ($isdavice) {
//改成报警状态 //改成报警状态
...@@ -131,7 +133,14 @@ class SwooleCommandMeTcpController extends Controller ...@@ -131,7 +133,14 @@ class SwooleCommandMeTcpController extends Controller
} else { } else {
if ($davicedata[1] != 1) { if ($davicedata[1] != 1) {
$add = DB::table('reportpolice') $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,
]);
} }
} }
......
...@@ -9,6 +9,7 @@ use App\Http\Controllers\Controller; ...@@ -9,6 +9,7 @@ use App\Http\Controllers\Controller;
use Illuminate\Support\Facades\Redis; use Illuminate\Support\Facades\Redis;
use App\Http\Controllers\DevicesController; use App\Http\Controllers\DevicesController;
use Illuminate\Support\Facades\Config; use Illuminate\Support\Facades\Config;
use App\Http\Controllers\Auth\SwooleCommandMeTcpController;
class ZehongTcpController extends Controller class ZehongTcpController extends Controller
{ {
...@@ -85,6 +86,11 @@ class ZehongTcpController extends Controller ...@@ -85,6 +86,11 @@ class ZehongTcpController extends Controller
//获取上报数据从数据库查询 //获取上报数据从数据库查询
public function mysqldb($data){ public function mysqldb($data){
if($data != []){ if($data != []){
// 报警提醒
$meTcp = new SwooleCommandMeTcpController();
$alarmData = $data['id'] . '/' . $data['status'] . '/' . $data['np'];
$meTcp->swooletcplist($alarmData);
$datainfo = DB::table('device') $datainfo = DB::table('device')
->where('devicenum','=',$data['id']) ->where('devicenum','=',$data['id'])
->update(['nd'=>intval($data['np']),'devicepolice'=>$data['status'] == 0 ? '1' : $data['status'],'update_time'=>time(),'shutoff_status'=>$data['famen']]); ->update(['nd'=>intval($data['np']),'devicepolice'=>$data['status'] == 0 ? '1' : $data['status'],'update_time'=>time(),'shutoff_status'=>$data['famen']]);
......
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