From bd154f39f221f8e0239cd52e3e3ccfd378ecccc6 Mon Sep 17 00:00:00 2001 From: weizong song Date: Sat, 6 Jun 2026 10:40:26 +0800 Subject: [PATCH] up --- app/Http/Controllers/ChannelEntryController.php | 6 +++++- tests/Feature/ChannelSignupIntegrationTest.php | 5 +++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/app/Http/Controllers/ChannelEntryController.php b/app/Http/Controllers/ChannelEntryController.php index 7e94092..eb88ec3 100644 --- a/app/Http/Controllers/ChannelEntryController.php +++ b/app/Http/Controllers/ChannelEntryController.php @@ -40,10 +40,11 @@ class ChannelEntryController extends Controller [$user, $application, $token] = DB::transaction(function () use ($channel, $competition, $parameters): array { $enteredAt = now(); + $name = $this->nullableTrimmed($parameters['name']); $company = $this->nullableTrimmed($parameters['company_name']); $user = User::query()->firstOrCreate( ['mobile' => $parameters['mobile']], - ['name' => null, 'email' => null, 'company' => $company, 'password' => null] + ['name' => $name, 'email' => null, 'company' => $company, 'password' => null] ); if ($user->wasRecentlyCreated) { @@ -59,6 +60,9 @@ class ChannelEntryController extends Controller 'last_channel_code' => $channel->channel_code, 'last_channel_entered_at' => $enteredAt, ]; + if ($name !== null) { + $userPayload['name'] = $name; + } if ($company !== null) { $userPayload['company'] = $company; } diff --git a/tests/Feature/ChannelSignupIntegrationTest.php b/tests/Feature/ChannelSignupIntegrationTest.php index 061ee7f..1e21d0c 100644 --- a/tests/Feature/ChannelSignupIntegrationTest.php +++ b/tests/Feature/ChannelSignupIntegrationTest.php @@ -165,6 +165,7 @@ class ChannelSignupIntegrationTest extends TestCase $this->assertSame('CHANNEL-A', $user->first_channel_code); $this->assertSame('CHANNEL-A', $user->last_channel_code); + $this->assertSame('张三', $user->name); $this->assertSame('测试企业', $user->company); $this->assertSame('CHANNEL-A', $application->signup_channel_code); $this->assertSame('draft', $application->status); @@ -205,6 +206,7 @@ class ChannelSignupIntegrationTest extends TestCase $this->get('/channel-entry?'.http_build_query($legacyParameters)) ->assertOk() ->assertSee('/admin/c/main-event/apply', false); + $this->assertSame('旧渠道用户', User::query()->where('mobile', '13600136000')->value('name')); $this->assertSame('旧渠道企业', User::query()->where('mobile', '13600136000')->value('company')); $legacyParameters['company_name'] = '旧渠道&企业'; $legacyParameters['hash'] = ChannelEntrySignature::make($legacyParameters, $legacyChannel->shared_secret); @@ -259,6 +261,7 @@ class ChannelSignupIntegrationTest extends TestCase ])->save(); $this->get('/channel-entry?'.http_build_query($this->signed($channelB, [ + 'name' => '李四', 'company_name' => '新渠道企业', 'state' => 'state-B', ]))) @@ -268,9 +271,11 @@ class ChannelSignupIntegrationTest extends TestCase $application->refresh(); $this->assertSame('CHANNEL-A', $user->first_channel_code); $this->assertSame('CHANNEL-B', $user->last_channel_code); + $this->assertSame('李四', $user->name); $this->assertSame('新渠道企业', $user->company); $this->assertSame('CHANNEL-B', $application->signup_channel_code); $this->assertSame('state-B', $application->signup_channel_state); + $this->assertSame('保留姓名', $application->player_name); $this->assertSame('保留企业', $application->company_name); $this->assertSame('保留项目', $application->project_name);