diff --git a/app/JsonRpc/OrdersService.php b/app/JsonRpc/OrdersService.php index e12d9d5..68cc52e 100644 --- a/app/JsonRpc/OrdersService.php +++ b/app/JsonRpc/OrdersService.php @@ -129,7 +129,7 @@ class OrdersService implements OrdersServiceInterface * @param $note * @return array */ - public function onlineSingleRefund($user_id, $note, $global_order_id, $order_child_id=null, $order_goods_id=null) + public function onlineSingleRefund($user_id, $note, $global_order_id, $order_child_id='', $order_goods_id='') { Db::beginTransaction(); @@ -168,7 +168,7 @@ class OrdersService implements OrdersServiceInterface // 子订单 $orderChild = null; if ($order_child_id) { - $orderChild = Order::query()->with('store:user_id')->where(['order_main_id' => $orderMain->global_order_id, 'id' => $order_child_id])->first(); + $orderChild = Order::query()->with('store')->where(['order_main_id' => $orderMain->global_order_id, 'id' => $order_child_id])->first(); } // 订单商品 @@ -222,13 +222,14 @@ class OrdersService implements OrdersServiceInterface ]); throw new ErrorCodeException(ErrorCode::ORDER_REFUND_FAIL); } + // 开始退款 $config = config('wxpay'); $app = Factory::payment($config); $app['guzzle_handler'] = CoroutineHandler::class; $result = $app->refund->byOutTradeNumber( $orderMain->global_order_id, - $orderMain->global_order_id, + $orderMain->global_order_id.$order_child_id.$order_goods_id, bcmul($orderMain->money, 100, 0), bcmul($refundAmount, 100, 0), [