diff --git a/app/Http/Controllers/Front/PlatformLeadController.php b/app/Http/Controllers/Front/PlatformLeadController.php new file mode 100644 index 0000000..9059879 --- /dev/null +++ b/app/Http/Controllers/Front/PlatformLeadController.php @@ -0,0 +1,42 @@ +validate([ + 'name' => ['required', 'string', 'max:100'], + 'mobile' => ['nullable', 'string', 'max:30'], + 'email' => ['nullable', 'string', 'max:100'], + 'company' => ['nullable', 'string', 'max:100'], + 'plan_id' => ['nullable', 'integer', 'exists:plans,id'], + 'note' => ['nullable', 'string', 'max:2000'], + 'source' => ['nullable', 'string', 'max:50'], + ]); + + PlatformLead::query()->create([ + 'name' => (string) ($data['name'] ?? ''), + 'mobile' => (string) ($data['mobile'] ?? ''), + 'email' => (string) ($data['email'] ?? ''), + 'company' => (string) ($data['company'] ?? ''), + 'plan_id' => (int) ($data['plan_id'] ?? 0) ?: null, + 'note' => $data['note'] ?? null, + 'source' => (string) ($data['source'] ?? 'platform'), + 'status' => 'new', + 'meta' => [ + 'ip' => $request->ip(), + 'user_agent' => (string) $request->userAgent(), + ], + ]); + + return redirect('/platform/plans') + ->with('success', '已收到你的开通意向,我们会尽快联系你。'); + } +} diff --git a/app/Models/PlatformLead.php b/app/Models/PlatformLead.php new file mode 100644 index 0000000..0f7054b --- /dev/null +++ b/app/Models/PlatformLead.php @@ -0,0 +1,27 @@ + 'array', + ]; +} diff --git a/database/migrations/2026_03_14_022630_create_platform_leads_table.php b/database/migrations/2026_03_14_022630_create_platform_leads_table.php new file mode 100644 index 0000000..e899c90 --- /dev/null +++ b/database/migrations/2026_03_14_022630_create_platform_leads_table.php @@ -0,0 +1,45 @@ +id(); + + // 对外平台线索/开通意向(前期先承接 A:站点开通型) + $table->string('name', 100)->default(''); + $table->string('mobile', 30)->default(''); + $table->string('email', 100)->default(''); + $table->string('company', 100)->default(''); + $table->string('source', 50)->default('platform'); + $table->string('status', 30)->default('new'); + $table->text('note')->nullable(); + + // 预期套餐(可选) + $table->unsignedBigInteger('plan_id')->nullable()->index(); + + // 扩展字段:便于后续接入 B(license)或更复杂的开通信息 + $table->json('meta')->nullable(); + + $table->timestamps(); + + $table->index(['status', 'created_at']); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::dropIfExists('platform_leads'); + } +}; diff --git a/resources/views/platform/plans.blade.php b/resources/views/platform/plans.blade.php index 4030385..50a461e 100644 --- a/resources/views/platform/plans.blade.php +++ b/resources/views/platform/plans.blade.php @@ -22,7 +22,7 @@