2020.02新版

This commit is contained in:
Blokura
2020-02-21 16:20:55 +08:00
parent 45e2415d71
commit a2f29a310b
755 changed files with 95144 additions and 0 deletions

View File

@@ -0,0 +1,46 @@
<?php
/**
* qpayMachAPI.php 业务调用方可做二次封装
* Created by HelloWorld
* vers: v1.0.0
* User: Tencent.com
*/
require_once (PAY_ROOT.'inc/qpayMchUtil.class.php');
class QpayMchAPI{
protected $url;
protected $isSSL;
protected $timeout;
/**
* QpayMchAPI constructor.
*
* @param $url 接口url
* @param $isSSL 是否使用证书发送请求
* @param int $timeout 超时
*/
public function __construct($url, $isSSL, $timeout = 5){
$this->url = $url;
$this->isSSL = $isSSL;
$this->timeout = $timeout;
}
public function reqQpay($params){
$ret = array();
//商户号
$params["mch_id"] = QpayMchConf::MCH_ID;
//随机字符串
$params["nonce_str"] = QpayMchUtil::createNoncestr();
//签名
$params["sign"] = QpayMchUtil::getSign($params);
//生成xml
$xml = QpayMchUtil::arrayToXml($params);
if(isset($this->isSSL)){
$ret = QpayMchUtil::reqByCurlSSLPost($xml, $this->url, $this->timeout);
}else{
$ret = QpayMchUtil::reqByCurlNormalPost($xml, $this->url, $this->timeout);
}
return $ret;
}
}