weizong song 5 years ago
parent e3680b0033
commit c7297da22a

@ -596,10 +596,7 @@ class OrdersController extends CommonController
"errormsg" => $res->getMessage() "errormsg" => $res->getMessage()
]); ]);
} }
return response()->json([ return response()->json($res);
"errorcode" => 0,
"errormsg" => "支付成功!"
]);
break; break;
} }
} }

@ -23,6 +23,7 @@ class WxMicroPay extends WxPayCommon
$this->setParameter("body", "充值{$recharge->money}元"); $this->setParameter("body", "充值{$recharge->money}元");
$this->setParameter("total_fee", $recharge->money * 100); $this->setParameter("total_fee", $recharge->money * 100);
$this->setParameter("auth_code", request()->auth_code); $this->setParameter("auth_code", request()->auth_code);
\Log::info($this->parameters);
if (!$this->parameters["out_trade_no"]) { if (!$this->parameters["out_trade_no"]) {
throw new Exception("缺少必填参数out_trade_no"); throw new Exception("缺少必填参数out_trade_no");
@ -36,16 +37,18 @@ class WxMicroPay extends WxPayCommon
throw new Exception("支付码不正确!"); throw new Exception("支付码不正确!");
} }
\Log::info($this->parameters);
$xml = $this->createXml(); $xml = $this->createXml();
$result = $this->postXmlCurl($xml, $this->pay_url); $result = $this->postXmlCurl($xml, $this->pay_url);
\Log::info($result); \Log::info($result);
$result = $this->xmlToArray($result); $result = $this->xmlToArray($result);
//如果返回成功 //判断接口是否返回成功
if (!array_key_exists("return_code", $result) || !array_key_exists("result_code", $result)) { if (!array_key_exists("return_code", $result) || !array_key_exists("result_code", $result)) {
throw new Exception("接口调用失败"); throw new Exception("接口调用失败");
} }
//
return true; return true;
} catch (Exception $exception) { } catch (Exception $exception) {
return $exception; return $exception;

Loading…
Cancel
Save