Files
portal-api/app/Services/Plesk/PleskService.php
baodev0andClaude Sonnet 5.5 55a834a2f8 feat: nhắc gia hạn QR theo dịch vụ, failover server hosting, CCCD admin, log cấp phát dịch vụ
- Mail campaign: mẫu nhắc gia hạn thanh toán QR, chọn dịch vụ + chu kỳ từng dòng (renewal_services)
- Hosting: nhiều server Plesk cho một gói (service_plan_servers), chuyển server khi server chết
- Admin xem/sửa giấy tờ định danh khách, tuỳ chọn gia hạn cho khách, nhật ký cấp phát dịch vụ
- Đánh dấu mẫu email dịch vụ là non-marketing

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-30 18:36:41 +07:00

32 lines
936 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',
'server' => ':8443/api/v2/server',
];
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;
}
}