停车场系统数据中间件
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

57 lines
1.6 KiB

<?php
namespace App\Console\Commands;
use App\Services\Api\CameraApiService;
use App\Services\Device\CameraDeviceService;
use Illuminate\Console\Command;
/**
* 检测设备状态信息
*/
class SetCameraData extends Command
{
/**
* The name and signature of the console command.
* @var string
*/
protected $signature = 'run:set-camera-data';
/**
* The console command description.
* @var string
*/
protected $description = 'Command description';
/**
* Execute the console command.
*/
public function handle()
{
// 获取所有设备信息
$response = CameraApiService::query()->getCameraBody();
if ($response) {
if (isset($response['error']) && $response['error'] < 1) {
$body = $response['body'];
foreach ($body['list'] as $item) {
// 通过设备信息获取设备状态
$ip = $item['ip'];
$color_occupy = $item['color_occupy'];
$color_vacant = $item['color_vacant'];
$is_flicker = $item['is_flicker'];
$service = CameraDeviceService::query($ip)->setColor(
$color_occupy,
$color_vacant,
$is_flicker
);
// 返回告诉设备状态情况
}
} else {
echo $response['message'] ?? '';
exit;
}
}
echo 'SUCCESS';
exit;
}
}