feat: email gửi tay/nhắc gia hạn, gói hosting, sửa dữ liệu sản phẩm
- 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>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
8651dde6b1
commit
30898ea46f
@@ -0,0 +1,39 @@
|
||||
<?php
|
||||
|
||||
namespace App\Services\Plesk;
|
||||
|
||||
use App\Models\DnsServer;
|
||||
use Illuminate\Http\Client\ConnectionException;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
|
||||
class PleskServicePlanService
|
||||
{
|
||||
public function __construct(private PleskService $plesk)
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* @return list<string>|null
|
||||
*/
|
||||
public function names(DnsServer $server): ?array
|
||||
{
|
||||
try {
|
||||
$response = $this->plesk->client($server, 15)
|
||||
->post($this->plesk->url($server, 'cli', '/service_plan/call'), ['params' => ['--list']]);
|
||||
} catch (ConnectionException $e) {
|
||||
Log::error('Plesk service plan list failed', ['error' => $e->getMessage(), 'server_id' => $server->id]);
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
if (!$response->successful() || (int) $response->json('code', 1) !== 0) {
|
||||
Log::error('Plesk service plan list failed', ['status' => $response->status(), 'server_id' => $server->id]);
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
$lines = preg_split('/\R/', (string) $response->json('stdout', ''));
|
||||
|
||||
return array_values(array_unique(array_filter(array_map('trim', $lines), 'strlen')));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user