You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
payment/app/Controller/Payment/PageController.php

37 lines
1.1 KiB
PHP

<?php
declare(strict_types=1);
/**
* This file is part of Hyperf.
*
* @link https://www.hyperf.io
* @document https://hyperf.wiki
* @contact group@hyperf.io
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE
*/
namespace App\Controller\Payment;
use App\Helper\Log;
use App\Model\Order;
use Hyperf\HttpServer\Contract\RequestInterface;
use Hyperf\HttpServer\Contract\ResponseInterface;
use Psr\Http\Message\ResponseInterface as Psr7ResponseInterface;
class PageController extends AbstractController
{
public function index(RequestInterface $request, ResponseInterface $response): Psr7ResponseInterface
{
$orderNo = $request->input('order_no', '');
Log::info('redirectToOut orderNo:' . $orderNo, [], 'omipay');
if (! $orderNo) {
return '订单号错误';
}
$order = Order::where('order_no', $orderNo)->first();
if (! $order) {
return '订单号错误';
}
Log::info('redirectToOut url:' . $order->redirect_url, [], 'omipay');
return $response->redirect($order->redirect_url);
}
}