mirror of
https://gitee.com/ShopeX/ECShopX
synced 2026-08-04 19:26:23 +08:00
4.10.0
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "laravel/lumen",
|
||||
"version": "4.9.0",
|
||||
"version": "4.10.0",
|
||||
"description": "The Laravel Lumen Framework.",
|
||||
"keywords": [
|
||||
"framework",
|
||||
|
||||
@@ -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',
|
||||
];
|
||||
|
||||
@@ -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'],
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
47
tests/RegistrationRecordInfoShowFieldsStructureTest.php
Normal file
47
tests/RegistrationRecordInfoShowFieldsStructureTest.php
Normal file
@@ -0,0 +1,47 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* registration-record-show-fields:报名详情 activity_info 透传 show_fields(TC-1/TC-2)
|
||||
*/
|
||||
|
||||
use SelfserviceBundle\Services\RegistrationRecordService;
|
||||
|
||||
class RegistrationRecordInfoShowFieldsStructureTest extends TestCase
|
||||
{
|
||||
private function methodBody(string $class, string $method): string
|
||||
{
|
||||
$ref = new ReflectionMethod($class, $method);
|
||||
$file = $ref->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);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user