diff --git a/app/app/Console/Commands/SalesProspectsDemoSeed.php b/app/app/Console/Commands/SalesProspectsDemoSeed.php new file mode 100644 index 00000000..269c79b0 --- /dev/null +++ b/app/app/Console/Commands/SalesProspectsDemoSeed.php @@ -0,0 +1,51 @@ +argument('salesUserId'); + $user = SalesUser::find($id); + if ($user === null) { + $this->error("sales_user #{$id} не найден"); + + return self::FAILURE; + } + + $stages = ['new', 'negotiation', 'registered', 'testing', 'topped_up', 'user', 'rejected', 'no_answer']; + foreach ($stages as $stage) { + for ($i = 1; $i <= 2; $i++) { + SalesProspect::factory()->for($user, 'salesUser')->create([ + 'stage' => $stage, + 'assigned_by' => $user->id, + 'next_call_at' => $stage === 'negotiation' ? now()->addDay() : null, + 'reason' => in_array($stage, ['rejected', 'no_answer'], true) ? 'демо-причина' : null, + 'registered_email' => in_array($stage, ['registered', 'testing', 'topped_up', 'user'], true) + ? 'demo'.$i.'@example.com' : null, + ]); + } + } + + $this->info("Готово: 16 демо-карточек для {$user->name}"); + + return self::SUCCESS; + } +} diff --git a/app/phpstan-baseline.neon b/app/phpstan-baseline.neon index fa8d2c20..6f40e543 100644 --- a/app/phpstan-baseline.neon +++ b/app/phpstan-baseline.neon @@ -3996,6 +3996,12 @@ parameters: count: 2 path: tests/Feature/Sales/SalesProspectApiTest.php + - + message: '#^Call to an undefined method Pest\\PendingCalls\\TestCall\:\:artisan\(\)\.$#' + identifier: method.notFound + count: 1 + path: tests/Feature/Sales/SalesProspectsDemoSeedTest.php + - message: '#^Call to an undefined method Pest\\PendingCalls\\TestCall\:\:artisan\(\)\.$#' identifier: method.notFound diff --git a/app/tests/Feature/Sales/SalesProspectsDemoSeedTest.php b/app/tests/Feature/Sales/SalesProspectsDemoSeedTest.php new file mode 100644 index 00000000..dbf90855 --- /dev/null +++ b/app/tests/Feature/Sales/SalesProspectsDemoSeedTest.php @@ -0,0 +1,21 @@ + 'Демо '.uniqid(), 'email' => 'demo'.uniqid().'@s.local', + 'password' => bcrypt('x'), 'role' => 'manager', 'is_active' => true, + ]); + + $this->artisan('sales:prospects-demo', ['salesUserId' => $mgr->id])->assertExitCode(0); + + $stages = SalesProspect::where('sales_user_id', $mgr->id)->pluck('stage')->unique(); + expect($stages)->toContain('new')->toContain('negotiation')->toContain('testing')->toContain('user'); +}); diff --git a/docs/observer/STATUS.md b/docs/observer/STATUS.md index 0ac65e94..66dfbfe5 100644 --- a/docs/observer/STATUS.md +++ b/docs/observer/STATUS.md @@ -1,6 +1,6 @@ # Brain Status (auto-generated) -Last updated: 2026-07-15T13:25:11.930Z +Last updated: 2026-07-15T13:33:42.226Z | Контролёр | Состояние | Детали | |---|---|---| @@ -112,8 +112,8 @@ Episodes since last run: 542 / threshold: 10 | PID | Имя | CPU-время | Возраст | |---|---|---|---| -| 3488 | MsMpEng | 6.88ч | 0.0ч | -| 9756 | Code | 3.16ч | NaNч | +| 3488 | MsMpEng | 6.90ч | 0.0ч | +| 9756 | Code | 3.17ч | NaNч | | 1320 | svchost | 1.33ч | 0.0ч | ⚠️ Проверь, не «осиротевшие» ли это процессы от завершённых Claude-сессий.