|
@@ -347,10 +347,13 @@ class ScreenController extends BaseController
|
|
|
|
|
|
//明细
|
|
|
$request = $request->all();
|
|
|
- $start = isset($request['start_time']) ? $request['start_time'] : time()-864000;
|
|
|
+// $start = isset($request['start_time']) ? $request['start_time'] : time()-864000;
|
|
|
// $end = isset($request['start_time']) ? $request['start_time'] : time();
|
|
|
$key = DeviceSite::where('site',1)->wherein('title',['急停'])->groupBy('key')->pluck('key')->toArray();
|
|
|
- $list = DeviceData::where('crt_time','>=',$start)->wherein('dev_eui',$key)->where('happening_data',1)->select('crt_time','device_name','happening_data')->get()->toArray();
|
|
|
+ $list = DeviceData::wherein('dev_eui',$key)->where('happening_data',1)->select('crt_time','device_name','happening_data');
|
|
|
+// $list = $this->limi
|
|
|
+ $list = $list->paginate(50, '*', 'page', 1)->toArray();
|
|
|
+ $list = $list['data'];
|
|
|
foreach ($list as &$v){
|
|
|
$v['device_name'] = substr(str_replace('广西大王椰','',$v['device_name']),0,19);
|
|
|
$v['crt_time'] = date('Y-m-d H:i:s',$v['crt_time']);
|
|
@@ -362,10 +365,12 @@ class ScreenController extends BaseController
|
|
|
|
|
|
public function gzEchart(){
|
|
|
|
|
|
- $start = time()-864000;
|
|
|
+// $start = time()-864000;
|
|
|
// $end = isset($request['start_time']) ? $request['start_time'] : time();
|
|
|
$key = DeviceSite::where('site',1)->wherein('title',['急停'])->groupBy('key')->pluck('key')->toArray();
|
|
|
- $list = DeviceData::where('crt_time','>=',$start)->wherein('dev_eui',$key)->where('happening_data',1)->select(DB::raw("DATE_FORMAT(FROM_UNIXTIME(crt_time), '%Y-%m-%d %H') as c") ,DB::raw("count(id) as s"),'device_name','happening_data')->groupBy('dev_eui')->groupBy(DB::raw("DATE_FORMAT(FROM_UNIXTIME(crt_time), '%Y-%m-%d %H')"))->get()->toArray();
|
|
|
+ $list = DeviceData::wherein('dev_eui',$key)->where('happening_data',1)->select(DB::raw("DATE_FORMAT(FROM_UNIXTIME(crt_time), '%Y-%m-%d %H') as c") ,DB::raw("count(id) as s"),'device_name','happening_data')->groupBy('dev_eui')->groupBy(DB::raw("DATE_FORMAT(FROM_UNIXTIME(crt_time), '%Y-%m-%d %H')"));
|
|
|
+ $list = $list->paginate(50, '', 'page', 1)->toArray();
|
|
|
+ $list = $list['data'];
|
|
|
$list_key = [];
|
|
|
$device_key = [];
|
|
|
$time_list = [];
|