This commit is contained in:
gaofeng
2026-08-12 14:06:56 +08:00
parent 5334714544
commit 485d86634b
4 changed files with 41 additions and 0 deletions

View File

@@ -41,6 +41,31 @@ final class CustomerCenter extends Base
return $this->ok((array)($result['data'] ?? []));
}
public function orders()
{
$userId = $this->requireLogin();
if (!is_int($userId)) {
return $userId;
}
$payStatus = strtolower(trim((string)$this->request->param('pay_status', 'pay')));
if (!in_array($payStatus, ['pay', 'nopay', 'all'], true)) {
return $this->fail('支付状态参数错误');
}
$result = (new CustomerCenterService())->orders(
$userId,
$payStatus,
(int)$this->request->param('page', 1),
(int)$this->request->param('page_size', 20)
);
if ((int)($result['code'] ?? 0) !== 1) {
return $this->fail((string)($result['msg'] ?? '服务异常,请稍后重试'));
}
return $this->ok((array)($result['data'] ?? []));
}
public function applicant()
{
$userId = $this->requireLogin();

View File

@@ -21,6 +21,15 @@ final class CustomerCenterService
]);
}
public function orders(int $userId, string $payStatus, int $page, int $pageSize): array
{
return $this->request('orders', $userId, [
'pay_status' => $payStatus,
'page' => max(1, $page),
'page_size' => max(1, min(50, $pageSize)),
]);
}
public function applicant(int $userId, int $applicantId): array
{
return $this->request('applicant', $userId, ['applicant_id' => $applicantId]);
@@ -62,6 +71,7 @@ final class CustomerCenterService
if (!in_array($action, [
'applicants',
'applications',
'orders',
'applicant',
'saveApplicant',
'removeApplicant',

View File

@@ -36,6 +36,7 @@ Route::group('miniapi', function () {
Route::get('customer-center/applicants', 'CustomerCenter/applicants');
Route::get('customer-center/applications', 'CustomerCenter/applications');
Route::get('customer-center/orders', 'CustomerCenter/orders');
Route::post('customer-center/applicant', 'CustomerCenter/applicant');
Route::post('customer-center/applicant/save', 'CustomerCenter/saveApplicant');
Route::post('customer-center/applicant/remove', 'CustomerCenter/removeApplicant');

View File

@@ -29,6 +29,11 @@ customerCenterProxyAssertSame(
$service->endpoint('https://uniuser.jzvisa.com/home/users/userLogin/', 'applicants'),
'The proxy endpoint must accept the trailing slash used by the site configuration'
);
customerCenterProxyAssertSame(
'https://uniuser.jzvisa.com/home/customer_center/orders',
$service->endpoint('https://uniuser.jzvisa.com/home/users/userLogin', 'orders'),
'Unified customer orders must use the customer center endpoint'
);
customerCenterProxyAssertSame(
'',
$service->endpoint('https://example.com/unexpected', 'applications'),