request->input('order_id'); $orderInfo = $this->orderModel->getInfoById($orderId); if ($orderInfo->user_id != $this->userId) throw new ErrException('该订单不是您的订单,请勿操作'); if ($orderInfo->status != OrderCode::PAYED) throw new ErrException('该订单状态已变更,请勿重复操作,刷新后无法退款请联系客服'); try { $orderId = (int)$this->request->input('order_id'); $service = new FullRefundOrderService(); $service->orderId = $orderId; $service->reason = '用户主动退款订单'; $service->type = RefundCode::FULL_GOOD_REFUND; $service->handle(); return $this->return->success(); }catch (Exception $e) { throw new ErrException($e->getMessage()); } } }