dataRange() ->catchSearch() ->append(['status_icon','status_text','last_online_time']) ->order([$this->aliasField('online_time')=> 'desc','wifi_online_time'=>'desc', $this->aliasField('id') => 'desc']) ->paginate(); return $res; } public function queryLocationList(){ $res = $this->dataRange() ->catchSearch() ->append(['status_icon','status_text','last_online_time']) ->order([$this->aliasField('online_time')=> 'desc','wifi_online_time'=>'desc', $this->aliasField('id') => 'desc']) ->select() ->each(function($item, $key) { if($item['online_time']<$item['wifi_online_time']){ $item['longitude']=$item['wifi_longitude']; $item['latitude']=$item['wifi_latitude']; } })->toArray(); return $res; } /** * 获取设备列表 */ public function getDeviceList($field, $order) { $res = $this->dataRange() ->catchSearch() ->append(['depart_name', 'device_state', 'alarm_state_text', 'bind_number', 'creator_user', 'model_text','net_state','loc_mode_text']) ->order($this->aliasField($field), $order) ->paginate(); return $res; } /** * 获取设备导出列表 */ public function getDevicesExportList() { $res = $this->dataRange() ->catchSearch() ->append(['depart_name', 'device_state', 'alarm_state_text', 'bind_number', 'creator_user', 'model_text','net_state','loc_mode_text','alarm_reason']) ->order($this->aliasField('id'), 'desc') ->select(); return $res; } }