1
0
Fork 0

Compare commits

..

No commits in common. "b01e8e9aac506b81762759713e737457e0370af6" and "8da20ed9adb496fc3346159a132bce94941ef630" have entirely different histories.

2 changed files with 4 additions and 6 deletions

View File

@ -7,7 +7,7 @@ use Illuminate\Foundation\Bus\DispatchesJobs;
use Illuminate\Foundation\Validation\ValidatesRequests;
use Illuminate\Routing\Controller as BaseController;
use Illuminate\Pagination\LengthAwarePaginator;
use Illuminate\Http\Resources\Json\ResourceCollection;
use Illuminate\Http\Resources\Json\ResourceCollection ;
use Illuminate\Support\Arr;
class Controller extends BaseController
@ -16,7 +16,7 @@ class Controller extends BaseController
public function json($data, $code = 0, $message = '')
{
if ($data instanceof ResourceCollection) {
if ($data instanceof ResourceCollection ) {
$data = $data->resource;
}
$result = ['data' => $data ?: '', 'status' => $code, 'msg' => $message];

View File

@ -35,11 +35,9 @@ class DeviceService extends BaseService
$url = data_get($item->extends, $history ? 'rtsp_history' : 'rtsp_url');
$src = null;
if ($base && $url) {
// 查看历史监控 &starttime=2023_02_02_14_00_00&endtime=2023_02_02_15_00_00
// 查看历史监控
if ($history && $start && $end) {
$start_format = Carbon::createFromTimestamp($start)->startOfDay()->format('Y_m_d_H_i_s');
$end_format = Carbon::createFromTimestamp($end)->endOfDay()->format('Y_m_d_H_i_s');
$url .= (str_contains($url, '?') ? '&' : '?') .'starttime=' . $start_format . '&endtime=' . $end_format;
$url .= '?start=' . date('Y-m-d', $start) . '&end=' . data('Y-m-d', $end);
}
$src = $base . base64_encode($url);
}