This commit is contained in:
gaofeng
2026-08-12 17:58:56 +08:00
parent fd35f78fa7
commit 21b32e11c1
4 changed files with 30 additions and 5 deletions

View File

@@ -77,7 +77,11 @@ final class CustomerCenter extends Base
if ($applicantId <= 0) { if ($applicantId <= 0) {
return $this->fail('参数错误'); return $this->fail('参数错误');
} }
$result = (new CustomerCenterService())->applicant($userId, $applicantId); $result = (new CustomerCenterService())->applicant(
$userId,
$applicantId,
(bool)$this->request->param('include_materials', false)
);
if ((int)($result['code'] ?? 0) !== 1) { if ((int)($result['code'] ?? 0) !== 1) {
return $this->fail((string)($result['msg'] ?? '服务异常,请稍后重试')); return $this->fail((string)($result['msg'] ?? '服务异常,请稍后重试'));
} }

View File

@@ -9,6 +9,16 @@ class Upload extends Base
{ {
public function image() public function image()
{ {
$scene = strtolower(trim((string)$this->request->post('scene', '')));
$contactUserId = 0;
if (in_array($scene, ['passport', 'id_card'], true)) {
$login = $this->requireLogin();
if (!is_int($login)) {
return $login;
}
$contactUserId = $login;
}
$file = request()->file('file'); $file = request()->file('file');
if (!$file) { if (!$file) {
return $this->fail('请上传图片'); return $this->fail('请上传图片');
@@ -45,6 +55,9 @@ class Upload extends Base
} }
$fileName = date('YmdHis') . uniqid('', true) . '.' . $ext; $fileName = date('YmdHis') . uniqid('', true) . '.' . $ext;
$objectKey = $contactUserId > 0
? 'contact/' . $contactUserId . '/' . $fileName
: $fileName;
try { try {
$client = SwooleService::getInstance(); $client = SwooleService::getInstance();
@@ -52,7 +65,7 @@ class Upload extends Base
'type' => 'upload_ali', 'type' => 'upload_ali',
'data' => [ 'data' => [
'Bucket' => BUCKET, 'Bucket' => BUCKET,
'Key' => $fileName, 'Key' => $objectKey,
'file_content' => base64_encode($content), 'file_content' => base64_encode($content),
], ],
]); ]);
@@ -62,7 +75,7 @@ class Upload extends Base
return $this->fail('上传失败,请重试'); return $this->fail('上传失败,请重试');
} }
$url = OSS_URL . $fileName; $url = OSS_URL . $objectKey;
return $this->ok([ return $this->ok([
'path' => $url, 'path' => $url,
'url' => $url, 'url' => $url,

View File

@@ -30,9 +30,12 @@ final class CustomerCenterService
]); ]);
} }
public function applicant(int $userId, int $applicantId): array public function applicant(int $userId, int $applicantId, bool $includeMaterials = false): array
{ {
return $this->request('applicant', $userId, ['applicant_id' => $applicantId]); return $this->request('applicant', $userId, [
'applicant_id' => $applicantId,
'include_materials' => $includeMaterials ? 1 : 0,
]);
} }
public function saveApplicant(int $userId, array $params): array public function saveApplicant(int $userId, array $params): array

View File

@@ -19,6 +19,11 @@ customerCenterProxyAssertSame([
'user_id' => 42, 'user_id' => 42,
'page' => 2, 'page' => 2,
], $service->payload(42, ['page' => 2]), 'The proxy request must use the original unsigned parameter style'); ], $service->payload(42, ['page' => 2]), 'The proxy request must use the original unsigned parameter style');
$materialsJson = '[{"material_type":"passport","oss_url":"https://files.jzvisa.com/jnevus/contact/42/passport.jpg"}]';
customerCenterProxyAssertSame([
'user_id' => 42,
'materials_json' => $materialsJson,
], $service->payload(42, ['materials_json' => $materialsJson]), 'The proxy must preserve the compact material JSON payload');
customerCenterProxyAssertSame( customerCenterProxyAssertSame(
'https://uniuser.jzvisa.com/home/customer_center/applications', 'https://uniuser.jzvisa.com/home/customer_center/applications',
$service->endpoint('https://uniuser.jzvisa.com/home/users/userLogin', 'applications'), $service->endpoint('https://uniuser.jzvisa.com/home/users/userLogin', 'applications'),