|
@@ -448,6 +448,11 @@ class ScreenController extends BaseController
|
|
|
// $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)->select(DB::raw('count(1) as count'),'device_name')->groupBy('dev_eui')->get()->toArray();
|
|
|
+ if(empty($list)){
|
|
|
+ $time = DeviceData::max('crt_time');
|
|
|
+ $s_time = $time-100000;
|
|
|
+ $list = DeviceData::where('crt_time','>=',$s_time)->wherein('dev_eui',$key)->select(DB::raw('count(1) as count'),'device_name')->groupBy('dev_eui')->get()->toArray();
|
|
|
+ }
|
|
|
foreach ($list as &$v){
|
|
|
$v['device_name'] = substr(str_replace('广西大王椰','',$v['device_name']),0,19);
|
|
|
}
|