增加docke部署

This commit is contained in:
2026-04-10 16:44:13 +08:00
parent e2f8054794
commit cd4ddb606d
5076 changed files with 701092 additions and 0 deletions

View File

@@ -0,0 +1,260 @@
<?php
/* *
* 功能支付宝手机网站alipay.trade.close (统一收单交易关闭接口)业务参数封装
* 版本2.0
* 修改日期2016-11-01
* 说明:
* 以下代码只是为了方便商户测试而提供的样例代码,商户可以根据自己网站的需要,按照技术文档编写,并非一定要使用该代码。
*/
require_once dirname(dirname(__DIR__)) . DIRECTORY_SEPARATOR . 'AopSdk.php';
//require dirname(dirname(__DIR__)) . DIRECTORY_SEPARATOR . 'config.php';
class AlipayTradeService_wappay
{
//支付宝网关地址
public $gateway_url = "https://openapi.alipay.com/gateway.do";
//支付宝公钥
public $alipay_public_key;
public $alipay_public_key_filepath;
//商户私钥
public $private_key;
//
public $private_key_filepath;
//应用id
public $appid;
//编码格式
public $charset = "UTF-8";
public $token = null;
//返回数据格式
public $format = "json";
//签名方式
public $signtype = "RSA";
function __construct($alipay_config)
{
$this->gateway_url = $alipay_config['gatewayUrl'];
$this->appid = $alipay_config['app_id'];
$this->private_key = $alipay_config['merchant_private_key'];
$this->private_key_filepath = $alipay_config['merchant_private_key_filepath'];
$this->alipay_public_key = $alipay_config['alipay_public_key'];
$this->alipay_public_key_filepath = $alipay_config['alipay_public_key_filepath'];
$this->charset = $alipay_config['charset'];
$this->signtype = $alipay_config['sign_type'];
if (empty($this->appid) || trim($this->appid) == "")
throw new Exception("appid should not be NULL!");
if ((empty($this->private_key) || trim($this->private_key) == "") && (empty($this->private_key_filepath) || trim($this->private_key_filepath) == ''))
throw new Exception("private_key should not be NULL!");
if ((empty($this->alipay_public_key) || trim($this->alipay_public_key) == "") && (empty($this->alipay_public_key_filepath) || trim($this->alipay_public_key_filepath) == ''))
throw new Exception("alipay_public_key should not be NULL!");
if (empty($this->charset) || trim($this->charset) == "")
throw new Exception("charset should not be NULL!");
if (empty($this->gateway_url) || trim($this->gateway_url) == "")
throw new Exception("gateway_url should not be NULL!");
}
function AlipayWapPayService($alipay_config)
{
$this->__construct($alipay_config);
}
/**
* alipay.trade.wap.pay
* @param AlipayTradeWapPayContentBuilder $builder 业务参数使用buildmodel中的对象生成。
* @param string $return_url 同步跳转地址,公网可访问
* @param string $notify_url 异步通知地址,公网可以访问
* @return string $response 支付宝返回的信息
*/
function wapPay($builder, $return_url, $notify_url)
{
$biz_content = $builder->getBizContent();
/// 打印业务参数
//$this->writeLog($biz_content);
$request = new AlipayTradeWapPayRequest();
$request->setNotifyUrl($notify_url);
$request->setReturnUrl($return_url);
$request->setBizContent($biz_content);
// 首先调用支付api
$response = $this->aopclientRequestExecute($request, true);
// $response = $response->alipay_trade_wap_pay_response;
return $response;
}
function aopclientRequestExecute($request, $ispage = false)
{
$aop = new AopClient();
$aop->gatewayUrl = $this->gateway_url;
$aop->appId = $this->appid;
$aop->rsaPrivateKey = $this->private_key;
$aop->rsaPrivateKeyFilePath = $this->private_key_filepath;
$aop->alipayrsaPublicKey = $this->alipay_public_key;
$aop->alipayPublicKey = $this->alipay_public_key_filepath;
$aop->apiVersion = "1.0";
$aop->postCharset = $this->charset;
$aop->format = $this->format;
$aop->signType = $this->signtype;
// 开启页面信息输出
$aop->debugInfo = true;
if ($ispage)
{
$result = $aop->pageExecute($request, "post");
echo $result;
}
else
$result = $aop->Execute($request);
/// 打开后将报文写入log文件
//$this->writeLog("response: " . var_export($result, true));
return $result;
}
/**
* alipay.trade.query (统一收单线下交易查询)
* @param $builder 业务参数使用buildmodel中的对象生成。
* @return $response 支付宝返回的信息
*/
function Query($builder)
{
$biz_content = $builder->getBizContent();
/// 打印业务参数
//$this->writeLog($biz_content);
$request = new AlipayTradeQueryRequest();
$request->setBizContent($biz_content);
// 首先调用支付api
$response = $this->aopclientRequestExecute($request);
$response = $response->alipay_trade_query_response;
//var_dump($response);
return $response;
}
/**
* alipay.trade.refund (统一收单交易退款接口)
* @param AlipayTradeRefundContentBuilder_wappay $builder 业务参数使用buildmodel中的对象生成。
* @return string $response 支付宝返回的信息
*/
function Refund($builder)
{
$biz_content = $builder->getBizContent();
/// 打印业务参数
//$this->writeLog($biz_content);
$request = new AlipayTradeRefundRequest();
$request->setBizContent($biz_content);
/// 首先调用支付api
$response = $this->aopclientRequestExecute($request);
$response = $response->alipay_trade_refund_response;
//var_dump($response);
return $response;
}
/**
* alipay.trade.close (统一收单交易关闭接口)
* @param $builder 业务参数使用buildmodel中的对象生成。
* @return string $response 支付宝返回的信息
*/
function Close($builder)
{
$biz_content = $builder->getBizContent();
/// 打印业务参数
//$this->writeLog($biz_content);
$request = new AlipayTradeCloseRequest();
$request->setBizContent($biz_content);
// 首先调用支付api
$response = $this->aopclientRequestExecute($request);
$response = $response->alipay_trade_close_response;
//var_dump($response);
return $response;
}
/**
* 退款查询 alipay.trade.fastpay.refund.query (统一收单交易退款查询)
* @param $builder 业务参数使用buildmodel中的对象生成。
* @return $response 支付宝返回的信息
*/
function refundQuery($builder)
{
$biz_content = $builder->getBizContent();
/// 打印业务参数
//$this->writeLog($biz_content);
$request = new AlipayTradeFastpayRefundQueryRequest();
$request->setBizContent($biz_content);
// 首先调用支付api
$response = $this->aopclientRequestExecute($request);
//var_dump($response);
return $response;
}
/**
* alipay.data.dataservice.bill.downloadurl.query (查询对账单下载地址)
* @param $builder 业务参数使用buildmodel中的对象生成。
* @return $response 支付宝返回的信息
*/
function downloadurlQuery($builder)
{
$biz_content = $builder->getBizContent();
/// 打印业务参数
//$this->writeLog($biz_content);
$request = new alipaydatadataservicebilldownloadurlqueryRequest();
$request->setBizContent($biz_content);
// 首先调用支付api
$response = $this->aopclientRequestExecute($request);
$response = $response->alipay_data_dataservice_bill_downloadurl_query_response;
//var_dump($response);
return $response;
}
/**
* 验签方法
* @param $arr 验签支付宝返回的信息,使用支付宝公钥。
* @return boolean
*/
function check($arr)
{
$aop = new AopClient();
$aop->alipayrsaPublicKey = $this->alipay_public_key;
$aop->alipayPublicKey = $this->alipay_public_key_filepath;
$result = $aop->rsaCheckV1($arr, $this->alipay_public_key_filepath, $this->signtype);
return $result;
}
//请确保项目文件有可写权限,不然打印不了日志。
function writeLog($text)
{
// $text=iconv("GBK", "UTF-8//IGNORE", $text);
//$text = characet ( $text );
file_put_contents(dirname(__FILE__) . DIRECTORY_SEPARATOR . "./../../log.txt", date("Y-m-d H:i:s") . " " . $text . "\r\n", FILE_APPEND);
}
/** *利用google api生成二维码图片
* $content二维码内容参数
* $size生成二维码的尺寸宽度和高度的值
* $lev可选参数纠错等级
* $margin生成的二维码离边框的距离
*/
function create_erweima($content, $size = '200', $lev = 'L', $margin = '0')
{
$content = urlencode($content);
$image = '<img src="http://chart.apis.google.com/chart?chs=' . $size . 'x' . $size . '&amp;cht=qr&chld=' . $lev . '|' . $margin . '&amp;chl=' . $content . '" widht="' . $size . '" height="' . $size . '" />';
return $image;
}
}
?>