commit
0e1453961c
@ -0,0 +1,243 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no">
|
||||
<link rel="stylesheet" href="__CSS__/weui.mim.css">
|
||||
<link rel="stylesheet" href="__CSS__/sdkptbpay.css">
|
||||
<script src="__JS__/resize.js" type=""></script>
|
||||
<title>支付结果</title>
|
||||
</head>
|
||||
<body>
|
||||
<div class="callback-box" style="padding-top: 100px;box-sizing: border-box;">
|
||||
<input type="hidden" name="pay_order_number" class="orderno" value="{$orderno}">
|
||||
<input type="hidden" name="Scheme" class="Scheme" value="{$Scheme}">
|
||||
<input type="hidden" name="sdk_version" id="sdk_version" class="sdk_version" value="{$sdk_version}">
|
||||
<input type="hidden" name="at_once" class="at_once" value="{$at_once}">
|
||||
<input type="hidden" name="gopay_url" class="gopay_url" value='{$gopay_url}'>
|
||||
<input type="hidden" name="gopay" class="gopay" value="{$gopay}">
|
||||
<input type="hidden" name="aliapp" class="aliapp" value="{$aliapp}">
|
||||
<input type="hidden" name="sqzfb" class="sqzfb" value="{$sqzfb}">
|
||||
<input type="hidden" name="user_token" class="user_token" value="{$user_token}">
|
||||
<input type="hidden" name="game_id" class="game_id" value="{$game_id}">
|
||||
|
||||
<!-- <div class="close" onclick="javascript:history.go(-1);">
|
||||
<a href="javascript:">
|
||||
<img src="__IMG__/callback/close.png">
|
||||
</a>
|
||||
</div> -->
|
||||
<div id="toast" style="display: none;">
|
||||
<div class="weui-mask_transparent"></div>
|
||||
<div class="weui-toast" style="min-height: 0px;">
|
||||
<!-- <i class="weui-icon-success-no-circle weui-icon_toast"></i> -->
|
||||
<p class="weui-toast__content" style="margin:15px;"><span id="paytype">支付成功</span><br/><span style="font-size: .24rem;">2秒后将自动跳转</span></p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="wxicon" style="display: flex;flex-direction: column;justify-content: center; align-items: center;">
|
||||
<img src="__IMG__/shortcut_payed.png">
|
||||
<span style="font-size: 0.28rem; color:#FEB957;margin-top:0.3rem;">支付成功</span>
|
||||
</div>
|
||||
<div class="paydesc" style="margin-bottom: 2.4rem;">
|
||||
<div>
|
||||
<p id ="testn" style="text-align: center; font-size: 0.28rem;color:rgba(0,0,0,1);">您已充值平台币:</p>
|
||||
<p style="text-align: center;font-size: 0.8rem; font-weight:500;font-family:PingFang SC;color:rgba(0,0,0,1);">¥{$price}</p>
|
||||
<br/><br/>
|
||||
<p/><br/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="btn2">
|
||||
<a id="payed" data-order="{$pay_order_number}" href="javascript:" style="background:url('__IMG__/callback/btn2.png') no-repeat center center/100% 100%;background-color: #21B1EB; border-radius: 0.35rem; color: white;">
|
||||
已完成付款
|
||||
</a>
|
||||
</div>
|
||||
|
||||
<!-- <div class="btn2">
|
||||
<a id="payed1" data-order="{$pay_order_number}" href="javascript:" style="background:url('__IMG__/callback/btn2.png') no-repeat center center/100% 100%;">
|
||||
跳成功
|
||||
</a>
|
||||
</div>
|
||||
|
||||
<div class="btn2">
|
||||
<a id="payed2" data-order="{$pay_order_number}" href="javascript:" style="background:url('__IMG__/callback/btn2.png') no-repeat center center/100% 100%;">
|
||||
跳失败
|
||||
</a>
|
||||
</div> -->
|
||||
<div class="whitesc"></div>
|
||||
</div>
|
||||
|
||||
</body>
|
||||
<script src="__JS__/jquery.min.js"></script>
|
||||
<script>
|
||||
|
||||
function paycallback() {
|
||||
$("#payed").click();
|
||||
}
|
||||
|
||||
$(function() {
|
||||
$(window).load( function(){
|
||||
if ($(".gopay").val() == 1) {
|
||||
if ($(".aliapp").val() == 1) {
|
||||
var url = $(".gopay_url").val();
|
||||
if ($('#sdk_version').val() == 0) {
|
||||
var u = navigator.userAgent;
|
||||
var isAndroid = u.indexOf('Android') > -1 || u.indexOf('Adr') > -1; //android终端
|
||||
if (isAndroid) {
|
||||
window.txyxsdk.getZFBPay(url);
|
||||
} else {
|
||||
window.webkit.messageHandlers.noticeAppResult.postMessage(url);
|
||||
}
|
||||
} else if ($('#sdk_version').val() == 1) {
|
||||
window.txyxsdk.getZFBPay(url);
|
||||
} else {
|
||||
window.webkit.messageHandlers.noticeAppResult.postMessage(url);
|
||||
}
|
||||
|
||||
} else {
|
||||
if ($(".gopay_url").val()) {
|
||||
window.location.href = $(".gopay_url").val();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
/* $("#payed1").click(function(){
|
||||
var Scheme=$('.Scheme').val();
|
||||
window.location.href = Scheme+"://1&back";
|
||||
|
||||
});
|
||||
$("#payed2").click(function(){
|
||||
var Scheme=$('.Scheme').val();
|
||||
window.location.href = Scheme+"://0&back";
|
||||
|
||||
}); */
|
||||
|
||||
$("#payed").click(function() {
|
||||
var orderno=$('.orderno').val();
|
||||
var device=$('.device').val();
|
||||
var Scheme=$('.Scheme').val();
|
||||
var user_token = $('.user_token').val();
|
||||
var game_id = $('.game_id').val();
|
||||
|
||||
$.ajax({
|
||||
type: "post",
|
||||
url: "/sdk.php/Spend/order_status",
|
||||
dataType: "json",
|
||||
data: {
|
||||
'orderno' : orderno,
|
||||
'user_token' : user_token,
|
||||
'game_id' : game_id,
|
||||
},
|
||||
success: function(r) {
|
||||
var u = navigator.userAgent;
|
||||
var isAndroid = u.indexOf('Android') > -1 || u.indexOf('Adr') > -1; //android终端
|
||||
var isSafari = u.indexOf('Safari') > -1 || u.indexOf('safari') > -1; //android终端
|
||||
|
||||
if (r.type == "deposit") {
|
||||
if (r.payStatus == '1') {
|
||||
// 提示支付成功
|
||||
$("#paytype").html("支付成功");
|
||||
if (!isAndroid) {
|
||||
if (isSafari) {
|
||||
window.location.href = Scheme+"://1";
|
||||
} else {
|
||||
$("#toast").show();
|
||||
setTimeout(function(){
|
||||
window.location.href = r.url;
|
||||
},2000)
|
||||
}
|
||||
/* try {
|
||||
window.webkit.messageHandlers.exchangeResult.postMessage(1);
|
||||
} catch(err) {
|
||||
|
||||
window.location.href = Scheme+"://1";
|
||||
} */
|
||||
}
|
||||
} else {
|
||||
// 提示支付失败
|
||||
$("#paytype").html("支付失败");
|
||||
if (!isAndroid) {
|
||||
if (isSafari) {
|
||||
window.location.href = Scheme+"://0";
|
||||
} else {
|
||||
$("#toast").show();
|
||||
setTimeout(function(){
|
||||
window.location.href = r.url;
|
||||
},2000)
|
||||
}
|
||||
|
||||
/* try {
|
||||
window.webkit.messageHandlers.exchangeResult.postMessage(0);
|
||||
// window.location.href = r.url;
|
||||
} catch(err) {
|
||||
window.location.href = Scheme+"://0";
|
||||
} */
|
||||
}
|
||||
}
|
||||
|
||||
if (isAndroid) {
|
||||
$("#toast").show();
|
||||
setTimeout(function(){
|
||||
window.location.href = r.url;
|
||||
},2000)
|
||||
}
|
||||
}
|
||||
|
||||
if (r.type == "spend") {
|
||||
if (r.payStatus == '1') {
|
||||
if (isAndroid) {
|
||||
window.txyxsdk.getPayResult('succeed');
|
||||
} else {
|
||||
try {
|
||||
window.webkit.messageHandlers.exchangeResult.postMessage(1);
|
||||
} catch(err) {
|
||||
window.location.href = Scheme+"://1&back";
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (isAndroid) {
|
||||
window.txyxsdk.getPayResult('fail');
|
||||
} else {
|
||||
try {
|
||||
window.webkit.messageHandlers.exchangeResult.postMessage(0);
|
||||
} catch(err) {
|
||||
window.location.href = Scheme+"://0&back";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
|
||||
$('#alipay').on('click',function() {
|
||||
var that = $(this);
|
||||
var url = $.trim(that.attr('data-url'));
|
||||
if ($(".aliapp").val() == 1) {
|
||||
if ($('#sdk_version').val() == 0) {
|
||||
var u = navigator.userAgent;
|
||||
var isAndroid = u.indexOf('Android') > -1 || u.indexOf('Adr') > -1; //android终端
|
||||
if (isAndroid) {
|
||||
window.txyxsdk.getZFBPay(url);
|
||||
} else {
|
||||
window.webkit.messageHandlers.noticeAppResult.postMessage(url);
|
||||
}
|
||||
} else if ($('#sdk_version').val() == 1) {
|
||||
window.txyxsdk.getZFBPay(url);
|
||||
} else {
|
||||
window.webkit.messageHandlers.noticeAppResult.postMessage(url);
|
||||
}
|
||||
} else {
|
||||
window.location.href = url;
|
||||
}
|
||||
|
||||
return false;
|
||||
});
|
||||
|
||||
});
|
||||
</script>
|
||||
</html>
|
Binary file not shown.
After Width: | Height: | Size: 2.7 KiB |
@ -0,0 +1,146 @@
|
||||
<?php
|
||||
namespace Org\YeepaySDK;
|
||||
|
||||
|
||||
require_once("lib/YopRequest.php");
|
||||
require_once("lib/YopClient3.php");
|
||||
require_once("lib/Util/YopSignUtils.php");
|
||||
|
||||
use Think\Exception;
|
||||
use Qiniu\json_decode;
|
||||
use Think\Log;
|
||||
|
||||
class Yeepay
|
||||
{
|
||||
public function yee_pay($data) {
|
||||
if (!$data['orderId'] || !$data['orderAmount'] || !$data['notifyUrl'] || !$data['goodsParamExt'] || !$data['paymentParamExt']) {
|
||||
return -2; // 必传参数有误
|
||||
}
|
||||
include 'conf.php';
|
||||
|
||||
$appKey = $data['appKey'];
|
||||
$privateKey = $data['privateKey'];
|
||||
$parentMerchantNo = $data['parentMerchantNo'];
|
||||
$merchantNo = $data['merchantNo'];
|
||||
$request = new \YopRequest($appKey, $privateKey);
|
||||
$request->addParam("parentMerchantNo", $parentMerchantNo);
|
||||
$request->addParam("merchantNo", $merchantNo);
|
||||
$request->addParam("orderId", $data['orderId']);
|
||||
$request->addParam("orderAmount", $data['orderAmount']);
|
||||
$request->addParam("timeoutExpress", $data['timeoutExpress'] ?? '');
|
||||
$request->addParam("requestDate", $data['requestDate'] ?? date('Y-m-d H:i:s'));
|
||||
$request->addParam("redirectUrl", $data['redirectUrl'] ?? '');
|
||||
$request->addParam("notifyUrl", $data['notifyUrl']);
|
||||
$request->addParam("goodsParamExt", $data['goodsParamExt']);
|
||||
$request->addParam("paymentParamExt", $data['paymentParamExt']);
|
||||
$request->addParam("industryParamExt", $data['industryParamExt'] ?? '');
|
||||
$request->addParam("memo", $data['memo'] ?? '');
|
||||
$request->addParam("riskParamExt", $data['riskParamExt'] ?? '');
|
||||
$request->addParam("csUrl", $data['csUrl'] ?? '');
|
||||
$request->addParam("fundProcessType", $data['fundProcessType'] ?? 'REAL_TIME');
|
||||
$request->addParam("divideDetail", $data['divideDetail'] ?? '');
|
||||
$request->addParam("divideNotifyUrl", $data['divideNotifyUrl'] ?? '');
|
||||
|
||||
|
||||
$response = \YopClient3::post("/rest/v1.0/std/trade/order", $request);
|
||||
if($response->validSign != 1){
|
||||
echo "签名验证失败!\n";
|
||||
return -1; // 签名验证失败
|
||||
}
|
||||
//取得返回结果
|
||||
$data = $this->object_array($response);
|
||||
|
||||
$token=$data['result']['token'];
|
||||
$cashter = array(
|
||||
"merchantNo" => $merchantNo ,
|
||||
"token" => $token,
|
||||
"timestamp" => time(),
|
||||
"directPayType" => $data['directPayType'] ?? 'YJZF',
|
||||
"cardType" => $data['cardType'] ?? '',
|
||||
"userNo" => $data['userNo'] ?? '',
|
||||
"userType" => $data['userType'] ?? '',
|
||||
"ext" => $data['ext'] ?? '',
|
||||
);
|
||||
// var_dump($data);
|
||||
$getUrl = $this->getUrl($cashter, $privateKey);
|
||||
$getUrl=str_replace("×tamp","&timestamp",$getUrl);
|
||||
$url = "https://cash.yeepay.com/cashier/std?" . $getUrl;
|
||||
// echo $url;
|
||||
return array('url' => $url, 'data' => $data);
|
||||
|
||||
}
|
||||
|
||||
private function getString($response){
|
||||
|
||||
$str="";
|
||||
|
||||
foreach ($response as $key => $value) {
|
||||
$str .= $key . "=" . $value . "&";
|
||||
}
|
||||
$getSign = substr($str, 0, strlen($str) - 1);
|
||||
return $getSign;
|
||||
}
|
||||
|
||||
private function getUrl($response,$private_key)
|
||||
{
|
||||
$content= $this->getString($response);
|
||||
$sign = \YopSignUtils::signRsa($content,$private_key);
|
||||
$url=$content."&sign=".$sign;
|
||||
return $url;
|
||||
}
|
||||
|
||||
private function object_array($array) {
|
||||
if(is_object($array)) {
|
||||
$array = (array)$array;
|
||||
} if(is_array($array)) {
|
||||
foreach($array as $key=>$value) {
|
||||
$array[$key] = $this->object_array($value);
|
||||
}
|
||||
}
|
||||
return $array;
|
||||
}
|
||||
|
||||
public function getBank($data) {
|
||||
|
||||
if (!$data['bankCardNo']) {
|
||||
return -2; // 必传参数有误
|
||||
}
|
||||
include 'conf.php';
|
||||
|
||||
$request = new \YopRequest($appKey, $private_key);
|
||||
$request->addParam("bankCardNo", $data['bankCardNo']);
|
||||
|
||||
$response = \YopClient3::post("/rest/v1.0/sys/merchant/query-bank-card-bin-info", $request);
|
||||
if($response->validSign != 1){
|
||||
echo "签名验证失败!\n";
|
||||
return -1; // 签名验证失败
|
||||
}
|
||||
//取得返回结果
|
||||
$data = $this->object_array($response);
|
||||
|
||||
var_dump($data);die;
|
||||
$token=$data['result']['token'];
|
||||
$cashter = array(
|
||||
"merchantNo" => $merchantNo ,
|
||||
"token" => $token,
|
||||
"timestamp" => time(),
|
||||
"directPayType" => $data['directPayType'] ?? '',
|
||||
"cardType" => $data['cardType'] ?? '',
|
||||
"userNo" => $data['userNo'] ?? '',
|
||||
"userType" => $data['userType'] ?? '',
|
||||
"ext" => $data['ext'] ?? '',
|
||||
);
|
||||
// var_dump($data);
|
||||
$getUrl = $this->getUrl($cashter, $private_key);
|
||||
$getUrl=str_replace("×tamp","&timestamp",$getUrl);
|
||||
$url = "https://cash.yeepay.com/cashier/std?" . $getUrl;
|
||||
echo $url;
|
||||
return array('url' => $url, 'data' => $data);
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
@ -0,0 +1,10 @@
|
||||
<?php
|
||||
$appKey="OPR:10000466938";
|
||||
$merchantNo="10000466938";
|
||||
$parentMerchantNo="10000466938";
|
||||
|
||||
$yop_public_key = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA6p0XWjscY+gsyqKRhw9MeLsEmhFdBRhT2emOck/F1Omw38ZWhJxh9kDfs5HzFJMrVozgU+SJFDONxs8UB0wMILKRmqfLcfClG9MyCNuJkkfm0HFQv1hRGdOvZPXj3Bckuwa7FrEXBRYUhK7vJ40afumspthmse6bs6mZxNn/mALZ2X07uznOrrc2rk41Y2HftduxZw6T4EmtWuN2x4CZ8gwSyPAW5ZzZJLQ6tZDojBK4GZTAGhnn3bg5bBsBlw2+FLkCQBuDsJVsFPiGh/b6K/+zGTvWyUcu+LUj2MejYQELDO3i2vQXVDk7lVi2/TcUYefvIcssnzsfCfjaorxsuwIDAQAB";
|
||||
|
||||
$private_key = "MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQDKLgI+64mmJdNg1TwlCPBnNH3b3qfw2TdHVc2uDd4LTyQI8nRr0heFhhdj0OZi6agqekIyzAH/XmO9PdLrTi4YXJXOfiO/dYwKA6gSktRe6FKY4C2WzX1yA4fGfqJMV7RYVoL6In50Hur6rGnavNSQZqbiDJOgy5yokJ14Mey1iMqqqWvADtKN9SqxtbyIxYD/jj/6qLWwmu88wSwSaGdO3wNFgzajsHgRJe9G9IhD0zr5d72HvJGoedq7VaPn3jhIszcPQE6oqbXAddZRGKBehA4WSCjLEl87XH33zZPrxrQlBTHVVGzfxjbB4QvYz0hlEoWh1ntxeDHTfgyhdPQpAgMBAAECggEATmxMSLW6Xe08McpkmwT9ozq0Oy4BvKW1EIGS15nfcEmRc7sAN7Z1k0BxIDGuu91gcqGbvfJuL+0gCQ7LGqTnsmFvZnp9SU3CNTw33ISBxhKdv1jtthodN7Vw3CjQsYYvmThtc7Mfk9FOWk+4e7VVSnHW98XjGbMBIE2AF1heNgeZ40ubdgzuz9+4g4pphjWncPpwcaMfsDZm3JtFyvUp0+LME0CmUqrxvONZAkpFR/PyejGHnIh3ptHzhe/VjNcuIC4PphkCNBakCBCrtohTy0YeeWfDAUTAO4tPXF/JUhlxjPuqR6rpQY/0uQdMAtTpiWHVJar7eGdK81QnuuOFRQKBgQDrklUPM0pkvGG/wREa0bgUI+ki+1/wv7O8X94/8onomJqPpkD8z4hv/Lev/wD5gDcgmgLC36u/XDuhFfVNOmw4eUWenU6pzonroEjhi91AKcRRfzDfOfWg3wPm1J9WQOn5A033tNRydCpVcX/Ot4qDbKcAwLiPNPXXMTn4LUQE/wKBgQDbtmE0KS/kSfjscWJOqwv1XbxckipkxncqIbdiSdU+DzaLd+Vuaco7TLQJRFp7S7WJW4Tz6KBX2UiA7O7ezXY9PwlgXxXiZDDtneXNAqk7DNxmTTZHrF2C7qdU98klppCFiFx9bysGY6lFWofWmg3Pu5IiPqO3iLRPTvZgQOE+1wKBgQC9SCgmfYzyIlfcjtIinY5uSGiEnjz5od9WpiVbdpOPHEdc0zZ2rH6xlPs3ZAuxbm9dN8KuOLC0ovSau50Nv7rDKdZh234gfP9fH7xP1mUhsC25Why30MdnyqpE6GVbFe+qERitx1PI30RAwWDzhZC7hystNK1XDDPZBAnTOvPjmwKBgDFuujX7IkxRnFDOPdkHQNyGp2+Ib0NXJ85x4YmapQCeeZ4tbpBF+vsWidcf6t+crA5oaeRarWC2gUqIhEHapkSnXxuwqQLTmfKMOPzEIYEoppnZu2Gq1Ss1OK60RSxUamWwxWZvUZXRbG8vLCrLZFodkIZl433SowbI9EO5tTPnAoGAJRsy1z95Q1GPkKrFtKivkxZy1k7zJXjM0VWDc7lT9fBnoeGUyt+vuq+lC5i2aiWKJK7pe8MM9QFDGlWPnly+J8jbyMfm99k5oJtCWDfF0or1pAQ4mw0kjL9TvDVXdojgYA+rxSMQ09hwsYukQ4bblrwfBUmRjLN5WibcRzIW5ZA=";
|
||||
|
||||
?>
|
@ -0,0 +1,43 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Created by PhpStorm.
|
||||
* User: wilson
|
||||
* Date: 16/7/7
|
||||
* Time: 11:07
|
||||
*/
|
||||
abstract class AESEncrypter{
|
||||
/**
|
||||
* 算法,另外还有192和256两种长度
|
||||
*/
|
||||
const CIPHER = MCRYPT_RIJNDAEL_128;
|
||||
/**
|
||||
* 模式
|
||||
*/
|
||||
const MODE = 'AES-128-ECB';
|
||||
|
||||
|
||||
/**
|
||||
* 加密
|
||||
* @param string $str 需加密的字符串
|
||||
* @param string $key 密钥
|
||||
* @return type
|
||||
*/
|
||||
|
||||
|
||||
static public function encode( $str, $key){
|
||||
return base64_encode(openssl_encrypt($str,self::MODE,base64_decode($key),OPENSSL_RAW_DATA));
|
||||
}
|
||||
|
||||
/**
|
||||
* 解密
|
||||
* @param type $str
|
||||
* @param type $key
|
||||
* @return type
|
||||
*/
|
||||
static public function decode( $str, $key ){
|
||||
return openssl_decrypt(base64_decode($str),self::MODE,base64_decode($key),OPENSSL_RAW_DATA);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -0,0 +1,39 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2014-2016 Spomky-Labs
|
||||
*
|
||||
* This software may be modified and distributed under the terms
|
||||
* of the MIT license. See the LICENSE file for details.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Encode and decode data into Base64 Url Safe.
|
||||
*/
|
||||
abstract class Base64Url
|
||||
{
|
||||
/**
|
||||
* @param string $data The data to encode
|
||||
* @param bool $use_padding If true, the "=" padding at end of the encoded value are kept, else it is removed
|
||||
*
|
||||
* @return string The data encoded
|
||||
*/
|
||||
public static function encode($data, $use_padding = false)
|
||||
{
|
||||
$encoded = strtr(base64_encode($data), '+/', '-_');
|
||||
|
||||
return true === $use_padding ? $encoded : rtrim($encoded, '=');
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $data The data to decode
|
||||
*
|
||||
* @return string The data decoded
|
||||
*/
|
||||
public static function decode($data)
|
||||
{
|
||||
return base64_decode(strtr($data, '-_', '+/'));
|
||||
}
|
||||
}
|
@ -0,0 +1,48 @@
|
||||
<?php
|
||||
/**
|
||||
* Created by PhpStorm.
|
||||
* User: wilson
|
||||
* Date: 16/7/7
|
||||
* Time: 16:21
|
||||
*/
|
||||
|
||||
|
||||
abstract class BlowfishEncrypter{
|
||||
/**
|
||||
* 算法,另外还有192和256两种长度
|
||||
*/
|
||||
const CIPHER = MCRYPT_BLOWFISH;
|
||||
/**
|
||||
* 模式
|
||||
*/
|
||||
const MODE = MCRYPT_MODE_CFB;
|
||||
|
||||
/**
|
||||
* 加密
|
||||
* @param string $str 需加密的字符串
|
||||
* @param string $key 密钥
|
||||
* @return type
|
||||
*/
|
||||
static public function encode( $str, $key){
|
||||
echo $str;
|
||||
echo "123456789";
|
||||
echo "<br>";
|
||||
echo $key;
|
||||
$md5Key = md5($key);
|
||||
return base64_encode(mcrypt_encrypt(self::CIPHER, substr($md5Key,0,16), $str, self::MODE, substr($md5Key,0,8)));
|
||||
}
|
||||
|
||||
/**
|
||||
* 解密
|
||||
* @param type $str
|
||||
* @param type $key
|
||||
* @return type
|
||||
*/
|
||||
static public function decode( $str, $key ){
|
||||
$md5Key = md5($key);
|
||||
|
||||
return mcrypt_decrypt(self::CIPHER, substr($md5Key,0,16),base64_decode($str), self::MODE, substr($md5Key,0,8));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -0,0 +1,126 @@
|
||||
<?php
|
||||
|
||||
require_once("HttpUtils.php");
|
||||
error_reporting(E_ALL ^ E_WARNING ^ E_NOTICE);
|
||||
define("LANGS", "php");
|
||||
define("VERSION", "3.2.11");
|
||||
define("USERAGENT", LANGS."/".VERSION."/".PHP_OS."/".$_SERVER ['SERVER_SOFTWARE']."/Zend Framework/".zend_version()."/".PHP_VERSION."/".$_SERVER['HTTP_ACCEPT_LANGUAGE']."/");
|
||||
|
||||
abstract class HTTPRequest{
|
||||
|
||||
/**
|
||||
* 加密
|
||||
* @param string $str 需加密的字符串
|
||||
* @param string $key 密钥
|
||||
* @param string $CIPHER 算法
|
||||
* @param string $MODE 模式
|
||||
* @return type
|
||||
*/
|
||||
static public function curl_request($url, $request){
|
||||
$curl = curl_init();
|
||||
curl_setopt($curl, CURLOPT_USERAGENT, USERAGENT);
|
||||
curl_setopt($curl, CURLOPT_FOLLOWLOCATION, 1);
|
||||
curl_setopt($curl, CURLOPT_AUTOREFERER, 1);
|
||||
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
|
||||
curl_setopt($curl, CURLOPT_HEADER, 1);
|
||||
//curl_setopt($curl, CURLOPT_NOBODY, 0);
|
||||
curl_setopt($curl, CURLOPT_TIMEOUT, $request->readTimeout);
|
||||
curl_setopt($curl, CURLOPT_CONNECTTIMEOUT, $request->connectTimeout);
|
||||
|
||||
$TLS = substr($url, 0, 8) == "https://" ? true : false;
|
||||
if($TLS) {
|
||||
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
|
||||
curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, 2);
|
||||
}
|
||||
|
||||
$request->encoding();
|
||||
|
||||
$headerArray=array();
|
||||
if($request->headers!=null) {
|
||||
foreach ($request->headers as $key => $value) {
|
||||
array_push($headerArray, $key.":".$value);
|
||||
}
|
||||
}
|
||||
array_push($headerArray, "x-yop-sdk-langs:".LANGS);
|
||||
array_push($headerArray, "x-yop-sdk-version:".VERSION);
|
||||
array_push($headerArray, "x-yop-request-id:".$request->requestId);
|
||||
if($request->jsonParam!=null) {
|
||||
array_push($headerArray,'Content-Type: application/json; charset=utf-8',
|
||||
'Content-Length: ' . strlen($request->jsonParam));
|
||||
}
|
||||
curl_setopt($curl, CURLOPT_HTTPHEADER, $headerArray);
|
||||
//curl_setopt($curl, CURLINFO_HEADER_OUT, );
|
||||
|
||||
|
||||
//var_dump($request);
|
||||
//var_dump($request->httpMethod);
|
||||
|
||||
if("POST"==$request->httpMethod) {
|
||||
curl_setopt($curl, CURLOPT_URL, $url);
|
||||
curl_setopt($curl, CURLOPT_POST, 1);
|
||||
if($request->jsonParam!=null) {
|
||||
curl_setopt($curl, CURLOPT_POSTFIELDS, $request->jsonParam);
|
||||
} else {
|
||||
$fields=$request->paramMap;
|
||||
if($request->fileMap){
|
||||
foreach($request->fileMap as $fileParam=>$fileName) {
|
||||
//$file_name = str_replace("%2F", "/",$post["_file"]);
|
||||
//var_dump($fileParam);
|
||||
//var_dump($fileName);
|
||||
//var_dump($file_name);
|
||||
|
||||
// 从php5.5开始,反对使用"@"前缀方式上传,可以使用CURLFile替代;
|
||||
// 据说php5.6开始移除了"@"前缀上传的方式
|
||||
if (class_exists('CURLFile')) {
|
||||
// 禁用"@"上传方法,这样就可以安全的传输"@"开头的参数值
|
||||
curl_setopt($curl, CURLOPT_SAFE_UPLOAD, true);
|
||||
$file = new CURLFile($fileName);
|
||||
} else {
|
||||
curl_setopt($curl, CURLOPT_SAFE_UPLOAD, false);
|
||||
$file = "@{$fileName}";
|
||||
}
|
||||
|
||||
$fields [$fileParam] = $file;
|
||||
}
|
||||
curl_setopt($curl, CURLOPT_INFILESIZE, $request->config->maxUploadLimit);
|
||||
curl_setopt($curl, CURLOPT_BUFFERSIZE, 128);
|
||||
}
|
||||
curl_setopt($curl, CURLOPT_POSTFIELDS, $fields);
|
||||
}
|
||||
} else {
|
||||
curl_setopt($curl, CURLOPT_URL, $url);
|
||||
}
|
||||
$data = curl_exec($curl);
|
||||
$httpCode = curl_getinfo($curl, CURLINFO_HTTP_CODE);
|
||||
if (curl_errno($curl)) {
|
||||
return curl_error($curl);
|
||||
}
|
||||
$info['code'] = $httpCode;
|
||||
if(true){
|
||||
list($header, $body) = explode("\r\n\r\n", $data, 2);
|
||||
$headers = explode("\r\n", $header);
|
||||
$headList = array();
|
||||
foreach ($headers as $head) {
|
||||
$value = explode(':', $head);
|
||||
$headList[$value[0]] = $value[1];
|
||||
}
|
||||
|
||||
$bodys = explode("\r\n", $body);
|
||||
foreach ($bodys as $body) {
|
||||
$value = explode(':', $body);
|
||||
$headList[$value[0]] = $value[1];
|
||||
}
|
||||
|
||||
$info['header'] = $headList;
|
||||
// print_r($headList);
|
||||
// echo '----------<br>';
|
||||
$info['content'] = $body;
|
||||
// print_r($body);
|
||||
return $info;
|
||||
}else{
|
||||
$info['content'] = $data;
|
||||
}
|
||||
curl_close($curl);
|
||||
return $data;
|
||||
}
|
||||
}
|
@ -0,0 +1,72 @@
|
||||
<?php
|
||||
/**
|
||||
* Created by PhpStorm.
|
||||
* User: yp-tc-7176
|
||||
* Date: 17/7/16
|
||||
* Time: 20:28
|
||||
*/
|
||||
|
||||
require_once("StringBuilder.php");
|
||||
|
||||
|
||||
abstract class HttpUtils
|
||||
{
|
||||
/**
|
||||
* Normalize a string for use in url path. The algorithm is:
|
||||
* <p>
|
||||
* <p>
|
||||
* <ol>
|
||||
* <li>Normalize the string</li>
|
||||
* <li>replace all "%2F" with "/"</li>
|
||||
* <li>replace all "//" with "/%2F"</li>
|
||||
* </ol>
|
||||
* <p>
|
||||
* <p>
|
||||
* object key can contain arbitrary characters, which may result double slash in the url path. Apache http
|
||||
* client will replace "//" in the path with a single '/', which makes the object key incorrect. Thus we replace
|
||||
* "//" with "/%2F" here.
|
||||
*
|
||||
* @param path the path string to normalize.
|
||||
* @return the normalized path string.
|
||||
* @see #normalize(String)
|
||||
*/
|
||||
public static function normalizePath($path)
|
||||
{
|
||||
return str_replace("%2F", "/",HttpUtils::normalize($path));
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $value
|
||||
* @return string
|
||||
*/
|
||||
public static function normalize($value)
|
||||
{
|
||||
return rawurlencode($value);
|
||||
}
|
||||
|
||||
public static function startsWith($haystack, $needle) {
|
||||
// search backwards starting from haystack length characters from the end
|
||||
return $needle === "" || strrpos($haystack, $needle, -strlen($haystack)) !== FALSE;
|
||||
}
|
||||
|
||||
public static function endsWith($haystack, $needle) {
|
||||
// search forward starting from end minus needle length characters
|
||||
return $needle === "" || (($temp = strlen($haystack) - strlen($needle)) >= 0 && strpos($haystack, $needle, $temp) !== FALSE);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $path
|
||||
* @return string
|
||||
*/
|
||||
public static function getCanonicalURIPath($path)
|
||||
{
|
||||
if ($path == null) {
|
||||
return "/";
|
||||
} else if (HttpUtils::startsWith($path,'/')) {
|
||||
return HttpUtils::normalizePath($path);
|
||||
} else {
|
||||
return "/" + HttpUtils::normalizePath($path);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,53 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Created by PhpStorm.
|
||||
* User: yp-tc-7176
|
||||
* Date: 17/7/17
|
||||
* Time: 11:42
|
||||
*/
|
||||
class StringBuilder
|
||||
{
|
||||
const LINE="<br/>";
|
||||
protected $list= array('');
|
||||
|
||||
|
||||
|
||||
public function __construct( $str=NULL)
|
||||
{
|
||||
array_push($this->list,$str);
|
||||
|
||||
}
|
||||
|
||||
public function Append($str)
|
||||
{
|
||||
array_push($this->list,$str);
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
||||
public function AppendLine($str)
|
||||
{
|
||||
array_push($this->list,$str.self::LINE);
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
||||
public function AppendFormat($str, $args)
|
||||
{
|
||||
array_push($this->list, sprintf($str,$args));
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
||||
public function ToString()
|
||||
{
|
||||
return implode("",$this->list);
|
||||
}
|
||||
|
||||
|
||||
public function __destruct()
|
||||
{
|
||||
unset($this->list);
|
||||
}
|
||||
}
|
@ -0,0 +1,23 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Created by PhpStorm.
|
||||
* User: yp-tc-7176
|
||||
* Date: 17/7/16
|
||||
* Time: 20:12
|
||||
*/
|
||||
abstract class StringUtils
|
||||
{
|
||||
|
||||
|
||||
static function isBlank($field)
|
||||
{
|
||||
|
||||
if ($field == '') {
|
||||
return false;
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
@ -0,0 +1,189 @@
|
||||
<?php
|
||||
|
||||
require_once("YopRequest.php");
|
||||
require_once("YopResponse.php");
|
||||
require_once("YopError.php");
|
||||
require_once ("YopConfig.php");
|
||||
require_once ("Util/BlowfishEncrypter.php");
|
||||
require_once("Util/YopSignUtils.php");
|
||||
require_once("Util/HttpRequest.php");
|
||||
|
||||
class YopClient{
|
||||
|
||||
public function __construct(){
|
||||
|
||||
}
|
||||
|
||||
public function __set($name, $value){
|
||||
$this->$name = $value;
|
||||
}
|
||||
|
||||
public function __get($name){
|
||||
return $this->$name;
|
||||
}
|
||||
|
||||
static public function get($methodOrUri, $YopRequest){
|
||||
$content = self::getForString($methodOrUri, $YopRequest);
|
||||
$response = self::handleResult($YopRequest, $content);
|
||||
return $response;
|
||||
}
|
||||
|
||||
static public function getForString($methodOrUri, $YopRequest){
|
||||
$YopRequest->httpMethod = "GET";
|
||||
$serverUrl = self::richRequest($methodOrUri, $YopRequest);
|
||||
|
||||
self::signAndEncrypt($YopRequest);
|
||||
$serverUrl .= (strpos($serverUrl,'?') === false ?'?':'&') . $YopRequest->toQueryString();
|
||||
$response = HttpRequest::curl_request($serverUrl, $YopRequest);
|
||||
return $response;
|
||||
}
|
||||
|
||||
static public function post($methodOrUri, $YopRequest){
|
||||
$content = self::postForString($methodOrUri, $YopRequest);
|
||||
$response = self::handleResult($YopRequest, $content);
|
||||
return $response;
|
||||
}
|
||||
|
||||
static public function postForString($methodOrUri, $YopRequest){
|
||||
$YopRequest->httpMethod = "POST";
|
||||
$serverUrl = self::richRequest($methodOrUri, $YopRequest);
|
||||
|
||||
self::signAndEncrypt($YopRequest);
|
||||
$response = HttpRequest::curl_request($serverUrl, $YopRequest);
|
||||
return $response;
|
||||
}
|
||||
|
||||
static public function upload($methodOrUri, $YopRequest){
|
||||
$content = self::uploadForString($methodOrUri, $YopRequest);
|
||||
$response = self::handleResult($YopRequest, $content);
|
||||
return $response;
|
||||
}
|
||||
|
||||
static public function uploadForString($methodOrUri, $YopRequest){
|
||||
$YopRequest->httpMethod = "POST";
|
||||
$serverUrl = self::richRequest($methodOrUri, $YopRequest);
|
||||
|
||||
self::signAndEncrypt($YopRequest);
|
||||
$response = HttpRequest::curl_request($serverUrl, $YopRequest);
|
||||
return $response;
|
||||
}
|
||||
|
||||
static public function signAndEncrypt($YopRequest){
|
||||
|
||||
if(empty($YopRequest->method)){
|
||||
error_log("method must be specified");
|
||||
}
|
||||
if(empty($YopRequest->secretKey)){
|
||||
error_log("secretKey must be specified");
|
||||
}
|
||||
$appKey =$YopRequest->appKey;
|
||||
if(empty($appKey)){
|
||||
$appKey = $YopRequest->config->CUSTOMER_NO;
|
||||
}
|
||||
if(empty($appKey)){
|
||||
error_log("appKey 与 customerNo 不能同时为空");
|
||||
}
|
||||
|
||||
$toSignParamMap = array_merge($YopRequest->paramMap,array("v"=>$YopRequest->version, "method"=>$YopRequest->method));
|
||||
$signValue=YopSignUtils::sign($toSignParamMap,$YopRequest->ignoreSignParams,$YopRequest->secretKey,$YopRequest->signAlg,$YopRequest->config->debug);
|
||||
|
||||
date_default_timezone_set('PRC');
|
||||
$dataTime = new DateTime();
|
||||
$timestamp = $dataTime->format(DateTime::ISO8601); // Works the same since const ISO8601 = "Y-m-d\TH:i:sO"
|
||||
|
||||
$headers = array();
|
||||
$headers['x-yop-appkey'] = $appKey;
|
||||
$headers['x-yop-date'] = $timestamp;
|
||||
$headers['Authorization'] = "YOP-HMAC-AES128 " . $signValue;
|
||||
|
||||
$YopRequest->headers=$headers;
|
||||
if($YopRequest->encrypt) {
|
||||
YopClient::encrypt($YopRequest);
|
||||
}
|
||||
}
|
||||
|
||||
#加密
|
||||
static public function encrypt($YopRequest){
|
||||
$builder = $YopRequest->paramMap;
|
||||
// var_dump($builder);
|
||||
/*foreach ($builder as $k => $v){
|
||||
if($YopRequest->Config->ispublicedKey($k)){
|
||||
unset($builder[$k]);
|
||||
}else{
|
||||
}
|
||||
}*/
|
||||
if(!empty($builder)){
|
||||
$encryptBody="";
|
||||
foreach ($builder as $k=>$v){
|
||||
$encryptBody .= strlen($encryptBody) == 0 ? "" : "&";
|
||||
$encryptBody .= $k."=".urlencode($v);
|
||||
}
|
||||
}
|
||||
if(empty($encryptBody)){
|
||||
$YopRequest->addParam($YopRequest->Config->ENCRYPT,true);
|
||||
}else{
|
||||
if(!empty($YopRequest->{$YopRequest->Config->APP_KEY})){
|
||||
$encrypt = AESEncrypter::encode($encryptBody,$YopRequest->secretKey);
|
||||
$YopRequest->addParam($YopRequest->Config->ENCRYPT,$encrypt);
|
||||
}else{
|
||||
$encrypt=BlowfishEncrypter::encode($encryptBody,$YopRequest->secretKey);
|
||||
$YopRequest->addParam($YopRequest->Config->ENCRYPT,$encrypt);
|
||||
}
|
||||
}
|
||||
}
|
||||
#解密
|
||||
static public function decrypt($YopRequest, $strResult){
|
||||
if(!empty($strResult) && $YopRequest->{$YopRequest->Config->ENCRYPT}){
|
||||
if(!empty($YopRequest->{$YopRequest->Config->APP_KEY})){
|
||||
$strResult = AESEncrypter::decode($strResult, $YopRequest->secretKey);
|
||||
}else{
|
||||
$strResult = BlowfishEncrypter::decode($strResult, $YopRequest->secretKey);
|
||||
}
|
||||
}
|
||||
return $strResult;
|
||||
}
|
||||
|
||||
static public function richRequest($methodOrUri, $YopRequest){
|
||||
if(strpos($methodOrUri, $YopRequest->config->serverRoot)){
|
||||
$methodOrUri = substr($methodOrUri,strlen($YopRequest->config->serverRoot)+1);
|
||||
}
|
||||
$serverUrl = $YopRequest->serverRoot;
|
||||
$serverUrl .= $methodOrUri;
|
||||
preg_match('@/rest/v([^/]+)/@i', $methodOrUri, $version);
|
||||
if(!empty($version)){
|
||||
$version = $version[1];
|
||||
if(!empty($version)){
|
||||
$YopRequest->setVersion($version);
|
||||
}
|
||||
}
|
||||
$YopRequest->setMethod($methodOrUri);
|
||||
return $serverUrl;
|
||||
}
|
||||
|
||||
static public function handleResult($YopRequest, $content){
|
||||
// print_r($content);
|
||||
if ($YopRequest->downRequest) {
|
||||
return $content;
|
||||
}
|
||||
$response = new YopResponse();
|
||||
$jsoncontent = json_decode($content['content']);
|
||||
$response->requestId = $YopRequest->requestId;
|
||||
|
||||
$response->requestId = $YopRequest->requestId;
|
||||
if(!empty($jsoncontent->result)){
|
||||
$response->state = "SUCCESS";
|
||||
$response->result = $jsoncontent->result;
|
||||
$response->sign = $jsoncontent->sign;
|
||||
} else {
|
||||
$response->state = "FAILURE";
|
||||
//$response->error = new YopError();
|
||||
$response->error->code = $jsoncontent->code;
|
||||
$response->error->message = $jsoncontent->message;
|
||||
$response->sign = $jsoncontent->sign;
|
||||
}
|
||||
// $response->validSign = YopSignUtils::isValidResult($jsoncontent->result, $YopRequest->secretKey, $YopRequest->signAlg,$jsoncontent->sign);
|
||||
|
||||
|
||||
return $response;
|
||||
}
|
||||
}
|
@ -0,0 +1,8 @@
|
||||
<?php
|
||||
|
||||
require_once("YopRsaClient.php");
|
||||
|
||||
class YopClient3 extends YopRsaClient
|
||||
{
|
||||
|
||||
}
|
@ -0,0 +1,86 @@
|
||||
<?php
|
||||
|
||||
class YopConfig{
|
||||
//app config
|
||||
|
||||
public $serverRoot = "https://openapi.yeepay.com/yop-center";
|
||||
public $yosServerRoot = "https://yos.yeepay.com/yop-center";
|
||||
|
||||
//public $serverRoot = "http://ycetest.yeepay.com:30228/yop-center";
|
||||
//public $yosServerRoot = "http://ycetest.yeepay.com:30228/yop-center";
|
||||
|
||||
//public $serverRoot = "http://127.0.0.1:8064/yop-center";
|
||||
//public $yosServerRoot = "http://127.0.0.1:8064/yop-center";
|
||||
|
||||
public $appKey;
|
||||
public $aesSecretKey;
|
||||
public $hmacSecretKey;
|
||||
|
||||
public $debug=false;
|
||||
|
||||
public $connectTimeout=30;
|
||||
public $readTimeout=60;
|
||||
|
||||
public $maxUploadLimit=4096000;
|
||||
|
||||
//签名算法
|
||||
public $ALG_AES = "AES";
|
||||
public $ALG_SHA = "SHA";
|
||||
public $ALG_SHA1 = "SHA1";
|
||||
|
||||
// 保护参数
|
||||
public $ENCODING = "UTF-8";
|
||||
public $SUCCESS = "SUCCESS";
|
||||
public $CALLBACK = "callback";
|
||||
// 方法的默认参数名
|
||||
public $METHOD = "method";
|
||||
|
||||
// 会话id默认参数名
|
||||
public $SESSION_ID = "sessionId";
|
||||
// 应用键的默认参数名 ;
|
||||
public $APP_KEY = "appKey";
|
||||
// 服务版本号的默认参数名
|
||||
public $VERSION = "v";
|
||||
// 签名的默认参数名
|
||||
public $SIGN = "sign";
|
||||
// 加密报文key
|
||||
public $ENCRYPT = "encrypt";
|
||||
// 商户编号
|
||||
public $CUSTOMER_NO = "customerNo";
|
||||
|
||||
// 返回结果是否签名
|
||||
public $SIGN_RETURN = "signRet";
|
||||
|
||||
// 时间戳
|
||||
public $TIMESTAMP = "ts";
|
||||
public $publicED_KEY=array();
|
||||
public $publickey="MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA6p0XWjscY+gsyqKRhw9MeLsEmhFdBRhT2emOck/F1Omw38ZWhJxh9kDfs5HzFJMrVozgU+SJFDONxs8UB0wMILKRmqfLcfClG9MyCNuJkkfm0HFQv1hRGdOvZPXj3Bckuwa7FrEXBRYUhK7vJ40afumspthmse6bs6mZxNn/mALZ2X07uznOrrc2rk41Y2HftduxZw6T4EmtWuN2x4CZ8gwSyPAW5ZzZJLQ6tZDojBK4GZTAGhnn3bg5bBsBlw2+FLkCQBuDsJVsFPiGh/b6K/+zGTvWyUcu+LUj2MejYQELDO3i2vQXVDk7lVi2/TcUYefvIcssnzsfCfjaorxsuwIDAQAB";
|
||||
|
||||
|
||||
public function __construct(){
|
||||
array_push($this->publicED_KEY,$this->APP_KEY, $this->VERSION, $this->SIGN, $this->METHOD, $this->SESSION_ID, $this->CUSTOMER_NO,$this->ENCRYPT, "", false);
|
||||
}
|
||||
|
||||
public function __set($name, $value){
|
||||
$this->$name = $value;
|
||||
|
||||
}
|
||||
public function __get($name){
|
||||
return $this->$name;
|
||||
}
|
||||
|
||||
public function getSecret(){
|
||||
if(!empty($this->appKey) && strlen($this->appKey) > 0){
|
||||
return $this->aesSecretKey;
|
||||
}else{
|
||||
return $this->hmacSecretKey;
|
||||
}
|
||||
}
|
||||
|
||||
public function ispublicedKey($key){
|
||||
if(in_array($key,$this->publicED_KEY)){
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
@ -0,0 +1,17 @@
|
||||
<?php
|
||||
|
||||
class YopError {
|
||||
public $code;
|
||||
public $message;
|
||||
public $subCode;
|
||||
public $subMessage;
|
||||
|
||||
public function __set($name, $value){
|
||||
$this->$name = $value;
|
||||
}
|
||||
|
||||
public function __get($name){
|
||||
return $this->$name;
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue