From 09972c7fdd03f6f58495fc44d1a331bf3bc1e132 Mon Sep 17 00:00:00 2001 From: "[ddwe]" Date: Sat, 18 Mar 2023 16:40:01 +0800 Subject: [PATCH] no message --- app/ServicePay/ApiOrderServices.php | 12 ++++++------ app/ServicePay/PayTrait.php | 3 +++ 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/app/ServicePay/ApiOrderServices.php b/app/ServicePay/ApiOrderServices.php index 7979d41..0c1d848 100644 --- a/app/ServicePay/ApiOrderServices.php +++ b/app/ServicePay/ApiOrderServices.php @@ -78,11 +78,11 @@ class ApiOrderServices //订单无效 if ($has_order->status == 4) { - return abort(403, '订单已取消'); + return $this->msg(['error' => 403, 'msg' => '订单已取消']); } if ($has_order->status == 3) { - return abort(403, '订单已取消'); + return $this->msg(['error' => 403, 'msg' => '订单已取消']); } //如果支付,2进行跳转 if (in_array($has_order->pay_status, [1, 2])) { @@ -91,7 +91,7 @@ class ApiOrderServices } //判断订单是否无效,15分钟有效 if (strtotime($has_order->created_at) <= (time() - 60 * $this->timeOut)) { - return abort(403, '订单已过期'); + return $this->msg(['error' => 403, 'msg' => '订单已过期']); } //如果没有支付,则 if ($has_order->pay_status == 0) { @@ -112,15 +112,15 @@ class ApiOrderServices //如果是citpay需要增加手机号码 if ($request->input('pay_type') == 'citpay') { if (!$request->input('mobile')) { - return $this->msg(['msg' => '手机号码不能为空']); + return $this->msg(['error' => 1,'msg' => '手机号码不能为空']); } if ($request->input('mobile')) { if (!preg_match("/^1\d{10}$/", $request->input('mobile'))) { - return $this->msg(['msg' => '手机号码格式不正确不能为空']); + return $this->msg(['error' => 1,'msg' => '手机号码格式不正确不能为空']); } } if ($request->input('money') < 100) { - return $this->msg(['msg' => '当前支付通道最低100元']); + return $this->msg(['error' => 1,'msg' => '当前支付通道最低100元']); } } //取得商户信息 diff --git a/app/ServicePay/PayTrait.php b/app/ServicePay/PayTrait.php index 131f0c2..74093de 100644 --- a/app/ServicePay/PayTrait.php +++ b/app/ServicePay/PayTrait.php @@ -762,6 +762,9 @@ trait PayTrait public function msg($data) { + //临时测试一下看看是否可行 + return response()->json($data); + if (request()->ajax()) { return response()->json($data); }