diff --git a/FlyCube/MpApi/Controller/PayController.class.php b/FlyCube/MpApi/Controller/PayController.class.php index c2d0059..ce2c3e4 100644 --- a/FlyCube/MpApi/Controller/PayController.class.php +++ b/FlyCube/MpApi/Controller/PayController.class.php @@ -77,10 +77,11 @@ class PayController extends PublicController exit(); } + // 设置退款参数 $refundParameter = [ 'out_trade_no' => $order['order_sn'], // 商户订单号 - 'out_refund_no' => $order['order_sn'] . '_refund', // 商户退款单号 + 'out_refund_no' => $order['order_sn'] . '_' . $_REQUEST['refund_type'], // 商户退款单号 'amount' => [ 'refund' => $_REQUEST['refund_price'] * 100, // 退款金额,单位:分 'total' => $order['total_price'] * 100, // 订单金额,单位:分 @@ -106,7 +107,9 @@ class PayController extends PublicController try { // 实例化 Yansongda Pay 并处理回调 $result = Pay::wechat($this->config)->callback(); - $this->publish("demo", $result); + $outRefundNo = $result['resource']['ciphertext']['out_refund_no']; + $refundType = substr($outRefundNo, strrpos($outRefundNo, '_')); + $this->publish("demo", $refundType); // 验证成功,处理业务逻辑 if ($result['resource']['ciphertext']['refund_status'] == 'SUCCESS') {