mirror of
https://gitee.com/technical-laohu/mpay_v2_webman.git
synced 2026-04-22 01:54:25 +08:00
重构初始化
This commit is contained in:
38
app/http/admin/controller/trade/PayOrderController.php
Normal file
38
app/http/admin/controller/trade/PayOrderController.php
Normal file
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
|
||||
namespace app\http\admin\controller\trade;
|
||||
|
||||
use app\common\base\BaseController;
|
||||
use app\http\admin\validation\PayOrderValidator;
|
||||
use app\service\payment\order\PayOrderService;
|
||||
use support\Request;
|
||||
use support\Response;
|
||||
|
||||
/**
|
||||
* 支付订单管理控制器。
|
||||
*
|
||||
* 当前先提供列表查询,后续可以继续扩展支付单详情、关闭、重试等管理操作。
|
||||
*/
|
||||
class PayOrderController extends BaseController
|
||||
{
|
||||
/**
|
||||
* 构造函数,注入支付订单服务。
|
||||
*/
|
||||
public function __construct(
|
||||
protected PayOrderService $payOrderService
|
||||
) {
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询支付订单列表。
|
||||
*/
|
||||
public function index(Request $request): Response
|
||||
{
|
||||
$data = $this->validated($request->all(), PayOrderValidator::class, 'index');
|
||||
$page = max(1, (int) ($data['page'] ?? 1));
|
||||
$pageSize = max(1, (int) ($data['page_size'] ?? 10));
|
||||
|
||||
return $this->success($this->payOrderService->paginate($data, $page, $pageSize));
|
||||
}
|
||||
}
|
||||
|
||||
56
app/http/admin/controller/trade/RefundOrderController.php
Normal file
56
app/http/admin/controller/trade/RefundOrderController.php
Normal file
@@ -0,0 +1,56 @@
|
||||
<?php
|
||||
|
||||
namespace app\http\admin\controller\trade;
|
||||
|
||||
use app\common\base\BaseController;
|
||||
use app\http\admin\validation\RefundActionValidator;
|
||||
use app\http\admin\validation\RefundOrderValidator;
|
||||
use app\service\payment\order\RefundService;
|
||||
use support\Request;
|
||||
use support\Response;
|
||||
|
||||
/**
|
||||
* 退款订单管理控制器。
|
||||
*/
|
||||
class RefundOrderController extends BaseController
|
||||
{
|
||||
public function __construct(
|
||||
protected RefundService $refundService
|
||||
) {
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询退款订单列表。
|
||||
*/
|
||||
public function index(Request $request): Response
|
||||
{
|
||||
$data = $this->validated($request->all(), RefundOrderValidator::class, 'index');
|
||||
$page = max(1, (int) ($data['page'] ?? 1));
|
||||
$pageSize = max(1, (int) ($data['page_size'] ?? 10));
|
||||
|
||||
return $this->success($this->refundService->paginate($data, $page, $pageSize));
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询退款订单详情。
|
||||
*/
|
||||
public function show(Request $request, string $refundNo): Response
|
||||
{
|
||||
return $this->success($this->refundService->detail($refundNo));
|
||||
}
|
||||
|
||||
/**
|
||||
* 重试退款。
|
||||
*/
|
||||
public function retry(Request $request, string $refundNo): Response
|
||||
{
|
||||
$data = $this->validated(
|
||||
array_merge($request->all(), ['refund_no' => $refundNo]),
|
||||
RefundActionValidator::class,
|
||||
'retry'
|
||||
);
|
||||
|
||||
return $this->success($this->refundService->retryRefund($refundNo, $data));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,53 @@
|
||||
<?php
|
||||
|
||||
namespace app\http\admin\controller\trade;
|
||||
|
||||
use app\common\base\BaseController;
|
||||
use app\exception\ResourceNotFoundException;
|
||||
use app\http\admin\validation\SettlementOrderValidator;
|
||||
use app\service\payment\settlement\SettlementOrderQueryService;
|
||||
use support\Request;
|
||||
use support\Response;
|
||||
|
||||
/**
|
||||
* 清算订单控制器。
|
||||
*/
|
||||
class SettlementOrderController extends BaseController
|
||||
{
|
||||
/**
|
||||
* 构造函数,注入清算订单服务。
|
||||
*/
|
||||
public function __construct(
|
||||
protected SettlementOrderQueryService $settlementOrderQueryService
|
||||
) {
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询清算订单列表。
|
||||
*/
|
||||
public function index(Request $request): Response
|
||||
{
|
||||
$data = $this->validated($request->all(), SettlementOrderValidator::class, 'index');
|
||||
|
||||
return $this->page(
|
||||
$this->settlementOrderQueryService->paginate(
|
||||
$data,
|
||||
(int) ($data['page'] ?? 1),
|
||||
(int) ($data['page_size'] ?? 10)
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询清算订单详情。
|
||||
*/
|
||||
public function show(Request $request, string $settleNo): Response
|
||||
{
|
||||
$data = $this->validated(['settle_no' => $settleNo], SettlementOrderValidator::class, 'show');
|
||||
try {
|
||||
return $this->success($this->settlementOrderQueryService->detail((string) $data['settle_no']));
|
||||
} catch (ResourceNotFoundException) {
|
||||
return $this->fail('清算订单不存在', 404);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user