Commit da5a1009 authored by liuyuzhen's avatar liuyuzhen

测试

parent 382c6bbb
......@@ -21,8 +21,6 @@ class TencentPay {
protected $s_appid ='';
protected $s_key = '';
protected $s_mch_id ='';
protected $s_sslcert_path = 'application/library/Payment/cert/wxservice/1517411161_20181102_cert.pem';
protected $s_sslkey_path = 'application/library/Payment/cert/wxservice/1517411161_20181102_key.pem';
protected $prepay_id ='';
protected $tradeType = '';
public $data;//接收到的数据,类型为关联数组
......@@ -205,14 +203,8 @@ class TencentPay {
/**
* 作用:使用证书,以post方式提交xml到对应的接口url
*/
function postXmlSSLCurl($xml,$url,$second=30,$serviceFlag=false)
function postXmlSSLCurl($xml,$url,$second=30)
{
$certPath = APPLICATION_PATH.$this->sslcert_path;
$keyPath = APPLICATION_PATH.$this->sslkey_path;
if($serviceFlag){
$certPath = APPLICATION_PATH.$this->s_sslcert_path;
$keyPath = APPLICATION_PATH.$this->s_sslkey_path;
}
$ch = curl_init();
//超时时间
curl_setopt($ch,CURLOPT_TIMEOUT,$second);
......@@ -230,10 +222,10 @@ class TencentPay {
//使用证书:cert 与 key 分别属于两个.pem文件
//默认格式为PEM,可以注释
curl_setopt($ch,CURLOPT_SSLCERTTYPE,'PEM');
curl_setopt($ch,CURLOPT_SSLCERT, $certPath);
curl_setopt($ch,CURLOPT_SSLCERT, APPLICATION_PATH.$this->sslcert_path);
//默认格式为PEM,可以注释
curl_setopt($ch,CURLOPT_SSLKEYTYPE,'PEM');
curl_setopt($ch,CURLOPT_SSLKEY, $keyPath);
curl_setopt($ch,CURLOPT_SSLKEY, APPLICATION_PATH.$this->sslkey_path);
//post提交方式
curl_setopt($ch,CURLOPT_POST, true);
curl_setopt($ch,CURLOPT_POSTFIELDS,$xml);
......@@ -347,11 +339,13 @@ class TencentPay {
}
$returnXml = $this->returnXml();;
if($verify) {
return array(
$returnXml = array(
'out_trade_no' => $this->data['out_trade_no'],
'trade_no' => $this->data['transaction_id'],
'returnXml'=>$returnXml
);
\Our\Log::getInstance()->write(json_encode($returnXml,true),'/data/log/applog');
return $returnXml;
}
return false;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment