<?php
require_once("vendor/autoload.php");
global $_W;
global $_GPC;
$site_info = $_W["setting"]["site"];
$current_module = $_W["현재_모듈"];
/**
* 결제주문번호 생성
* @return string
*/
function getconfig($key, $uid,$default = ''){
$config = pdo_get('zunyue_ysyccs_site', ['key' => $key,'uniacid' => $uid]);
return $config ? $config['value'] : $default;
}
function createOutTradeNo()
{
mt_srand((double) microtime() * 1000000);
return date("YmdHis") . str_pad(mt_rand(10000, 99999), 5, "0", STR_PAD_LEFT) . rand(10000, 99999);
}
function Calendar($date = 0)
{
$calendar = new Overtrue ChineseCalendarCalendar();
$timestamp = strtotime($date);
반품 $calendar->solar(date("Y", $timestamp), date("m", $timestamp), date("d", $timestamp));
}
function getPlatform()
{
$agent = new JenssegersAgentAgent();
$isMobile = $agent->isMobile();
if( $isMobile )
{
return "wap";
}
return "pc";
}
function postXmlCurl($xml = "", $url = "", $second = 30)
{
$ch = cur_init();
컬_setopt($ch, CURLOPT_TIMEOUT, $second);
컬_setopt($ch, CURLOPT_URL, $url);
컬_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
컬_setopt($ch, CURL OPT_SSL_VERIFYHOST, 거짓);
컬_setopt($ch, CURLOPT_HEADER, false);
컬_setopt($ch, CURLOPT_RETURNTRANSFER, true);
컬_setopt($ch, CURLOPT_POST, true);
컬_setopt($ch, CURLOP T_POSTFIELDS, $xml);
ㅋㅋㅋ$error = 컬_errno($ch) ;
컬_close($ch);
return $error;
}
function authcodeData($string, $Operation = "", $key = "", $expiry = 0)
{
$ckey_length = 4;
$key = md5(($key != "" ? $key : "zunyue"));
$keya = md5(substr($key, 0, 16));
$keyb = md5(substr($key, 16, 16));
$keyc = ($ckey_length ? ($eration == "DECODE" ? substr($string, 0, $ckey_length) : substr(md5(microtime()), 0 - $ckey_length)) : "");
$cryptkey = $keya . md5($keya . $keyc);
$key_length = strlen($cryptkey);
$string = ($Operation == "DECODE" ? base64_decode(substr($string, $ckey_length)) : sprintf("% 010d", ($expiry ? $expiry + time() : 0)) . substr(md5($string . $keyb), 0, 16) . $string);
$string_length = strlen($string);
$result = "";
$box = range(0, 255);
$rndkey = array( );
$i = 0;
while( $i <= 255 )
{
$rndkey[$i] = ord($cryptkey[$i % $key_length]);
$i++;
}
$j = $i = 0;
while( $i < 256 )
{
$j = ($j + $box[$i] + $rndkey[$i]) % 256;
$tmp = $box[$i];
$box[$i] = $ box[$j];
$box[$j] = $tmp;
$i++;
}
$a = $j = $i = 0;
while( $i < $string_length )
{
$a = ($a + 1) % 256;
$j = ($j + $box[$a]) % 256;
$tmp = $box[$a];
$box[$a] = $box[$j];
$box[$j] = $tmp;
$result .= chr(ord($string[$i]) ^ $box[($box [$a] + $box[$j]) % 256]);
$i++;
}
if( $Operation == "DECODE" )
{
if( (substr($result, 0, 10) == 0 || 0 < substr($result, 0, 10) - time()) && substr($result, 10, 16) == substr(md5(substr($result, 26) . $keyb), 0, 16) )
{
return substr ($ result, 26);
}
return "";
}
return $ keyc. str_replace("=", "", base64_encode($result));
}
function getCesuanDataOrder($order_info = array( ), $product_sn = "", $return_data_original = false, $app_id = "" , $token = "")
{
전역 $_W;
$current_module = $_W["current_module"];
$site_info = $_W["setting"]["site"];
//$content = postxmlcurl(array_merge($order_info, array( "host" => $_SERVER["HTTP_HOST"], "module" => $current_module["name"], "version" => $ current_module["version"], "site_id" => $site_info["key"], "domain" => $site_info["url"], "product_sn" => $app_id, "token" => $token )), "http://auth.zunyue.me/api/fortunetelling/cesuan", 5);
$content = postXmlCurl(array_merge($order_info, [
) 'product_id' => $product_sn,
'app_id' => $app_id,
'token' => $token,
]), 'http://api.kuzhuti.cn/api/sm .php', 5);
if($content && $content != "error"){
return $content;
}else{
return array("error_code"=>1, "error_msg"=>'授权错误');
}
}
//支付下单计算签name
function f_pay_sign($paydata){
if ( !is_array($paydata)) {
종료("data错误");
}
$fpappkey = getconfig('fpappkey',$paydata['uid']);
$secretkey = getconfig('fpsecretkey',$paydata['uid ']);
$str_sign="appkey={$fpappkey}&order_no={$paydata['order_no']}&secretkey={$secretkey}&total_fee={$paydata['total_fee']}&uid={$paydata[ 'uid']}&";
$sign=md5($str_sign);
return $sign;
}
//异步回调计算签name
function f_notify_sign($paydata)
{
if (!is_array($paydata)) {
exit("data错误");
}
$fpappkey = getconfig('fpappkey',$paydata['uid']);
$secretkey = getconfig('fpsecretkey',$paydata['uid']);
$str_sign="appkey={$fpappkey}&order_no={$paydata['order_no']}&secretkey={$secretkey}&me_pri={$paydata[ 'me_pri']}&uid={$paydata['uid']}&";
$sign=md5($str_sign);
return $sign;
}
function httpGet($url, $second = 30)
{
$curl =curl_init();
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_TIMEOUT, $second);
curl_setop t($curl, CURLOPT_SSL_VERIFYPEER , 거짓);
ㅋㅋㅋ $res;}
function createNonceStr($length = 16)
{
$chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
$str = "";
function mobileUrl($params = array( ), $share_url = "")
{
global $_W;
list($controller, $action, $do) = 폭발("/", "항목");
$str = "";
$url .= "index.php?i=" . $_W["유니애시드"] . $str . "&";
if( !empty($controller) )
{
if( !empty($action) )
{
$url .= "a=" . $액션 . "&";
}
if( !empty($do) )
{
$url .= "do=" . $do . "&";
}
if( !empty($params) )
{
$queryString = http_build_query($params, "", "&");
$url . = $queryString ;
return $url;
}
function createDomainUrl($domain = "")
{
$ishttps = ($_SERVER["SERVER_PORT"] = = 443 | | isset($_SERVER["HTTPS"]) && strtolower($_SERVER["HTTPS"]) != "off" || strtolower($_SERVER["HTTP_X_FORWARDED_PROTO"]) == "https" || ["HTTP_X_CLIENT_SCHEME"]) == "https" ? true : false);
$sitescheme = ($ishttps ? "https://" : "http://");
$http_host = (빈($domain) ? $sitescheme . $_SERVER["HTTP_HOST"] : $domain);
$domain_url = htmlspecialchars($http_host . $sitepath);
if( substr($domain_url, - 1) != "/" )
{
$domain_url .= "/";
}
$urls =parse_url($domain_url);
$urls["path"] = str_replace ( 배열( "/web", "/app", "/결제/wechat", "/결제/alipay", "/결제/jueqiymf", "/api" ), "", $urls["path"]) ;
$urls["scheme"]을 반환합니다. "://" . $urls["호스트"] . ((!empty($urls["port"]) && $urls["port"] != "80" ? ":" . $urls["port"] : "")) . $urls["path"];
}
function qrcodeBase64($qrcode_resize, $share_url)
{
$qrcode = new SimpleSoftwareIOQrCodeBaconQrCodeGenerator();
return base64_encode($qr 코드->형식( "png")->여백(0)->크기($qrcode_resize)->생성($share_url));
}
/**
* @return bool
*/
function isWeixin()
{
if( Stripos($_SERVER["HTTP_USER_AGENT"], "MicroMessenger") === false )
{
return false;
}
true를 반환합니다.
}
其中126行" http://auth.zunyue.me/api/fortunetelling/cesuan", 5);
和130行的 ' http://api.kuzhuti.cn/api/sm2 .php', 5); ????????
张龙=124812019-06-03 17:26:54
소스코드를 구매했는데 인터페이스가 바뀔까 봐 좀 불편해서 전문가들에게 어떻게 하면 나만의 인터페이스로 바꿀 수 있는지 물어봤습니다.
一只小码媛2019-06-03 17:24:52
이게 호출하신 결제 API의 인터페이스 주소인가요? 예를 들어 WeChat 결제 요청은 https://api.mch.weixin.qq.com/pay/unifiedorder입니다. 일반적으로 다른 사람이 제공하는 인터페이스는 다른 사람의 공식 문서를 임의로 변경할 수 없습니다.