From 449d51c8bde47ff4ef404777437b58ca8a77f8ff Mon Sep 17 00:00:00 2001 From: wanghai Date: Fri, 24 Jul 2026 17:52:44 +0800 Subject: [PATCH] 4.10.0 --- composer.json | 2 +- config/langue.php | 2 +- .../Services/RegistrationRecordService.php | 16 +++---- ...ationRecordInfoShowFieldsStructureTest.php | 47 +++++++++++++++++++ 4 files changed, 56 insertions(+), 11 deletions(-) create mode 100644 tests/RegistrationRecordInfoShowFieldsStructureTest.php diff --git a/composer.json b/composer.json index d0d7e32..d4ea997 100644 --- a/composer.json +++ b/composer.json @@ -1,6 +1,6 @@ { "name": "laravel/lumen", - "version": "4.9.0", + "version": "4.10.0", "description": "The Laravel Lumen Framework.", "keywords": [ "framework", diff --git a/config/langue.php b/config/langue.php index 5ec406e..c48a493 100644 --- a/config/langue.php +++ b/config/langue.php @@ -7,6 +7,6 @@ * 兼容:若仍按纯数组读取,请使用 config('langue.list') 或由 CommonLangModService 解析。 */ return [ - 'list' => ['zh-CN', 'en-CN', 'ar-SA'], + 'list' => ['zh-CN', 'en-CN', 'ar-SA','zh-TW'], 'default' => 'zh-CN', ]; diff --git a/src/SelfserviceBundle/Services/RegistrationRecordService.php b/src/SelfserviceBundle/Services/RegistrationRecordService.php index 2aad5d0..0527f83 100644 --- a/src/SelfserviceBundle/Services/RegistrationRecordService.php +++ b/src/SelfserviceBundle/Services/RegistrationRecordService.php @@ -238,22 +238,18 @@ class RegistrationRecordService $activityIds = array_column($lists['list'], 'activity_id'); $registrationActivityService = new RegistrationActivityService(); - $ayList = $registrationActivityService->entityRepository->getLists(['activity_id' => $activityIds], 'activity_id, activity_name,start_time,end_time,join_limit,is_sms_notice,is_wxapp_notice,pics,intro,is_allow_duplicate,address,place,area'); + $ayList = $registrationActivityService->entityRepository->getLists(['activity_id' => $activityIds], 'activity_id, activity_name,start_time,end_time,join_limit,is_sms_notice,is_wxapp_notice,pics,intro,is_allow_duplicate,address,place,area,show_fields'); $aylist = array_column($ayList, null, 'activity_id'); - $week_data = ['日', '一', '二', '三', '四', '五', '六']; $addressService = new AddressService(); foreach ($lists['list'] as &$v) { $activity_info = $aylist[$v['activity_id']] ?? []; if ($activity_info) { $registrationActivityService->getStatusName($activity_info); - //活动开始时间 - $start_time = ''; - if ($activity_info['start_time']) { - $week_no = date('w', $activity_info['start_time']); - $week_name = $week_data[$week_no]; - $start_time = date("Y-m-d {$week_name} H:i", $activity_info['start_time']); - } + //活动开始时间(与 start_date 一致:Y-m-d H:i:s) + $start_time = $activity_info['start_time'] + ? date('Y-m-d H:i:s', $activity_info['start_time']) + : ''; $area_name = $addressService->getAreaName($activity_info['area']); @@ -268,6 +264,7 @@ class RegistrationRecordService 'status_name' => $activity_info['status_name'], 'area' => $activity_info['area'], 'area_name' => $area_name, + 'show_fields' => $activity_info['show_fields'], ]; } $v['record_no'] = str_pad($v['record_no'], 4, '0', STR_PAD_LEFT); @@ -343,6 +340,7 @@ class RegistrationRecordService 'status_name' => $activity_info['status_name'], 'area' => $activity_info['area'], 'area_name' => $area_name, + 'show_fields' => $activity_info['show_fields'], ]; } diff --git a/tests/RegistrationRecordInfoShowFieldsStructureTest.php b/tests/RegistrationRecordInfoShowFieldsStructureTest.php new file mode 100644 index 0000000..2427f25 --- /dev/null +++ b/tests/RegistrationRecordInfoShowFieldsStructureTest.php @@ -0,0 +1,47 @@ +getFileName(); + $this->assertNotFalse($file); + $lines = file($file, FILE_IGNORE_NEW_LINES); + $this->assertIsArray($lines); + $slice = array_slice($lines, $ref->getStartLine() - 1, $ref->getEndLine() - $ref->getStartLine() + 1); + + return implode("\n", $slice); + } + + /** + * TC-1:getRocordInfo 方法体透传 show_fields,且不对 show_fields 做 json_decode。 + */ + public function testGetRocordInfoActivityInfoPassesShowFieldsWithoutJsonDecode(): void + { + $body = $this->methodBody(RegistrationRecordService::class, 'getRocordInfo'); + $this->assertStringContainsString("'show_fields' => \$activity_info['show_fields']", $body); + $this->assertStringNotContainsString("json_decode(\$activity_info['show_fields']", $body); + $this->assertStringNotContainsString('json_decode($activity_info["show_fields"]', $body); + } + + /** + * TC-2:getRocordInfo 保留既有字段;getRocordList 同样透传 show_fields。 + */ + public function testGetRocordInfoKeepsExistingFieldsAndListDoesNotPassShowFields(): void + { + $infoBody = $this->methodBody(RegistrationRecordService::class, 'getRocordInfo'); + $this->assertStringContainsString("'is_offline_verify' => \$activity_info['is_offline_verify']", $infoBody); + $this->assertStringContainsString("'area_name' => \$area_name", $infoBody); + + $listBody = $this->methodBody(RegistrationRecordService::class, 'getRocordList'); + $this->assertStringContainsString("'show_fields' => \$activity_info['show_fields']", $listBody); + $this->assertStringNotContainsString("json_decode(\$activity_info['show_fields']", $listBody); + } +}