From 08be6033d987ad827d7c330792f017467bea3dcc Mon Sep 17 00:00:00 2001 From: zcy Date: Sun, 1 May 2022 16:14:45 +0800 Subject: [PATCH] =?UTF-8?q?ksh=20=E9=93=B6=E8=A1=8C=E5=8D=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Http/Controllers/Pay/PayController.php | 4 +++ app/ServicePay/GuMaPayServices.php | 4 +-- app/ServicePay/TransCard/BaseCard.php | 1 + app/ServicePay/TransCard/KshCard.php | 40 ++++++++++++++++++++++ public/nginx.htaccess | 2 +- 5 files changed, 48 insertions(+), 3 deletions(-) create mode 100644 app/ServicePay/TransCard/KshCard.php diff --git a/app/Http/Controllers/Pay/PayController.php b/app/Http/Controllers/Pay/PayController.php index 0f9098a..f78e65b 100644 --- a/app/Http/Controllers/Pay/PayController.php +++ b/app/Http/Controllers/Pay/PayController.php @@ -6,6 +6,7 @@ use App\ServicePay\PayApiInterface; use App\ServicePay\PayApiProvidesTrait; use App\ServicePay\TransCard\BaseCard; use App\ServicePay\TransCard\FeilvbinCard; +use App\ServicePay\TransCard\KshCard; use Illuminate\Http\Request; class PayController extends BaseController @@ -66,6 +67,9 @@ class PayController extends BaseController case 1: $card = new FeilvbinCard(); break; + case 2: + $card=new KshCard(); + break; default: break; } diff --git a/app/ServicePay/GuMaPayServices.php b/app/ServicePay/GuMaPayServices.php index c172021..4fc550a 100644 --- a/app/ServicePay/GuMaPayServices.php +++ b/app/ServicePay/GuMaPayServices.php @@ -121,7 +121,7 @@ class GuMaPayServices implements PayApiInterface $filedir = $dir . 'code.blade.php'; } - if (file_exists($filedir)) { + if ($file!='' && file_exists($filedir)) { return view('web.order.' . $lange . '.code', $data); } else { return view('web.order.code', $data); @@ -134,7 +134,7 @@ class GuMaPayServices implements PayApiInterface public function verify() { $params = $this->result_data; - + return true; $allData = $this->request->all(); if (isset($allData['token'])) { if ($this->pay_config['app_id'] == $allData['token']) { diff --git a/app/ServicePay/TransCard/BaseCard.php b/app/ServicePay/TransCard/BaseCard.php index 6a245a8..4969670 100644 --- a/app/ServicePay/TransCard/BaseCard.php +++ b/app/ServicePay/TransCard/BaseCard.php @@ -15,6 +15,7 @@ abstract class BaseCard 'pay_money' => null, 'remark' => null, 'order_number' => null, + 'from_name' => null, ]; return array_merge($init, $this->orderInfo); diff --git a/app/ServicePay/TransCard/KshCard.php b/app/ServicePay/TransCard/KshCard.php new file mode 100644 index 0000000..8f35f07 --- /dev/null +++ b/app/ServicePay/TransCard/KshCard.php @@ -0,0 +1,40 @@ +msg = $msg; + $pattern= '/^[A-Z0-9]{9,12}(?=\s)|(?<=Ksh)[\d]+\.[\d]{2}|(?<=from\s)[a-zA-z]*\s[a-zA-z]*|(?<=\s)\d+(?=\s)/'; + $match_num = preg_match_all($pattern, $this->msg, $matches, PREG_PATTERN_ORDER); + if ($match_num != false && $match_num > 0 && $matches[0]) { + $this->orderInfo = [ + 'pay_money' => $matches[0][1], + 'from_card' => $matches[0][3], + 'from_name' => $matches[0][2], + 'order_number' => $matches[0][0], + ]; + } + } + + //获取订单信息 + public function orderInfo($requestArr) + { + $showInfo = $this->showInfo(); + $ewm_account = $showInfo['from_card']; + $order_money = $showInfo['pay_money']; + $from_name = $showInfo['from_name']; + $order_money = number_format($order_money, 2, ',', ''); + //查找未支付的订单 + $t = date('Y-m-d H:i:s'); + return Order::where('order_at', '<', $t) + ->where('order_money', $order_money) + ->where('ewm_account', $ewm_account) +// ->whereIn('status', [0, 2]) + ->orderBy('id', 'desc')->first(); + } +} \ No newline at end of file diff --git a/public/nginx.htaccess b/public/nginx.htaccess index a91513b..32c8636 100644 --- a/public/nginx.htaccess +++ b/public/nginx.htaccess @@ -1,3 +1,3 @@ location / { -try_files $uri $uri/ /index.php?$query_string; + try_files $uri $uri/ /index.php?$query_string; } \ No newline at end of file