|
@@ -1212,7 +1212,7 @@ class WholeController extends Curd
|
|
|
// 区分账户余额支付和在线支付
|
|
|
if ($payDetail->pay_prepayid == 'WXPAY') {
|
|
|
// 退款
|
|
|
- $wxRefundData = [
|
|
|
+ $data = [
|
|
|
'type' => 'app',
|
|
|
'out_trade_no' => $order->order_groupby,
|
|
|
'out_refund_no' => $return->orders_return_id,
|
|
@@ -1220,22 +1220,22 @@ class WholeController extends Curd
|
|
|
'refund_fee' => $amount * 100,
|
|
|
'refund_desc' => '退款',
|
|
|
];
|
|
|
- $res = Pay::wechat(config('payment.wxpay'))->refund($wxRefundData);
|
|
|
+ $res = Pay::wechat(config('payment.wxpay'))->refund($data);
|
|
|
$resArray = json_decode($res, true);
|
|
|
if (!$resArray['result_code'] == 'SUCCESS' || !$resArray['return_code'] == 'SUCCESS'){
|
|
|
throw new PayException("退款失败");
|
|
|
}
|
|
|
} else if ($payDetail->pay_prepayid == 'ALIPAY') {
|
|
|
// 退款
|
|
|
- $alipayRefundData = [
|
|
|
+ $data = [
|
|
|
'out_trade_no' => $order->order_groupby,
|
|
|
'refund_amount' => $amount,
|
|
|
];
|
|
|
- $res = Pay::alipay(config('payment.alipay'))->refund($alipayRefundData);
|
|
|
- dump($res);
|
|
|
- file_put_contents(runtime_path('logs/alipay.log'), $res);
|
|
|
+ $res = Pay::alipay(config('payment.alipay'))->refund($data);
|
|
|
$resArray = json_decode($res, true);
|
|
|
- dump($resArray);
|
|
|
+ if ($resArray['fund_change'] != 'Y' || $resArray['msg'] != 'Success'){
|
|
|
+ throw new PayException("退款失败");
|
|
|
+ }
|
|
|
|
|
|
} else if (isset($payType[1]) && $payType[1] == 'CASH') { // 余额支付
|
|
|
$account = MemberAccount::where('join_account_member_id', $order->join_order_member_id)
|