From c7297da22a2da3cd9038fc7894e0de49ba472682 Mon Sep 17 00:00:00 2001 From: weizong song Date: Mon, 5 Apr 2021 14:45:07 +0800 Subject: [PATCH] up --- app/Http/Controllers/Manager/OrdersController.php | 5 +---- app/Libs/WxMicroPay.class.php | 7 +++++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/app/Http/Controllers/Manager/OrdersController.php b/app/Http/Controllers/Manager/OrdersController.php index 10bea66..326768a 100644 --- a/app/Http/Controllers/Manager/OrdersController.php +++ b/app/Http/Controllers/Manager/OrdersController.php @@ -596,10 +596,7 @@ class OrdersController extends CommonController "errormsg" => $res->getMessage() ]); } - return response()->json([ - "errorcode" => 0, - "errormsg" => "支付成功!" - ]); + return response()->json($res); break; } } diff --git a/app/Libs/WxMicroPay.class.php b/app/Libs/WxMicroPay.class.php index ee49539..5eeb37d 100644 --- a/app/Libs/WxMicroPay.class.php +++ b/app/Libs/WxMicroPay.class.php @@ -23,6 +23,7 @@ class WxMicroPay extends WxPayCommon $this->setParameter("body", "充值{$recharge->money}元"); $this->setParameter("total_fee", $recharge->money * 100); $this->setParameter("auth_code", request()->auth_code); + \Log::info($this->parameters); if (!$this->parameters["out_trade_no"]) { throw new Exception("缺少必填参数out_trade_no!"); @@ -36,16 +37,18 @@ class WxMicroPay extends WxPayCommon throw new Exception("支付码不正确!"); } - \Log::info($this->parameters); $xml = $this->createXml(); $result = $this->postXmlCurl($xml, $this->pay_url); \Log::info($result); $result = $this->xmlToArray($result); - //如果返回成功 + //判断接口是否返回成功 if (!array_key_exists("return_code", $result) || !array_key_exists("result_code", $result)) { throw new Exception("接口调用失败"); } + + // + return true; } catch (Exception $exception) { return $exception;