|
|
|
|
@ -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;
|
|
|
|
|
|