<?php
error_reporting(0);
include "../../config/ht.php";
$code=ubo(base64_decode($_GET[code]));
$paylx=$_GET[lx];
if (strpos($code, "|ubo|") !== false) {
$p= explode("|ubo|",$code); 
$ddh=$p[0];//提交的订单号
$money=$p[1];//提交的支付金额
$userid=$p[2];//提交的用户ID
$shipinid=$p[3];//提交的资源ID
$lx=$p[4];//
$ip=$p[5];//
$ddhto=$p[6];
$payid=$p[7];
}
//调用接口
$type="where biaoshi='$paylx'";
$hzpay=queryall(hzpay,$type);
if($hzpay[zt]==1){
$type="WHERE biaoshi='$paylx'";
$hzpayto=queryall(hzpayto,$type);
if($hzpayto){
if($hzpayto[sz]==1){
$type="where biaoshi='$paylx'  and userid='$userid'";
$hzpaylist=queryall(hzpaylist,$type);
if($hzpaylist){
if($hzpaylist[sz]==1){
$payid=$hzpaylist[payid];//商户ID
$paykey=$hzpaylist[paykey];//商户秘钥
$payurl=$hzpaylist[payurl];//支付网关
define("PAY_VERSION", '3');
define("PAY_VERSION_P", '2.10');
define("FAST_APPKEY", $hzpaylist[payid]);
define("SECRET_KEY", $hzpaylist[paykey]);
define('PAY_DESC', "xx平台给你汇款");
define('PAY_RETURN_URL', $back);
define('PAY_NOTIFY_URL', $tzurl);
define('PAY_OPENID', 1);
define("API_OPENID", 'http://xxx.com/code.php?v='.PAY_VERSION."&ver=".PAY_VERSION_P);
define("API_OPENID_INFO", 'http://xxx.com/code_user.php?v='.PAY_VERSION."&ver=".PAY_VERSION_P);//获取微信公众号用户信息,需要联系客服开通
define("PAY_API", 'http://api.hxs823.cn/home/Public/pay/api.php');//请求的api
define("API_TRANSFERS", PAY_API."?pay_type=transfers&v=".PAY_VERSION);
define("API_GET_QR", PAY_API."?pay_type=company_qr&v=".PAY_VERSION);
define("API_WEIXIN_URL", 'http://url.bjnre.com/code_url.php?v='.PAY_VERSION);//可动态修改代理二维码内容,被封自动替换,需要联系客服开通
define("API_WEIXIN_CHECKURL", 'http://url.bjnre.com/code_checkurl.php?v='.PAY_VERSION);//检测域名是否被封
define("API_WEIXIN_ADMIN_CHECKURL", 'http://url.bjnre.com/code_check_domin.php?v='.PAY_VERSION);//检测域名是否被封
include "peizhi.php";
$blx='hzpaylist';
}else{
echo '代理通道已被停止使用';
exit;
}
}else{
echo '代理通道未添加';
exit;
}
}else{
echo '通道未启用';
exit;
}
}else{
echo '通道不存在';
exit;
}
}else{
$type="WHERE biaoshi='$paylx' and  zt='1' and sz='1'";
$hzpayto=queryall(hzpayto,$type);
if($hzpayto){
$payid=$hzpayto[payid];//商户ID
$paykey=$hzpayto[paykey];//商户秘钥
$payurl=$hzpayto[payurl];//支付网关
define("PAY_VERSION", '3');
define("PAY_VERSION_P", '2.10');
define("FAST_APPKEY", $hzpayto[payid]);
define("SECRET_KEY", $hzpayto[paykey]);
define('PAY_DESC', "xx平台给你汇款");
define('PAY_RETURN_URL', $back);
define('PAY_NOTIFY_URL', $tzurl);
define('PAY_OPENID', 1);
define("API_OPENID", 'http://xxx.com/code.php?v='.PAY_VERSION."&ver=".PAY_VERSION_P);
define("API_OPENID_INFO", 'http://xxx.com/code_user.php?v='.PAY_VERSION."&ver=".PAY_VERSION_P);//获取微信公众号用户信息,需要联系客服开通
define("PAY_API", 'http://api.hxs823.cn/home/Public/pay/api.php');//请求的api
define("API_TRANSFERS", PAY_API."?pay_type=transfers&v=".PAY_VERSION);
define("API_GET_QR", PAY_API."?pay_type=company_qr&v=".PAY_VERSION);
define("API_WEIXIN_URL", 'http://url.bjnre.com/code_url.php?v='.PAY_VERSION);//可动态修改代理二维码内容,被封自动替换,需要联系客服开通
define("API_WEIXIN_CHECKURL", 'http://url.bjnre.com/code_checkurl.php?v='.PAY_VERSION);//检测域名是否被封
define("API_WEIXIN_ADMIN_CHECKURL", 'http://url.bjnre.com/code_check_domin.php?v='.PAY_VERSION);//检测域名是否被封
include "peizhi.php";
$blx='hzpayto';
}else{
echo '通道未设置默认接口';
exit;
}
}
//这里插入支付///------------------------------------------------------------统一配置
$back="http://".$_SERVER["HTTP_HOST"]."/check-".$ddh.".html";//这是同步跳转地址
$tzurl="http://".$_SERVER["HTTP_HOST"]."/hzpay/".$paylx."/tzurl.php";//这是异步通知地址
$ddmulu="../../".date("Y-m-d")."ddh";
mkdir ($ddmulu);
$ddmulu2="../../".date("Y-m-d",strtotime("-1 day"))."ddh";
del_dir($ddmulu2);
$ddhcj = $ddmulu."/".$ddh.".txt";
if (file_exists($ddhcj)) {
}else{
$ddhwb =$ddh."|ubo|".$money."|ubo|".$userid."|ubo|".$shipinid."|ubo|".$lx."|ubo|".$ip."|ubo|".$ddhto."|ubo|".$hzpaylist[id]."|ubo|".$_SERVER["HTTP_HOST"]."|ubo|".$paylx."|ubo|".$blx;
writefile($ddhcj,$ddhwb);
}
$paydata=array();
$paydata['uid']=$userid;//支付用户id
$paydata['order_no']=$ddh;//订单号
$paydata['total_fee']=$money;//金额
$paydata['param']="";//其他参数
$paydata['me_back_url']=$back;//支付成功后跳转
$paydata['notify_url']=$tzurl;//支付成功后异步回调
$geturl=fastpay_order($paydata);//获取支付链接
exit("<meta http-equiv='Refresh' content='0;URL={$geturl}'>");
?>
