mirror of
https://gitee.com/technical-laohu/mpay_v2_webman.git
synced 2026-04-21 09:24:33 +08:00
重构初始化
This commit is contained in:
39
app/http/api/controller/trace/TraceController.php
Normal file
39
app/http/api/controller/trace/TraceController.php
Normal file
@@ -0,0 +1,39 @@
|
||||
<?php
|
||||
|
||||
namespace app\http\api\controller\trace;
|
||||
|
||||
use app\common\base\BaseController;
|
||||
use app\http\api\validation\TraceQueryValidator;
|
||||
use app\service\payment\trace\TradeTraceService;
|
||||
use support\Request;
|
||||
use support\Response;
|
||||
|
||||
/**
|
||||
* 统一追踪查询控制器。
|
||||
*/
|
||||
class TraceController extends BaseController
|
||||
{
|
||||
public function __construct(
|
||||
protected TradeTraceService $tradeTraceService
|
||||
) {
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询指定追踪号对应的完整交易链路。
|
||||
*/
|
||||
public function show(Request $request, string $traceNo): Response
|
||||
{
|
||||
$data = $this->validated(
|
||||
array_merge($request->all(), ['trace_no' => $traceNo]),
|
||||
TraceQueryValidator::class,
|
||||
'show'
|
||||
);
|
||||
|
||||
$result = $this->tradeTraceService->queryByTraceNo((string) $data['trace_no']);
|
||||
if (empty($result)) {
|
||||
return $this->fail('追踪单不存在', 404);
|
||||
}
|
||||
|
||||
return $this->success($result);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user