feat(portal): lead module, WHMCS sync report/contacts/mapping, service lifecycle email templates

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
baodev0
2026-10-21 16:55:19 +07:00
co-authored by Claude Sonnet 5.5
parent 3c7710f1de
commit a443ec3bf6
66 changed files with 2032 additions and 124 deletions
@@ -0,0 +1,34 @@
<?php
namespace App\Console\Commands\Whmcs;
use App\Integrations\Whmcs\Support\CustomerIdResolver;
use App\Integrations\Whmcs\Support\SyncReport;
use App\Integrations\Whmcs\Writers\LeadWriter;
use Illuminate\Console\Command;
use Illuminate\Support\Facades\DB;
class SyncContactsCommand extends Command
{
protected $signature = 'whmcs:sync-contacts';
protected $description = 'Import WHMCS contacts (tblcontacts) into the Lead module, merging duplicate emails';
public function handle(CustomerIdResolver $customers, LeadWriter $writer): int
{
$contacts = DB::connection('whmcs')->table('tblcontacts')->orderBy('id');
$bar = $this->output->createProgressBar($contacts->count());
foreach ($contacts->cursor() as $contact) {
$writer->write($contact, $customers->resolve((int) $contact->userid));
$bar->advance();
}
$bar->finish();
$this->newLine();
$this->info('Đã nhập liên hệ vào khách tiềm năng (leads).');
app(SyncReport::class)->finish($this);
return Command::SUCCESS;
}
}