1. 维护代码健壮

2. 更新项目结构文档
This commit is contained in:
技术老胡
2026-04-27 16:20:41 +08:00
parent 9a16a88640
commit 0e5de50337
198 changed files with 21038 additions and 702 deletions

View File

@@ -3,6 +3,7 @@
namespace app\http\admin\controller\merchant;
use app\common\base\BaseController;
use app\http\admin\validation\MerchantApiCredentialValidator;
use app\http\admin\validation\MerchantValidator;
use app\service\merchant\MerchantService;
use support\Request;
@@ -136,8 +137,9 @@ class MerchantController extends BaseController
public function issueCredential(Request $request, string $id): Response
{
$merchantId = (int) $id;
$data = $this->validated($request->all(), MerchantApiCredentialValidator::class, 'issueCredential');
return $this->success($this->merchantService->issueCredential($merchantId));
return $this->success($this->merchantService->issueCredential($merchantId, $data));
}
/**

View File

@@ -0,0 +1,85 @@
<?php
namespace app\http\admin\controller\ops;
use app\common\base\BaseController;
use app\http\admin\validation\MerchantNotifyTaskValidator;
use app\service\ops\log\MerchantNotifyTaskService;
use support\Request;
use support\Response;
/**
* 商户通知任务控制器。
*
* @property MerchantNotifyTaskService $merchantNotifyTaskService 商户通知任务服务
*/
class MerchantNotifyTaskController extends BaseController
{
/**
* 构造方法。
*
* @param MerchantNotifyTaskService $merchantNotifyTaskService 商户通知任务服务
* @return void
*/
public function __construct(
protected MerchantNotifyTaskService $merchantNotifyTaskService
) {
}
/**
* 查询商户通知任务列表。
*
* @param Request $request 请求对象
* @return Response 响应对象
*/
public function index(Request $request): Response
{
$data = $this->validated($request->all(), MerchantNotifyTaskValidator::class, 'index');
return $this->page(
$this->merchantNotifyTaskService->paginate(
$data,
(int) ($data['page'] ?? 1),
(int) ($data['page_size'] ?? 10)
)
);
}
/**
* 查询商户通知任务详情。
*
* @param Request $request 请求对象
* @param string $notifyNo 通知号
* @return Response 响应对象
*/
public function show(Request $request, string $notifyNo): Response
{
$data = $this->validated(['notify_no' => $notifyNo], MerchantNotifyTaskValidator::class, 'show');
$task = $this->merchantNotifyTaskService->findByNotifyNo((string) $data['notify_no']);
if (!$task) {
return $this->fail('商户通知任务不存在', 404);
}
return $this->success($task);
}
/**
* 手动重试商户通知任务。
*
* @param Request $request 请求对象
* @param string $notifyNo 通知号
* @return Response 响应对象
*/
public function retry(Request $request, string $notifyNo): Response
{
$data = $this->validated(['notify_no' => $notifyNo], MerchantNotifyTaskValidator::class, 'retry');
$task = $this->merchantNotifyTaskService->retry((string) $data['notify_no']);
if (!$task) {
return $this->fail('商户通知任务不存在', 404);
}
return $this->success($task, '商户通知任务已执行重试');
}
}

View File

@@ -86,6 +86,24 @@ class AuthController extends BaseController
(string) $this->requestAttribute($request, 'auth.admin_username', '')
));
}
/**
* 修改当前登录管理员密码。
*
* @param Request $request 请求对象
* @return Response 响应对象
*/
public function changePassword(Request $request): Response
{
$adminId = $this->currentAdminId($request);
if ($adminId <= 0) {
return $this->fail('未获取到当前管理员信息', 401);
}
$data = $this->validated($request->all(), AuthValidator::class, 'changePassword');
return $this->success($this->adminUserService->changePassword($adminId, $data));
}
}

View File

@@ -11,7 +11,7 @@ use support\Response;
/**
* 支付订单管理控制器。
*
* 当前提供列表查询,后续可以继续扩展支付单详情、关闭、重试等管理操作
* 当前提供列表查询和详情查看,便于后台直接排查支付链路
*
* @property PayOrderService $payOrderService 支付订单服务
*/
@@ -42,6 +42,24 @@ class PayOrderController extends BaseController
return $this->success($this->payOrderService->paginate($data, $page, $pageSize));
}
/**
* 查询支付订单详情。
*
* @param Request $request 请求对象
* @param string $payNo 支付单号
* @return Response 响应对象
*/
public function show(Request $request, string $payNo): Response
{
$this->validated(
array_merge($request->all(), ['pay_no' => $payNo]),
PayOrderValidator::class,
'show'
);
return $this->success($this->payOrderService->detail($payNo));
}
}