Files
toolbox/app/Clients/MonoClient.php
2025-12-02 10:16:32 +08:00

38 lines
821 B
PHP

<?php
namespace App\Clients;
use Illuminate\Support\Facades\Http;
use Illuminate\Http\Client\PendingRequest;
use Illuminate\Http\Client\Response;
class MonoClient
{
private string $baseUrl;
private PendingRequest $http;
public function __construct()
{
$this->baseUrl = config('services.mono.url');
$this->http = Http::timeout(config('services.mono.timeout', 30))
->withoutVerifying();
}
/**
* 测试连接
*/
public function testConnection(): Response
{
return $this->http->get($this->baseUrl . '/health');
}
/**
* 更新消息分发状态
*/
public function updateDispatch(array $data): Response
{
return $this->http->post($this->baseUrl . '/rpc/datadispatch/message/update-dispatch', $data);
}
}