1,//调试 'logDir' => to_linux_path(storage_path() . '/logs/'), 'mch_id' => $this->pay_gateway['app_id'], //客户交易者账号 'token' => $this->pay_gateway['app_key'],//密钥 'interface' => $this->pay_gateway['mch_id'],//账号名称 一般用来存放三方通道 'return_url' => action('Pay\PayController@returnNotify', ['type' => $type]), 'notify_url' => action('Pay\PayController@notify', ['type' => $type]), ]; $this->pay_config = $config; } /** * 网关域名 * @return string */ protected function getGateUrl(): string { if (isset($this->pay_gateway['gateway_url']) && !empty(trim($this->pay_gateway['gateway_url']))) { return rtrim(trim($this->pay_gateway['gateway_url']), '/'); } return ''; } protected function returnPayRes($re_type,$msg,$code,$url=''){ if ($code == 1) { if ($re_type == 'json') { return json_encode(['code' => 1, 'qrurl' => $url], 256); } else { return redirect()->away($url); } } else { if ($re_type == 'json') { return json_encode(['code' => 0, 'msg' => $msg], 256); } else { return $msg; } } } protected function checkWhiteIP($gate_way){ $ip = request()->getClientIp(); if (isset($gate_way['whiteip'])) { $whiteip = $gate_way['whiteip']; if (empty($whiteip)) { return true; } $whiteip = str_replace('\n', ',', $whiteip); $ipArr = explode(',', $whiteip); $this->debugLog('回调IP', [$ip, $whiteip]); if (is_array($ipArr)) { if (!in_array($ip, $ipArr)) { return false; } } } return true; } }