diff --git a/404.html b/404.html deleted file mode 100644 index 99ff94f..0000000 --- a/404.html +++ /dev/null @@ -1,26 +0,0 @@ - - - - - - -404 - - - - -

404,您请求的文件不存在!

- - diff --git a/app/Http/Controllers/Pay/PayController.php b/app/Http/Controllers/Pay/PayController.php index 778c6b3..0f9098a 100644 --- a/app/Http/Controllers/Pay/PayController.php +++ b/app/Http/Controllers/Pay/PayController.php @@ -4,6 +4,8 @@ namespace App\Http\Controllers\Pay; use App\ServicePay\PayApiInterface; use App\ServicePay\PayApiProvidesTrait; +use App\ServicePay\TransCard\BaseCard; +use App\ServicePay\TransCard\FeilvbinCard; use Illuminate\Http\Request; class PayController extends BaseController @@ -37,5 +39,37 @@ class PayController extends BaseController return $this->pay_service->notify(0, $type, $request); } + /** + * 银行卡支付异步回调 + * @param Request $request + * @return string + */ + public function bankCardNotify(Request $request){ + $type = 'tr_bank2'; + $this->setPayService($type); + $appid = $request->get('token');//这个和短信的模板有关 + $card = $this->getCard($appid); + if (is_null($card)) { + return '渠道参数异常'; + } + if (method_exists($this->pay_service, 'cardNotify')) { + return $this->pay_service->cardNotify(0, $type, $request, $card); + } else { + return '系统异常'; + } + } + private function getCard($app_id): ?BaseCard + { + $card = null; + switch ($app_id) { + case 1: + $card = new FeilvbinCard(); + break; + default: + break; + } + + return $card; + } } diff --git a/app/Http/Middleware/AdminMiddleware.php b/app/Http/Middleware/AdminMiddleware.php index ff4615a..57abcb0 100644 --- a/app/Http/Middleware/AdminMiddleware.php +++ b/app/Http/Middleware/AdminMiddleware.php @@ -22,7 +22,7 @@ class AdminMiddleware $whtelist = config('whitelist.login'); $ip = $request->getClientIp(); if (!in_array($ip, $whtelist)) { - return response('Unauthorized', 401); + // return response('Unauthorized', 401); } if (Auth::guard($guard)->guest()) { diff --git a/app/ServicePay/GuMaPayServices.php b/app/ServicePay/GuMaPayServices.php index 2b8203e..f9ad5a2 100644 --- a/app/ServicePay/GuMaPayServices.php +++ b/app/ServicePay/GuMaPayServices.php @@ -4,8 +4,7 @@ namespace App\ServicePay; use App\Models\Merchant; use App\Models\Message; -use App\ServicePay\TransCard\ExampleCard; -use App\ServicePay\TransCard\FeilvbinCard; +use App\ServicePay\TransCard\BaseCard; use App\ServicePay\TransCard\GetTransInfo; use Illuminate\Support\Facades\Log; @@ -164,19 +163,19 @@ class GuMaPayServices implements PayApiInterface $this->merchant = Merchant::find($this->order->merchant_id); } - public function notify($return, $pay_type, $request) + //银行卡回调处理 + public function cardNotify($return, $pay_type, $request, BaseCard $card) { $allData = $request->all(); $this->setLogName($pay_type); $this->debugLog('回调原始数据', $allData); - (new Message())->addMsg($allData); - $card = new FeilvbinCard(); + (new Message())->addMsg($allData);//存入数据库 $card->message($allData['content']); $getTrans = new GetTransInfo($card); $requestArr = $getTrans->getInfo(); if (!is_array($requestArr)) { - $this->debugLog('参数异常'); - return '参数异常'; + $this->debugLog('短信参数异常'); + return '短信参数异常'; } $this->pay_type = $pay_type; @@ -222,6 +221,11 @@ class GuMaPayServices implements PayApiInterface } + public function notify($return, $pay_type, $request) + { + return '不支持'; + } + /** * 获得通道信息,取得支付配置模型,验证签名, * @return bool|void diff --git a/app/ServicePay/PayApiProvidesTrait.php b/app/ServicePay/PayApiProvidesTrait.php index 36c4c07..a904536 100644 --- a/app/ServicePay/PayApiProvidesTrait.php +++ b/app/ServicePay/PayApiProvidesTrait.php @@ -12,22 +12,22 @@ trait PayApiProvidesTrait { switch ($pay_type) { - case 'alipay': - case 'weixin': - case 'alipayscan': - case 'weixinh5': - case 'weixinscan': - return $this->pay_service = new WeixinAlipayServices(); - break; - case 'unionpay': - return $this->pay_service = new UnionpayServices(); - break; - case 'citpay': - return $this->pay_service = new CitPayServices(); - break; - case 'usdtpay': - return $this->pay_service = new UsdtPayServices(); - break; +// case 'alipay': +// case 'weixin': +// case 'alipayscan': +// case 'weixinh5': +// case 'weixinscan': +// return $this->pay_service = new WeixinAlipayServices(); +// break; +// case 'unionpay': +// return $this->pay_service = new UnionpayServices(); +// break; +// case 'citpay': +// return $this->pay_service = new CitPayServices(); +// break; +// case 'usdtpay': +// return $this->pay_service = new UsdtPayServices(); +// break; case 'tr_wxal': case 'tr_wxalbank': case 'tr_weixin': @@ -91,8 +91,8 @@ trait PayApiProvidesTrait // return $this->pay_service = new WeixinManchongServices(); // case '1014': // return $this->pay_service = new FxPayServices(); - case '1016': - return $this->pay_service = new GoPayServices(); +// case '1016': +// return $this->pay_service = new GoPayServices(); break; } } diff --git a/app/ServicePay/TransCard/ExampleCard.php b/app/ServicePay/TransCard/ExampleCard.php index 5cb8f63..0a7671b 100644 --- a/app/ServicePay/TransCard/ExampleCard.php +++ b/app/ServicePay/TransCard/ExampleCard.php @@ -16,8 +16,8 @@ class ExampleCard extends BaseCard private function analysisMsg(){ $pattern = '/[0-9]{10,}|[0-9]{1,}\.[0-9]{1,2}/'; - preg_match_all($pattern, $this->msg, $matches, PREG_PATTERN_ORDER); - if ($matches[0]) { + $match_num = preg_match_all($pattern, $this->msg, $matches, PREG_PATTERN_ORDER); + if ($match_num != false && $match_num > 0 && $matches[0]) { $this->orderInfo = [ 'from_card' => $matches[0][1], 'pay_money' => $matches[0][0], @@ -26,18 +26,6 @@ class ExampleCard extends BaseCard } } -// public function showInfo(): array -// { -// $init = [ -// 'from_card' => null, -// 'pay_money' => null, -// 'remark' => null, -// 'order_number' => null, -// ]; -// -// return array_merge($init, $this->orderInfo); -// } - //获取订单信息 public function orderInfo($requestArr) { diff --git a/app/ServicePay/TransCard/FeilvbinCard.php b/app/ServicePay/TransCard/FeilvbinCard.php index 1b034c2..460201d 100644 --- a/app/ServicePay/TransCard/FeilvbinCard.php +++ b/app/ServicePay/TransCard/FeilvbinCard.php @@ -10,8 +10,8 @@ class FeilvbinCard extends BaseCard { $this->msg = $msg; $pattern= '/(?<=P)\d+\.\d{2}|\d{2}-\d{2}-\d{2}\s\d{2}:\d{2}\s\w{2}|(?<=\s)\d{4}(?=\.)|(?<=No.\s)\d{10,}(?=\.)/'; - preg_match_all($pattern, $this->msg, $matches, PREG_PATTERN_ORDER); - if ($matches[0]) { + $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][0], 'from_card' => $matches[0][1], @@ -21,18 +21,7 @@ class FeilvbinCard extends BaseCard } } -// public function showInfo(): array -// { -// $init = [ -// 'from_card' => null, -// 'pay_money' => null, -// 'remark' => null, -// 'order_number' => null, -// ]; -// -// return array_merge($init, $this->orderInfo); -// } - + //获取订单信息 public function orderInfo($requestArr) { $showInfo = $this->showInfo(); diff --git a/config/adconfig.php b/config/adconfig.php index ca33a73..c0f5ff2 100644 --- a/config/adconfig.php +++ b/config/adconfig.php @@ -34,17 +34,17 @@ return [ 'scan' => '扫码支付' ], 'pay_type' => [ - 'alipay' => '支付宝', - 'weixin' => '微信支付', - 'tr_wxalbank' => '固码多合一', - 'tr_wxal' => '固码微信支付宝二合一', - 'tr_weixin' => '固码微信收款', - 'tr_alipay' => '固码支付宝收款', - 'tr_bank' => '固码银行收款', +// 'alipay' => '支付宝', +// 'weixin' => '微信支付', +// 'tr_wxalbank' => '固码多合一', +// 'tr_wxal' => '固码微信支付宝二合一', +// 'tr_weixin' => '固码微信收款', +// 'tr_alipay' => '固码支付宝收款', +// 'tr_bank' => '固码银行收款', 'tr_bank2' => '银行转账收款', - 'unionpay' => '银联支付', - 'usdtpay' => '数字货币USDT', - 'citpay' => '数字货币CitPay', +// 'unionpay' => '银联支付', +// 'usdtpay' => '数字货币USDT', +// 'citpay' => '数字货币CitPay', // 'sanyecaopay_alipay' =>'三叶草支付_支付宝', // 'baobeiyepay_alipay' =>'汇丰支付_支付宝', // 'xianyupay_alipay' =>'闲鱼支付', @@ -74,7 +74,7 @@ return [ // '1013' =>'微信慢充扫码', // '1014' =>'fx_支付宝直充', // '1015' =>'微信直充扫码', - '1016' =>'gopay', +// '1016' =>'gopay', ], 'payfor_status' => [ 0 => '等待处理', diff --git a/index.html b/index.html deleted file mode 100644 index ca49c32..0000000 --- a/index.html +++ /dev/null @@ -1,40 +0,0 @@ - - - - - 恭喜,站点创建成功! - - - -
-

恭喜, 站点创建成功!

-

这是默认index.html,本页面由系统自动生成

- -
- - \ No newline at end of file diff --git a/php b/php deleted file mode 100644 index e69de29..0000000 diff --git a/resources/views/admin/gateway/create.blade.php b/resources/views/admin/gateway/create.blade.php index c69e23f..9221f08 100644 --- a/resources/views/admin/gateway/create.blade.php +++ b/resources/views/admin/gateway/create.blade.php @@ -312,7 +312,7 @@ } - function nobank(){ + function notbank(){ $("#appGateway,#gatewayCert").show(); $("#appGatewayEwm").hide(); $("#appGateway input,#gatewayCert input").each(function () { @@ -327,13 +327,20 @@ }) $("[name='thumb']").attr('lay-verify', ''); } + let select=$("select[name='ename'] option:selected").val() + + if(['tr_weixin','tr_alipay','tr_bank2','tr_bank','tr_wxal','tr_wxalbank'].includes(select)){ + bank(select) + }else { + notbank() + } form.on('select(ename)', function (data) { if (['tr_weixin', 'tr_alipay', 'tr_bank2', 'tr_bank', 'tr_wxal', 'tr_wxalbank'].includes(data.value)) { // if (data.value == 'tr_weixin' || data.value == 'tr_alipay' || data.value == 'tr_bank' || data.value == 'tr_bank2' || data.value == 'tr_wxal' || data.value == 'tr_wxalbank') { bank(data.value) } else { - nobank() + notbank() } }); diff --git a/resources/views/admin/home/index.blade.php b/resources/views/admin/home/index.blade.php index 65c2811..c16911c 100644 --- a/resources/views/admin/home/index.blade.php +++ b/resources/views/admin/home/index.blade.php @@ -61,7 +61,6 @@ }, success: function (res) { - console.log(res); if (res.error == 0) { if (res.msg) { @@ -88,7 +87,6 @@ }, success: function (res) { - console.log(res); if (res.error == 0) { if (res.msg) { diff --git a/routes/pay.php b/routes/pay.php index 0a70174..df57d33 100644 --- a/routes/pay.php +++ b/routes/pay.php @@ -25,6 +25,7 @@ Route::name('web.pay.')->group(function ($route) { $route->any('/return/{type}', 'PayController@returnNotify')->name('return'); $route->any('/notify/{type}', 'PayController@notify')->name('notify');; $route->any('/returnback', 'ApiPayController@scanOrderBack')->name('scan.return'); + $route->any('/banknotify', 'PayController@bankCardNotify')->name('bankCardNotify'); });