Commit 23f5a4df authored by 冯超鹏's avatar 冯超鹏

tcp 协议更新

parent 6c421d6a
Pipeline #201 failed with stage
...@@ -8,6 +8,7 @@ use Illuminate\Http\Request; ...@@ -8,6 +8,7 @@ use Illuminate\Http\Request;
use App\Models\AlarmOrder; use App\Models\AlarmOrder;
use Illuminate\Support\Facades\DB; use Illuminate\Support\Facades\DB;
use App\Models\AlarmOrderSchedule; use App\Models\AlarmOrderSchedule;
use Illuminate\Support\Facades\Auth;
class AlarmOrderController extends Controller class AlarmOrderController extends Controller
{ {
...@@ -21,6 +22,9 @@ class AlarmOrderController extends Controller ...@@ -21,6 +22,9 @@ class AlarmOrderController extends Controller
if($this->isadmin()) { if($this->isadmin()) {
$limit = 20; $limit = 20;
$offset = $limit * ($request->input('page') - 1); $offset = $limit * ($request->input('page') - 1);
if($request->input('isuser') == 'user'){
$isuser = ['u.id','=',Auth::id()];
}
$orders = AlarmOrder::selectRaw(' $orders = AlarmOrder::selectRaw('
FROM_UNIXTIME(r.starttime) AS start_time, FROM_UNIXTIME(r.starttime) AS start_time,
FROM_UNIXTIME(r.endtime) AS end_time, FROM_UNIXTIME(r.endtime) AS end_time,
...@@ -35,6 +39,7 @@ class AlarmOrderController extends Controller ...@@ -35,6 +39,7 @@ class AlarmOrderController extends Controller
->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', '=', 'alarm_order.reportpolice_id')
->offset($offset) ->offset($offset)
->where($isuser)
->limit($limit) ->limit($limit)
->get()->toArray(); ->get()->toArray();
return $this->jsonSuccessData($orders); return $this->jsonSuccessData($orders);
......
...@@ -39,13 +39,8 @@ class ZehongTcpController extends Controller ...@@ -39,13 +39,8 @@ class ZehongTcpController extends Controller
if ($totcp == "暂无设备"){ if ($totcp == "暂无设备"){
return $totcp; return $totcp;
} }
if($totcp['nd'] < 999 ){
$totcp['nd'] = '0' . $totcp['nd']; $totcpdata = $totcp['devicenum'] . $totcp['shutoff_status'] . $devicechongqi . $devicezijian;
}
if($totcp['nd'] < 99 ){
$totcp['nd'] = '0' . $totcp['nd'];
}
$totcpdata = $totcp['devicenum'] .$totcp['devicepolice'] .$totcp['nd'] . $totcp['shutoff_status'] . $devicechongqi . $devicezijian;
$crcdata = $this->getPrc($totcpdata); $crcdata = $this->getPrc($totcpdata);
return $totcpdata .$crcdata ; return $totcpdata .$crcdata ;
} }
...@@ -92,7 +87,7 @@ class ZehongTcpController extends Controller ...@@ -92,7 +87,7 @@ class ZehongTcpController extends Controller
if($data != []){ if($data != []){
$datainfo = DB::table('device') $datainfo = DB::table('device')
->where('devicenum','=',$data['id']) ->where('devicenum','=',$data['id'])
->update(['nd'=>intval($data['np']),'shutoff_status'=>$data['famen'],'devicepolice'=>$data['status'] == 0 ? '1' : $data['status']]); ->update(['nd'=>intval($data['np']),'shutoff_status'=>$data['famen'],'devicepolice'=>$data['status'] == 0 ? '1' : $data['status'],'update_time'=>time()]);
$todata = DB::table('device') $todata = DB::table('device')
->where('devicenum','=',$data['id']) ->where('devicenum','=',$data['id'])
->select('devicenum','nd','shutoff_status','devicepolice') ->select('devicenum','nd','shutoff_status','devicepolice')
......
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