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:
43
app/http/api/controller/route/RouteController.php
Normal file
43
app/http/api/controller/route/RouteController.php
Normal file
@@ -0,0 +1,43 @@
|
||||
<?php
|
||||
|
||||
namespace app\http\api\controller\route;
|
||||
|
||||
use app\common\base\BaseController;
|
||||
use app\http\api\validation\RouteResolveValidator;
|
||||
use app\service\payment\runtime\PaymentRouteService;
|
||||
use support\Request;
|
||||
use support\Response;
|
||||
|
||||
/**
|
||||
* 路由预览控制器。
|
||||
*
|
||||
* 用于返回指定商户分组、支付方式和金额条件下的路由解析结果。
|
||||
*/
|
||||
class RouteController extends BaseController
|
||||
{
|
||||
/**
|
||||
* 构造函数,注入路由服务。
|
||||
*/
|
||||
public function __construct(
|
||||
protected PaymentRouteService $paymentRouteService
|
||||
) {
|
||||
}
|
||||
|
||||
/**
|
||||
* GET /api/routes/resolve
|
||||
*
|
||||
* 解析支付路由。
|
||||
*/
|
||||
public function resolve(Request $request): Response
|
||||
{
|
||||
$data = $this->validated($request->all(), RouteResolveValidator::class, 'resolve');
|
||||
|
||||
return $this->success($this->paymentRouteService->resolveByMerchantGroup(
|
||||
(int) $data['merchant_group_id'],
|
||||
(int) $data['pay_type_id'],
|
||||
(int) $data['pay_amount'],
|
||||
$data
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user