feat(vm): hoàn tiền khi cấp VM lỗi, theo dõi job queue, uuid dịch vụ cho ticket, chuẩn hoá RAM addon

- VmProvisionException/VmProvisionRefund xử lý lỗi cấp phát VM
- QueueJobInspector + QueueMonitorController xem chi tiết job
- Thêm service uuid cho ticket, thời lượng cho activity_logs
- Migration chuẩn hoá RAM addon sang MB, trạng thái deleting cho snapshot

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
baodev0
2026-10-30 11:54:05 +07:00
co-authored by Claude Sonnet 5.5
parent 7136bec265
commit 62596d9063
32 changed files with 514 additions and 107 deletions
+37 -10
View File
@@ -34,11 +34,44 @@ class ServiceRenewalNotifier
return;
}
$data = $this->payload(
$service,
$invoice,
$months,
$previousExpiresAt,
$payment === 'balance' ? 'Trừ số dư tài khoản' : 'Đã thu ngoài hệ thống',
) + ['admin_name' => $adminName];
AutoEmailGate::markManual();
$this->safely(fn () => $this->sendToCustomer($service, $data, $adminId));
$this->safely(fn () => $this->sendToAdmin($data));
}
public function notifyCustomerRenewal(
Service $service,
Invoice $invoice,
int $months,
?CarbonInterface $previousExpiresAt,
): void {
if (! AutoEmailGate::allows(self::CUSTOMER_SCENARIO)) {
return;
}
$paymentLabel = $invoice->payment_method === 'balance' ? 'Trừ số dư tài khoản' : (string) ($invoice->payment_method ?: 'N/A');
$data = $this->payload($service, $invoice, $months, $previousExpiresAt, $paymentLabel);
$this->safely(fn () => $this->sendToCustomer($service, $data, null));
}
private function payload(Service $service, Invoice $invoice, int $months, ?CarbonInterface $previousExpiresAt, string $paymentLabel): array
{
$service->loadMissing(['customer', 'product']);
$customer = $service->customer;
$serverName = (string) $service->server_name;
$amount = number_format((float) $invoice->total, 0, ',', '.') . ' VNĐ';
$data = [
return [
'client_name' => $customer->fullname ?? '',
'customer_name' => $customer->fullname ?? '',
'customer_email' => $customer->email ?? '',
@@ -48,16 +81,10 @@ class ServiceRenewalNotifier
'old_expires_at' => $previousExpiresAt?->format('d/m/Y') ?? 'N/A',
'expires_at' => $service->expires_at?->format('d/m/Y') ?? 'N/A',
'invoice_number' => $invoice->invoice_number,
'amount_formatted' => number_format((float) $invoice->total, 0, ',', '.') . ' VNĐ',
'payment_method_label' => $payment === 'balance' ? 'Trừ số dư tài khoản' : 'Đã thu ngoài hệ thống',
'admin_name' => $adminName,
'price_row' => EmailTemplateShell::row('Số tiền gia hạn', number_format((float) $invoice->total, 0, ',', '.') . ' VNĐ'),
'amount_formatted' => $amount,
'payment_method_label' => $paymentLabel,
'price_row' => EmailTemplateShell::row('Số tiền gia hạn', $amount),
];
AutoEmailGate::markManual();
$this->safely(fn () => $this->sendToCustomer($service, $data, $adminId));
$this->safely(fn () => $this->sendToAdmin($data));
}
private function sendToCustomer(Service $service, array $data, ?int $adminId): void