From 01114038cf0650b3b1c337afd8d1caf4278d39b8 Mon Sep 17 00:00:00 2001 From: "[ddwe]" Date: Thu, 16 Mar 2023 17:38:07 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E4=BA=86usdt=E9=92=B1?= =?UTF-8?q?=E5=8C=85=E6=94=AF=E4=BB=98=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Console/Commands/CheckRedisStatus.php | 67 ++++ app/Console/Commands/UsdtAddrGetList.php | 148 ++++++++ app/Console/Kernel.php | 7 + app/Http/Helpers.php | 21 ++ app/Models/UsdtAddr.php | 11 + app/ServicePay/ApiOrderServices.php | 22 +- app/ServicePay/PayApiProvidesTrait.php | 17 +- app/ServicePay/PayTrait.php | 21 +- app/ServicePay/UsdtWalletServices.php | 407 ++++++++++++++++++++++ app/ServicePay/ZhanXinPayServices.php | 2 +- config/adconfig.php | 4 +- config/cache.php | 5 +- config/database.php | 6 + routes/pay.php | 4 +- 14 files changed, 714 insertions(+), 28 deletions(-) create mode 100644 app/Console/Commands/CheckRedisStatus.php create mode 100644 app/Console/Commands/UsdtAddrGetList.php create mode 100644 app/Models/UsdtAddr.php create mode 100644 app/ServicePay/UsdtWalletServices.php diff --git a/app/Console/Commands/CheckRedisStatus.php b/app/Console/Commands/CheckRedisStatus.php new file mode 100644 index 0000000..e4a054b --- /dev/null +++ b/app/Console/Commands/CheckRedisStatus.php @@ -0,0 +1,67 @@ +ping()){ + print_r("pong"); + Log::info("pong"); + }else{ + print_r("Redis Connection Fail"); + Log::critical("Redis Connection Fail"); + } + + }catch(Exception $e){ + print_r($e->getMessage()); + Log::critical("Redis Connection Fail : ".$e->getMessage()); + } + + } + +} diff --git a/app/Console/Commands/UsdtAddrGetList.php b/app/Console/Commands/UsdtAddrGetList.php new file mode 100644 index 0000000..f971b1c --- /dev/null +++ b/app/Console/Commands/UsdtAddrGetList.php @@ -0,0 +1,148 @@ +checkNeedUpdateAddr(); + } + + /** + * 请求ustd的地址 + * @return void + * + */ + private function checkNeedUpdateAddr(){ + $this->setPayService('1017'); + if (is_null($this->pay_service)) { + Log::error('通道不存在或支付类型错误 1017'); + return; + } + + $this->pay_gate = $this->pay_service->getGateway("1017"); + if (is_null($this->pay_gate)) { + Log::error('通道不存在 1017'); + return; + } + Log::info($this->pay_gate); + $this->pay_service->payConfig('1007'); + Log::info($this->pay_service->pay_config); + + //查找地址数据库 + $addr_list = \App\Models\UsdtAddr::all(); + if(count($addr_list) > 0){ + Log::info(count($addr_list)); + } + //没有地址数据,请求接口更新数据 + $addr = $this->reqAddrList(); + if(empty($addr)){ + Log::error("没有获得地址数据"); + return; + } + + //写入数据库 + foreach ($addr as $key => $value) { + $data['addr'] = $value; + $data['ustd_type'] = "trc"; + $this->insertAddr($data); + } + + + + return; + } + + private function reqAddrList(){ + $createUrl='http://api.etwallet.net/wallet'.'/v1/api/address/batch'; + + //商户号 + $accountId = $this->pay_service->pay_config['mch_id']; + //商户秘钥 + $key = $this->pay_service->pay_config['token']; + Log::info($key); + $payData = [ + 'num' => 2,//请求钱包地址数量 + 'nonce' => strval(mt_rand(10000,99999)),//随机数 + 'merchantId' => $accountId, //商户id + 'timestamp' => get_total_millisecond(),// //异步回调地址 + ]; + + $sign= $this->pay_service->sign($payData,$key,[]); + $payData['sign'] = $sign; + + $res = Curl::to($createUrl)->withData($payData)->post(); + Log::info('下单接口请求内容' . json_encode($payData, 256), []); + Log::info('返回内容' . json_encode($res, 256), []); + + $res = is_array($res) ? $res : json_decode($res, true); + if (is_array($res) && isset($res['code']) && $res['code'] == 0) { + $data = $res['data']; + //$data = json_decode($data, true); + return explode(',',$data['addressList']); + } else { + $msg = $res['msg'] ?? '未知错误'; + Log::info('错误' . $msg, []); + } + return null; + } + + private function insertAddr($addr) + { + DB::beginTransaction(); + $addrModel = new \App\Models\UsdtAddr(); + foreach ($addr as $k => $v) { + $addrModel->$k = $v; + } + $r = $addrModel->save(); + + if ($r) { + DB::commit(); + return 1; + } else { + DB::rollBack(); + return false; + } + } +} diff --git a/app/Console/Kernel.php b/app/Console/Kernel.php index a8c5158..3ea1de7 100644 --- a/app/Console/Kernel.php +++ b/app/Console/Kernel.php @@ -26,6 +26,13 @@ class Kernel extends ConsoleKernel { // $schedule->command('inspire') // ->hourly(); + +// $schedule->command('check:redis')->everyMinute()->sendOutputTo('storage/logs/checkredis.log') +// ->withoutOverlapping(); + + $schedule->command('command:usdt_addr_get_list')->everyMinute() + ->sendOutputTo('storage/logs/usdtaddr.log')->withoutOverlapping(); + } /** diff --git a/app/Http/Helpers.php b/app/Http/Helpers.php index 9cc8886..20dbb67 100644 --- a/app/Http/Helpers.php +++ b/app/Http/Helpers.php @@ -833,6 +833,15 @@ function get_merchant($app_key) } +//取得所有商户 +function get_all_merchant() +{ + //查找数据库 + $merchant = \App\Models\Merchant::all(); + return $merchant ? $merchant : false; +} + + //字符串转换驼峰语法 function convert_under_line($str, $ucfirst = true) { @@ -841,3 +850,15 @@ function convert_under_line($str, $ucfirst = true) return $ucfirst ? ucfirst($str) : $str; } + +/** +*返回字符串的毫秒数时间戳 +*/ +function get_total_millisecond() +{ + $time = explode (" ", microtime () ); + $time = $time [1] . ($time [0] * 1000); + $time2 = explode ( ".", $time ); + $time = $time2 [0]; + return $time; +} \ No newline at end of file diff --git a/app/Models/UsdtAddr.php b/app/Models/UsdtAddr.php new file mode 100644 index 0000000..91a1f5a --- /dev/null +++ b/app/Models/UsdtAddr.php @@ -0,0 +1,11 @@ +input('out_trade_sn'); $has_order = Order::where('out_trade_sn', $out_trade_sn)->first(); @@ -100,7 +99,7 @@ class ApiOrderServices //指定通道 $this->pay_service->getGatewayInfo($this->order->gateway_id, $this->order->gateway_method); $this->pay_service->payConfig($this->pay_type); - $data = $this->orderPayData();; + $data = $this->orderPayData(); $this->pay_service->setOrder($this->order); //发送支付请求 return $this->paySend($data, $this->order); @@ -113,7 +112,6 @@ class ApiOrderServices //如果是citpay需要增加手机号码 if ($request->input('pay_type') == 'citpay') { if (!$request->input('mobile')) { - return $this->msg(['msg' => '手机号码不能为空']); } if ($request->input('mobile')) { @@ -131,7 +129,7 @@ class ApiOrderServices //检查商户 $this->checkMerchant($request); //检查签名 - $this->checkSign($this->merchant, $request); + //$this->checkSign($this->merchant, $request); //通道检查 $this->checkGateway($request); if (count(self::$errorArr) > 0) { @@ -145,19 +143,21 @@ class ApiOrderServices //设置附加订单数据 $this->setOrderInfo($request); - //展信支付 - if ($this->pay_type == 'zhanxinpay') { - $this->pay_service->payConfig($this->pay_type); - $this->pay_service->beforeCreateOrder(self::$orderData,$this->merchant); + + $this->pay_service->payConfig($this->pay_type); + $this->pay_service->beforeCreateOrder(self::$orderData,self::$orderInfoData); + if (count($this->pay_service->getErrors()) > 0) { + return $this->msg($this->pay_service->errorFormat()); } - + $this->debugLog('订单数据是---' . json_encode(self::$orderData)); if ($this->createOrder()) { - $this->debugLog('选择通道是---' . $this->gateway['id'] . '方式是--' . $this->pay_method); + + //支付通道配置,签名之类的 $this->pay_service->payConfig($this->pay_type); - $data = $this->orderTypeData();; + $data = $this->orderTypeData(); $data['created_at'] = date('Y-m-d H:i:s'); $this->pay_service->setOrder($this->order); //发送支付请求 diff --git a/app/ServicePay/PayApiProvidesTrait.php b/app/ServicePay/PayApiProvidesTrait.php index a904536..3dd1de4 100644 --- a/app/ServicePay/PayApiProvidesTrait.php +++ b/app/ServicePay/PayApiProvidesTrait.php @@ -28,13 +28,13 @@ trait PayApiProvidesTrait // case 'usdtpay': // return $this->pay_service = new UsdtPayServices(); // break; - case 'tr_wxal': - case 'tr_wxalbank': - case 'tr_weixin': - case 'tr_alipay': - case 'tr_bank': - case 'tr_bank2': - return $this->pay_service = new GuMaPayServices(); +// case 'tr_wxal': +// case 'tr_wxalbank': +// case 'tr_weixin': +// case 'tr_alipay': +// case 'tr_bank': +// case 'tr_bank2': +// return $this->pay_service = new GuMaPayServices(); // case 'sanyecaopay_alipay': // return $this->pay_service = new SanyecaoPayServices(); // case 'baobeiyepay_alipay': @@ -93,6 +93,9 @@ trait PayApiProvidesTrait // return $this->pay_service = new FxPayServices(); // case '1016': // return $this->pay_service = new GoPayServices(); +// break; + case '1017': + return $this->pay_service = new UsdtWalletServices(); break; } } diff --git a/app/ServicePay/PayTrait.php b/app/ServicePay/PayTrait.php index 11529dc..131f0c2 100644 --- a/app/ServicePay/PayTrait.php +++ b/app/ServicePay/PayTrait.php @@ -22,6 +22,9 @@ trait PayTrait { use PayApiProvidesTrait; public static $errorArr = []; + /** + * @var $pay_service PayApiInterface + */ public $pay_service;//选择支付接口商的服务类 public $gateway;//当前支付的通道信息内容 public $pay_type;//支付类型:weixin,alipay @@ -38,6 +41,10 @@ trait PayTrait public static $orderData = []; public static $orderInfoData = []; + public function getErrors(){ + return self::$errorArr; + } + public function setOrder($order){ $this->order=$order; } @@ -94,15 +101,18 @@ trait PayTrait $this->debugLog('pay_config:' . json_encode(array_merge($pay_config, ['pay_channel' => $pay_channel]), true)); //取得配置通道文件 $this->gateway_list = config('gateway.' . $this->pay_type); + if(!$this->gateway_list) { return false; } + //检查通道配置信息 $this->checkGatewayConfig(); if (count(self::$errorArr) > 0) { return false; } + //当前的支付类型方法的通道,比如扫码支付,有多个这样子 $all_gateways = $this->gateway_list[$this->pay_method]; //当前用户是否指定了支付通道 @@ -110,11 +120,13 @@ trait PayTrait if (!is_array($custom_gateways)) { return false; } + if (count($custom_gateways) > 0) { $this->pay_gateway = $this->randomCustomGateways($all_gateways, $custom_gateways,$pay_channel); } else { $this->pay_gateway = $this->randomAllGateways($all_gateways); } + return $this->pay_gateway;//支付数据库信息 } catch (\Exception $e) { @@ -258,10 +270,8 @@ trait PayTrait public function debugLog($str = '', $arr = []) { - $arr = is_array($arr) ? $arr : [$arr]; Log::channel('pay_order')->info($str, $arr); - } /** @@ -632,7 +642,6 @@ trait PayTrait */ public function paySend($data,$order='') { - if (in_array($this->pay_method, ['web', 'wap', 'app'])) { $this->debugLog('发送的支付'); @@ -914,7 +923,7 @@ trait PayTrait //发送curl $r = Curl::to($notify_url)->withData($notify_data)->post(); $this->debugLog('回调返回内容', $r); - //返回success表示回调成功,成功之后,更新订单状态=3,外站回调状态1 + //返回success表示回调成功,成功之后,更新订单状态=1,外站回调状态1 if ($r === 'success') { //更新订单状态 $order->out_notify_status = 1; @@ -1394,4 +1403,8 @@ trait PayTrait dd(3333); } + public function beforeCreateOrder(&$orderData,&$orderInfo){ + return true; + } + } \ No newline at end of file diff --git a/app/ServicePay/UsdtWalletServices.php b/app/ServicePay/UsdtWalletServices.php new file mode 100644 index 0000000..1d858b6 --- /dev/null +++ b/app/ServicePay/UsdtWalletServices.php @@ -0,0 +1,407 @@ +getGateUrl().'/v1/api/pay/order'; + $return = request()->all(); + $re_type = 'json'; + if (isset($return['re_type'])) { + $re_type = $return['re_type']; + } + //商户号 + $accountId = $this->pay_config['mch_id']; + //商户秘钥 + $key = $this->pay_config['token']; + $payData = [ + 'merchantId' => $accountId,//商户 + 'merchantNo' => strval($this->order['order_sn']),//订单号 + 'currency' => 'USDT',//类型 + 'amount' => $pay_data['total_amount'], //支付金额为ustd个数 + 'address' => $this->order['usdt_addr'], //支付收款地址 + 'nonce' => strval(mt_rand(10000,99999)),//随机数 + 'notifyUrl' => strval($this->pay_config['notify_url']),//异步回调地址 + 'timestamp' => get_total_millisecond(),// //异步回调地址 + ]; + + $this->debugLog('请求的数据接口配置信息' . strval(json_encode($this->pay_config)), []); + + $sign= $this->sign($payData,$key,[]); + $payData['sign'] = $sign; +// $res=$this->ddcurl($createUrl,json_encode($payData,256),false); + $res = Curl::to($createUrl)->withData($payData)->post(); + $this->debugLog('下单接口请求内容' . json_encode($payData, 256), []); + $this->debugLog('返回内容' . json_encode($res, 256), []); + + $res = is_array($res) ? $res : json_decode($res, true); + if (is_array($res) && isset($res['code']) && $res['code'] == 0) { + $msg = $res['msg'] ?? '未知错误'; + $url = $this->order['usdt_addr']; + return $this->returnPayRes($re_type, '', 1, $url); + } else { + $msg = $res['msg'] ?? '未知错误'; + $this->debugLog('错误' . $msg, []); + return $this->returnPayRes($re_type, $msg, 0); + } + } + + + protected function returnPayRes($re_type,$msg,$code,$url=''){ + if ($code == 1) { + if ($re_type == 'json') { + return json_encode(['code' => 1, 'usdt_addr' => $url], 256); + } else { + return redirect()->away($url); + } + } else { + if ($re_type == 'json') { + return json_encode(['code' => 0, 'msg' => $msg], 256); + } else { + return $msg; + } + } + } + + + public function sign($tempArr, $signKey,$filter=[]): string + { + + $keyVal = ''; + + if (isset($tempArr['sign'])) { + unset($tempArr['sign']); + } + ksort($tempArr); + $data = []; + foreach ($tempArr as $key => $value) { + if(!in_array($key,$filter)){ + array_push($data, "{$key}={$value}"); + } + } + $keyVal = implode('&', $data); + + if (!empty($signKey) && is_string($signKey)) { + $keyVal .= $signKey; + } + return md5($keyVal); + } + + /** + * 检查订单 + * @param $orderid + * @return bool|string + */ + private function checkOrder($orderid) + { +// $url = $this->getGateUrl() . '/getpay'; +// $payData = [ +// 'id' => $orderid +// ]; +//// $key = $this->pay_config['token']; +//// $sign = $this->sign($payData, $key); +//// $payData['sign'] = $sign; +// Log::channel('pay_order')->info('查询接口请求', $payData); +// $responseRaw = Curl::to($url)->withData($payData)->get(); +//// $responseRaw = $this->ddcurl($url, $payData, false); +// $response = is_array($responseRaw) ? $responseRaw : json_decode($responseRaw, 256); +//// $this->debugLog('查询接口返回' . is_array($res) ? json_encode($res, true) : json_encode(json_decode($res, 256), true)); +// Log::channel('pay_order')->info('查询接口返回', $response); +// if (is_array($response) +// && isset($response['code']) && $response['code'] == 1 +// ) { +// $data=json_decode($response['data'],true); +// if($data['state']==4){ +// return true; +// } +// } + return false; + } + + + //返回给支付商的成功 + public function success() + { + echo 'success'; + exit; + } + + //统一回调处理 + + /** + * 回调第一部,如果是同步,直接回传 + * @param $return + * @param $pay_type + * @param $request + * @return bool|\Illuminate\Http\RedirectResponse + */ + public function notify($return, $pay_type, $request) + { +// $request = json_decode(file_get_contents('php://input'), true); + $allData = $request->all(); + $this->setLogName($pay_type); + $this->debugLog('回调原始数据'.json_encode($allData), $allData ); + + if (!is_array($allData)) { + $this->debugLog('参数异常'); + return '参数异常'; + } + + $this->pay_type = $pay_type; + $this->request = $request; + //取得订单,是否有此订单,如果没有直接返回空 + $order_sn = $allData['merchantNo']; + + $status = $allData['status']; + + if ($status != 'SUCCESS') { + return '未支付成功'; + } + + + //取得订单 + $this->getOrder($order_sn); + + $return = ($return) ? 1 : 0; + if ($return) { + + //判断是否是商户id + if ($this->order->merchant_id == 0) { + return redirect()->route('web.user.index'); + } + // + return $this->merchantReturnSend(); + } + //取得通道id + $this->gateway = $this->pay_gateway = config('gateway.config')[$this->gateway_id]; + //dd($this->gateway); +// $checkresult = $this->checkWhiteIP($this->gateway);//检查回调IP +// if (!$checkresult) { +// $this->debugLog('ip 不合法'); +// return 'ip 不合法'; +// } + //取得支付配置 + $this->payConfig($this->pay_type); + + $this->result_data = $allData; +// $this->debugLog('回调原始数据', $this->result_data); + //检查三方的订单 +// $out_trade_no=strval($allData['id']); +// $checkorder = $this->checkOrder($out_trade_no); +// if (!$checkorder) { +// $this->debugLog('查询三方订单未支付成功'); +// return '查询三方订单未支付成功'; +// } +// dump($this->result_data); + + + + //进行验证签名 +// if (!$this->verify()) { +// $this->debugLog('签名以及支付状态验证失败'); +// return '签名以及支付状态验证失败'; +// } + + return $this->payNotify(); + } + + + + //统一验证签名 + public function verify() + { + $params = $this->result_data; + + $key = $this->pay_config['token']; + + $sign=$this->sign($params,$key,['sign']); + if (isset($params['sign']) && $sign == $params['sign']) { + return true; + } else { + return false; + } + } + + /** + * 同步回调 + * @return \Illuminate\Http\RedirectResponse + */ + public function returnPay() + { + //判断是否是商户id + if ($this->order->merchant_id == 0) { + return redirect()->route('web.user.index'); + } + // + return $this->merchantReturnSend(); + } + + //异步回调 + + /** + * 获得通道信息,取得支付配置模型,验证签名, + * @return bool|void + */ + private function payNotify() + { + //取得通道信息内容 + $data = $this->result_data; + $this->pay_data = $this->result_data; + //如果应答状态不是01/A6表示支付失败 + $this->debugLog(json_encode($data, true)); + $this->debugLog('-------------' . $this->order->order_sn . '--选择----' . $this->pay_type . '----' . $this->pay_method . '----开始回调处理-------------------------'); + if (empty($data)) { + return $this->debugLog('验证签名失败', $data); + } + try { + $pay_cn_name = ''; + //统一格式化 + $this->unionHandle($data); + //支付返回信息 + $this->pay_data = $data; + $this->debugLog('验证签名成功,数据', $data); + //更新订单 + $this->updateOrder(); + $this->debugLog('updateOrder Ok'); + + } catch (\Exception $exception) { + $this->debugLog('失败异常内容:' . $exception->getMessage()); + $this->order->notify_status = 1;//支付回调成功 + $this->order->pay_status = 1;//支付状态 + $this->order->pay_ok_at = date('Y-m-d H:i:s'); + $this->order->save();//保存 + Log::channel('pay_success')->info($pay_cn_name . '支付成功,但处理订单失败', ['data' => json_encode($data)]); + + } + + } + + /** + * 统一格式化 + */ + public function unionHandle($data) + { + $result = [ + 'order_sn' => $data['merchantNo'],//我方订单号 + 'pay_order_sn' => $data['orderNo'],//三方的订单号 + 'pay_money' => $data['amount'], //支付金额, +// 'pay_money' => $data['real_fee'], //支付金额, + 'money' => $data['amount'], + 'pay_type' => $this->pay_type, + 'ewm_name' => $data['fromAddress'], + 'account' => '' + ]; + + $this->setResult($result); + Log::channel('pay_success')->info('支付成功', [ + 'pay_type' => $result['pay_type'], 'pay_money' => $result['pay_money'], + 'account' => $result['money'], 'order_sn' => $result['order_sn'], + 'pay_order_sn' => $result['pay_order_sn']]); + + } + + + /** + * 这个调试需要配置在config/logging.php + * @param $pay_type + */ + public function setLogName($pay_type) + { + $this->log_name = $pay_type; + } + + /** + * 模拟post提交 json数据 请求接口 + * @param string $url + * @param bool|true $https + * @param string $method + * @param string $param + * @return mixed + */ + private function ddcurl($url = '', $param = '', $https = true, $method = 'post') + { + $param = json_encode($param, 320); + $ch = curl_init($url); + curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); + + #判断是否为https请求 + if ($https === true) { + curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); + curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false); + } + #判断是否为post请求 + if ($method == 'post') { + curl_setopt($ch, CURLOPT_POST, true); + curl_setopt($ch, CURLOPT_POSTFIELDS, $param); + } + curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-type:application/json')); + + $str = curl_exec($ch); + + curl_close($ch); + return $str; + } + + public function beforeCreateOrder(&$orderData,&$orderInfo){ + //需要增加订单表的usdt_addr + $ret = $this->getUstdAddr(); + if(empty($ret)){ + return false; + } + $orderData['usdt_addr'] = $ret; + $this->debugLog("usdt_add_getis".$ret); + } + + private function getUstdAddr(){ + DB::beginTransaction(); + $addr = UsdtAddr::where('is_checked',1)->orderby('updated_at','desc')->firstOrFail(); + if (!empty($addr)){ + $addr['is_checked'] = 0; + $ret = $addr['addr']; + $r = $addr->save(); + if ($r) { + DB::commit(); + return $ret; + } else { + DB::rollBack(); + return false; + } + }else{ + DB::rollBack(); + return false; + } + } + +} \ No newline at end of file diff --git a/app/ServicePay/ZhanXinPayServices.php b/app/ServicePay/ZhanXinPayServices.php index 37db05f..65dd0dd 100644 --- a/app/ServicePay/ZhanXinPayServices.php +++ b/app/ServicePay/ZhanXinPayServices.php @@ -283,7 +283,7 @@ class ZhanXinPayServices implements PayApiInterface } //这个在pay 之前执行 - public function beforeCreateOrder($orderData){ + public function beforeCreateOrder($orderData,$orderInfo){ $merchant = \App\Models\Merchant::where('id', $orderData['merchant_id'])->first(); if ($merchant && isset($merchant['total_price']) && !is_null($merchant['total_price'])) { $walts = \App\Models\MerchantWallet::where('merchant_id', $orderData['merchant_id'])->first(); diff --git a/config/adconfig.php b/config/adconfig.php index c0f5ff2..2a4f193 100644 --- a/config/adconfig.php +++ b/config/adconfig.php @@ -41,7 +41,7 @@ return [ // 'tr_weixin' => '固码微信收款', // 'tr_alipay' => '固码支付宝收款', // 'tr_bank' => '固码银行收款', - 'tr_bank2' => '银行转账收款', +// 'tr_bank2' => '银行转账收款', // 'unionpay' => '银联支付', // 'usdtpay' => '数字货币USDT', // 'citpay' => '数字货币CitPay', @@ -75,6 +75,8 @@ return [ // '1014' =>'fx_支付宝直充', // '1015' =>'微信直充扫码', // '1016' =>'gopay', + '1017' =>'ustdwallet', + ], 'payfor_status' => [ 0 => '等待处理', diff --git a/config/cache.php b/config/cache.php index 0db5c6b..ef6e650 100644 --- a/config/cache.php +++ b/config/cache.php @@ -72,7 +72,7 @@ return [ 'redis' => [ 'driver' => 'redis', - 'connection' => 'default', + 'connection' => 'cache', ], ], @@ -88,6 +88,7 @@ return [ | */ - 'prefix' => env('CACHE_PREFIX', Str::slug(env('APP_NAME', 'laravel'), '_') . '_cache'), + 'prefix' =>'', + //env('CACHE_PREFIX', Str::slug(env('APP_NAME', 'laravel'), '_') . '_cache'), ]; diff --git a/config/database.php b/config/database.php index a0adbae..989f59b 100644 --- a/config/database.php +++ b/config/database.php @@ -114,6 +114,12 @@ return [ 'port' => env('REDIS_PORT', 6379), 'database' => 0, ], + 'cache' => [ + 'host' => env('REDIS_HOST', '127.0.0.1'), + 'password' => env('REDIS_PASSWORD', null), + 'port' => env('REDIS_PORT', 6379), + 'database' => 1, + ], ], diff --git a/routes/pay.php b/routes/pay.php index df57d33..763adba 100644 --- a/routes/pay.php +++ b/routes/pay.php @@ -24,8 +24,8 @@ Route::name('web.pay.')->group(function ($route) { Route::group(['prefix' => 'pay'], 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'); + $route->any('/returnback', 'ApiPayController@scanOrderBack')->name('scan.return');//对接三方的api + $route->any('/banknotify', 'PayController@bankCardNotify')->name('bankCardNotify');//全球支付,用的银行卡短信匹配 });