|
@@ -302,8 +302,8 @@ class ScreenController extends BaseController
|
|
|
$list = DeviceData::where('crt_time','>=',$start)->wherein('dev_eui',$key)->select(DB::raw("DATE_FORMAT(FROM_UNIXTIME(crt_time), '%Y-%m-%d %H:%i') as c"),'device_name','happening_data')->get()->toArray();
|
|
|
if(empty($list)) {
|
|
|
$time = DeviceData::max('crt_time');
|
|
|
- $time = $time-8000;
|
|
|
- $list = DeviceData::where('crt_time','>=',$time)->wherein('dev_eui',$key)->select(DB::raw("DATE_FORMAT(FROM_UNIXTIME(crt_time), '%Y-%m-%d %H:%i') as c"),'device_name','happening_data')->get()->toArray();
|
|
|
+ $s_time = $time-8000;
|
|
|
+ $list = DeviceData::where('crt_time','>=',$s_time)->wherein('dev_eui',$key)->select(DB::raw("DATE_FORMAT(FROM_UNIXTIME(crt_time), '%Y-%m-%d %H:%i') as c"),'device_name','happening_data')->get()->toArray();
|
|
|
}
|
|
|
|
|
|
$list_key = [];
|
|
@@ -319,8 +319,12 @@ class ScreenController extends BaseController
|
|
|
// die('ss');
|
|
|
$time_list = [];
|
|
|
$data_key = [];
|
|
|
- if(! empty($time)) $start = $time;
|
|
|
- for ($i=$start;$i<time();$i= $i+60){
|
|
|
+ $count = time();
|
|
|
+ if(! empty($time)) {
|
|
|
+ $start = $s_time;
|
|
|
+ $count = $time;
|
|
|
+ }
|
|
|
+ for ($i=$start;$i<$count;$i= $i+60){
|
|
|
$time_key = date('Y-m-d H:i',$i);
|
|
|
$time_list[] = $time_key;
|
|
|
foreach ($device_key as $v){
|