- Gửi email theo template cho 1 khách, tab lịch sử email, nhắc gia hạn dịch vụ hàng loạt - Mail lưu from/bcc/sent_by; mẫu MARKETING và mẫu cũ trong TemplateSeeder - Gói hosting: giới hạn, trạng thái, lấy plan Plesk qua CLI gateway - Backfill payment_method và ngày đơn hàng còn thiếu - Bổ sung field CPU/RAM/Disk/Băng thông cho loại sản phẩm vps và cloud Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
31 lines
892 B
PHP
31 lines
892 B
PHP
<?php
|
|
|
|
namespace App\Services\Plesk;
|
|
|
|
use App\Facades\BaseHelperFacade as BaseHelper;
|
|
use App\Models\DnsServer;
|
|
use Illuminate\Http\Client\PendingRequest;
|
|
use Illuminate\Support\Facades\Crypt;
|
|
use App\Support\TlsHttpClientFactory;
|
|
|
|
class PleskService
|
|
{
|
|
protected array $entryPoints = [
|
|
'clients' => ':8443/api/v2/clients',
|
|
'domains' => ':8443/api/v2/domains',
|
|
'cli' => ':8443/api/v2/cli',
|
|
];
|
|
|
|
public function client(DnsServer $server, int $timeout = 30): PendingRequest
|
|
{
|
|
return TlsHttpClientFactory::plesk()
|
|
->withBasicAuth($server->username, Crypt::decryptString($server->password))
|
|
->timeout($timeout);
|
|
}
|
|
|
|
public function url(DnsServer $server, string $entryPoint, string $suffix = ''): string
|
|
{
|
|
return BaseHelper::url($server->ip_address) . $this->entryPoints[$entryPoint] . $suffix;
|
|
}
|
|
}
|