diff --git a/app/Controller/Payment/PaymentController.php b/app/Controller/Payment/PaymentController.php index 43abe63..3567965 100644 --- a/app/Controller/Payment/PaymentController.php +++ b/app/Controller/Payment/PaymentController.php @@ -77,8 +77,8 @@ class PaymentController extends AbstractController public function payment(RequestInterface $request) { [$app, $data, $token] = $this->parseReqest($request, UnbindCardRequest::class); - $url = $this->paymentService->payment($data, $app, $token); - return $this->success(['url' => $url]); + $data = $this->paymentService->payment($data, $app, $token); + return $this->success($data); } public function transferPay(RequestInterface $request) { diff --git a/app/Helper/Baofu/Baofu.php b/app/Helper/Baofu/Baofu.php index a9b331a..39f25a5 100644 --- a/app/Helper/Baofu/Baofu.php +++ b/app/Helper/Baofu/Baofu.php @@ -210,12 +210,7 @@ class Baofu $data['callType'] = $params['callType']; $res = base64_decode($this->api('payment', $data)); - if(self::PEYMENT_PAID_TYPE[$params['paidType']]){ - $res = json_decode($res, true); - if($res['body']){ - return $res['body']; - } - } + return json_decode($res, true); } public function recharge($params, $token) diff --git a/app/Service/PaymentService.php b/app/Service/PaymentService.php index 6ec2e83..8b0a875 100644 --- a/app/Service/PaymentService.php +++ b/app/Service/PaymentService.php @@ -102,7 +102,7 @@ class PaymentService extends AbstractService $order->applied_at = date('Y-m-d H:i:s'); $order->pay_url = $url; $order->save(); - return $url; + return ['url' => $url]; } catch (ApiException $e) { $order->status = 'APPLY_FAILED'; $order->applied_at = date('Y-m-d H:i:s'); @@ -167,9 +167,9 @@ class PaymentService extends AbstractService ], $token); $order->status = 'APPLY_SUCCESS'; $order->applied_at = date('Y-m-d H:i:s'); - $order->acs_no = $result['acsNo']; + $order->acs_no = $result['body'] ?? ''; $order->save(); - return $result['acsNo']; + return $result; } catch (ApiException $e) { $order->status = 'APPLY_FAILED'; $order->applied_at = date('Y-m-d H:i:s');