From f6da754cc26b94b9372c1e18cf1d70f8534624de Mon Sep 17 00:00:00 2001 From: wucongxing <815046773@qq.com> Date: Tue, 7 Mar 2023 10:57:39 +0800 Subject: [PATCH] 1 --- app/Controller/UserController.php | 9 +++++++-- app/Utils/Auth.php | 3 +-- extend/Wechat/WechatPay.php | 3 +++ 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/app/Controller/UserController.php b/app/Controller/UserController.php index a2bbd33..53de80d 100644 --- a/app/Controller/UserController.php +++ b/app/Controller/UserController.php @@ -70,14 +70,19 @@ class UserController extends AbstractController // 支付测试 public function testpay(){ +// $weChat = new Wechat(1); +// +// $wx_info_data = $weChat->codeToSession("0219AIFa1ROoUE0e4lIa1bO27I29AIF9"); +// dump($wx_info_data);die; + $out_trade_no = $this->request->input('out_trade_no'); $generator = $this->container->get(IdGeneratorInterface::class); - $WechatPay = new WechatPay(2); + $WechatPay = new WechatPay(1); // 获取预支付交易会话标识 $total = 0.01 * 100; - $prepay = $WechatPay->getJsapiPrepayId($out_trade_no,$total,"o9gYG441zEAHuYoNX7lwFKiQBzKE"); + $prepay = $WechatPay->getJsapiPrepayId($out_trade_no,$total,"omgU35DlE-rxTAGgcBjOuc4xdcX8"); if (empty($prepay)){ return fail(HttpEnumCode::SERVER_ERROR, "订单创建失败"); } diff --git a/app/Utils/Auth.php b/app/Utils/Auth.php index 5ff12f5..1ee9da9 100644 --- a/app/Utils/Auth.php +++ b/app/Utils/Auth.php @@ -23,8 +23,7 @@ class Auth "/area/province" => "get",// 获取省份信息 "/area/city" => "get", // 获取城市信息 "/area/county" => "get", // 获取区县信息 - "/callback/wxpay/doctor" => "post", // 微信支付回调 - "/callback/wxpay/patient" => "post", // 微信支付回调 + "/callback/wxpay/inquiry/success" => "post", // 微信支付回调 "/testpay" => "get", // 测试 ]; } diff --git a/extend/Wechat/WechatPay.php b/extend/Wechat/WechatPay.php index 60b0ce0..920176e 100644 --- a/extend/Wechat/WechatPay.php +++ b/extend/Wechat/WechatPay.php @@ -97,6 +97,8 @@ class WechatPay * @param int $total 支付金额(实际金额x100) * @param string $openid * @return array + * @throws ContainerExceptionInterface + * @throws NotFoundExceptionInterface */ public function getJsapiPrepayId(string $out_trade_no,int $total,string $openid): array { @@ -117,6 +119,7 @@ class WechatPay ] ]; + dump($options);die; try { $response = $app->getClient()->postJson("v3/pay/transactions/jsapi", $options); if ($response->isFailed()) {