#add jira & message sync
This commit is contained in:
37
app/Clients/AgentClient.php
Normal file
37
app/Clients/AgentClient.php
Normal file
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
|
||||
namespace App\Clients;
|
||||
|
||||
use Illuminate\Support\Facades\Http;
|
||||
use Illuminate\Http\Client\PendingRequest;
|
||||
use Illuminate\Http\Client\Response;
|
||||
|
||||
class AgentClient
|
||||
{
|
||||
private string $baseUrl;
|
||||
private PendingRequest $http;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->baseUrl = config('services.agent.url');
|
||||
$this->http = Http::timeout(config('services.agent.timeout', 30))
|
||||
->withoutVerifying();
|
||||
}
|
||||
|
||||
/**
|
||||
* 分发消息到Agent
|
||||
*/
|
||||
public function dispatchMessage(array $data): Response
|
||||
{
|
||||
return $this->http->post($this->baseUrl . '/rpc/dispatchMessage', $data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 测试连接
|
||||
*/
|
||||
public function testConnection(): Response
|
||||
{
|
||||
return $this->http->get($this->baseUrl . '/health');
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user