feat: Implement Plesk domain and hosting services
- Added PleskDomainService for managing domain operations (create, update, remove, get info). - Introduced PleskHostingService for provisioning hosting accounts and notifying customers. - Created PleskService for handling API requests to Plesk. - Added migration to include 'type' column in dns_manager_servers table. - Created migration for module_hosting_accounts table to track hosting subscriptions. - Created migration for module_hosting_plesk_clients table to manage Plesk client credentials. - Added email templates for notifying customers and admins about hosting account creation.
This commit is contained in:
@@ -0,0 +1,54 @@
|
||||
<?php
|
||||
|
||||
namespace App\Jobs\Mail\Customer;
|
||||
|
||||
use App\Mail\Customer\HostingAccountCreated;
|
||||
use Illuminate\Bus\Queueable;
|
||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||
use Illuminate\Foundation\Bus\Dispatchable;
|
||||
use Illuminate\Queue\InteractsWithQueue;
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use Illuminate\Support\Facades\Mail;
|
||||
|
||||
class HostingAccountCreatedJob implements ShouldQueue
|
||||
{
|
||||
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
|
||||
|
||||
public int $tries = 3;
|
||||
|
||||
public array $data;
|
||||
|
||||
public function __construct(array $data)
|
||||
{
|
||||
$this->data = $data;
|
||||
}
|
||||
|
||||
public function handle(): void
|
||||
{
|
||||
if (empty($this->data['customer_email'])) {
|
||||
Log::warning('HostingAccountCreatedJob: missing customer_email, skipped.', [
|
||||
'domain_name' => $this->data['domain_name'] ?? null,
|
||||
]);
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
Mail::to($this->data['customer_email'])
|
||||
->send(new HostingAccountCreated($this->data));
|
||||
} catch (\Throwable $e) {
|
||||
Log::error('Không thể gửi email thông báo khởi tạo hosting: ' . $e->getMessage(), [
|
||||
'customer_email' => $this->data['customer_email'] ?? null,
|
||||
'domain_name' => $this->data['domain_name'] ?? null,
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
public function failed(\Throwable $e): void
|
||||
{
|
||||
Log::error('HostingAccountCreatedJob: job failed.', [
|
||||
'error' => $e->getMessage(),
|
||||
'domain_name' => $this->data['domain_name'] ?? null,
|
||||
]);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user