160 lines
4.4 KiB
PHP
Executable File
160 lines
4.4 KiB
PHP
Executable File
<?php
|
||
/*
|
||
$xml=<<<KJK
|
||
<xml>
|
||
<appid><![CDATA[wx99fbf32c3eb106ad]]></appid>
|
||
<attach><![CDATA[a:2:{s:4:"type";s:3:"vip";s:8:"order_id";s:2:"66";}]]></attach>
|
||
<uniacid><![CDATA[24]]></uniacid>
|
||
</xml>
|
||
KJK;
|
||
$data = simplexml_load_string($xml);
|
||
$uniacid = (string)$data->uniacid;
|
||
unset($data->uniacid);
|
||
$xml = $data->asXML();*/
|
||
|
||
|
||
use think\facade\Db;
|
||
|
||
if(!empty($_GET['ck'])&&$_GET['ck']==789){
|
||
echo 1;exit;
|
||
}
|
||
//按摩
|
||
if(!empty($_GET['ck'])&&$_GET['ck']==7899){
|
||
echo 1;exit;
|
||
}
|
||
|
||
//<2F><><EFBFBD><EFBFBD>api<70>ڵķ<DAB5><C4B7><EFBFBD>
|
||
function lb_api_notice_increment22($url, $data){
|
||
$ch = curl_init();
|
||
$header = "Accept-Charset: utf-8";
|
||
curl_setopt($ch, CURLOPT_URL, $url);
|
||
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
|
||
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
|
||
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE);
|
||
//curl_setopt($url, CURLOPT_HTTPHEADER, $header);
|
||
curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (compatible; MSIE 5.01; Windows NT 5.0)');
|
||
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
|
||
curl_setopt($ch, CURLOPT_AUTOREFERER, 1);
|
||
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
|
||
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
||
$tmpInfo = curl_exec($ch);
|
||
// var_dump($tmpInfo);
|
||
// exit;
|
||
if (curl_errno($ch)) {
|
||
return false;
|
||
}else{
|
||
// var_dump($tmpInfo);
|
||
return $tmpInfo;
|
||
}
|
||
}
|
||
//<2F><><EFBFBD><EFBFBD><EFBFBD>ӡ<EFBFBD>ĺ<EFBFBD><C4BA><EFBFBD>
|
||
function lb_logOutput22($data,$flag=0) {
|
||
if($flag==0){
|
||
return ;
|
||
}
|
||
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͼ<EFBFBD><CDBC>
|
||
if (is_array($data)) {
|
||
$data = json_encode($data);
|
||
}
|
||
$filename = "./".date("Y-m-d").".log";
|
||
$str = date("Y-m-d H:i:s")." $data"."\r\n";
|
||
file_put_contents($filename, $str, FILE_APPEND|LOCK_EX);
|
||
return null;
|
||
}
|
||
|
||
function lb_makeRequest22($url, $params = array(), $expire = 0, $extend = array(), $hostIp = '')
|
||
{
|
||
if (empty($url)) {
|
||
return array('code' => '100');
|
||
}
|
||
|
||
$_curl = curl_init();
|
||
$_header = array(
|
||
'Accept-Language: zh-CN',
|
||
'Connection: Keep-Alive',
|
||
'Cache-Control: no-cache'
|
||
);
|
||
// <20><><EFBFBD><EFBFBD>ֱ<EFBFBD>ӷ<EFBFBD><D3B7><EFBFBD>Ҫ<EFBFBD><D2AA><EFBFBD><EFBFBD>host<73>ĵ<EFBFBD>ַ
|
||
if (!empty($hostIp)) {
|
||
$urlInfo = parse_url($url);
|
||
if (empty($urlInfo['host'])) {
|
||
$urlInfo['host'] = substr(DOMAIN, 7, -1);
|
||
$url = "http://{$hostIp}{$url}";
|
||
} else {
|
||
$url = str_replace($urlInfo['host'], $hostIp, $url);
|
||
}
|
||
$_header[] = "Host: {$urlInfo['host']}";
|
||
}
|
||
|
||
// ֻҪ<D6BB>ڶ<EFBFBD><DAB6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֵ֮<D6B5><EFBFBD><F3A3ACBE><EFBFBD>POST<53><54>
|
||
if (!empty($params)) {
|
||
curl_setopt($_curl, CURLOPT_POSTFIELDS, http_build_query($params));
|
||
curl_setopt($_curl, CURLOPT_POST, true);
|
||
}
|
||
|
||
if (substr($url, 0, 8) == 'https://') {
|
||
curl_setopt($_curl, CURLOPT_SSL_VERIFYPEER, FALSE);
|
||
curl_setopt($_curl, CURLOPT_SSL_VERIFYHOST, FALSE);
|
||
}
|
||
curl_setopt($_curl, CURLOPT_URL, $url);
|
||
curl_setopt($_curl, CURLOPT_RETURNTRANSFER, true);
|
||
curl_setopt($_curl, CURLOPT_USERAGENT, 'API PHP CURL');
|
||
curl_setopt($_curl, CURLOPT_HTTPHEADER, $_header);
|
||
|
||
if ($expire > 0) {
|
||
curl_setopt($_curl, CURLOPT_TIMEOUT, $expire); // <20><><EFBFBD><EFBFBD>ʱʱ<CAB1><CAB1>
|
||
curl_setopt($_curl, CURLOPT_CONNECTTIMEOUT, $expire); // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ӳ<EFBFBD>ʱʱ<CAB1><CAB1>
|
||
}
|
||
|
||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||
if (!empty($extend)) {
|
||
curl_setopt_array($_curl, $extend);
|
||
}
|
||
|
||
$result['result'] = curl_exec($_curl);
|
||
$result['code'] = curl_getinfo($_curl, CURLINFO_HTTP_CODE);
|
||
$result['info'] = curl_getinfo($_curl);
|
||
if ($result['result'] === false) {
|
||
$result['result'] = curl_error($_curl);
|
||
$result['code'] = -curl_errno($_curl);
|
||
}
|
||
|
||
curl_close($_curl);
|
||
return $result;
|
||
}
|
||
|
||
|
||
lb_logOutput22("in--weixinPay",1);
|
||
|
||
//<2F><>ȡ<C8A1>Ŵ<EFBFBD><C5B4><EFBFBD><EFBFBD>xml<6D><6C><EFBFBD><EFBFBD>
|
||
$xmlData = file_get_contents('php://input');
|
||
|
||
if(empty($xmlData)){
|
||
$xmlData = 'empty xmlData';
|
||
}
|
||
lb_logOutput22('xmlData in weixinPay:-----'.$xmlData);
|
||
|
||
$xml_data=simplexml_load_string($xmlData);
|
||
|
||
//$params=urldecode((string)$xml_data->params);
|
||
$params=json_decode($xml_data->params,true);
|
||
$i=$params['i'];
|
||
$is_app=$params['is_app'];
|
||
/*$t=$params['t'];
|
||
$v=$params['v'];*/
|
||
unset($xml_data->params);
|
||
|
||
$xmlData = $xml_data->asXML();
|
||
|
||
$data=$xmlData;
|
||
|
||
//回调路径
|
||
$reply_path="https://".$_SERVER['HTTP_HOST']."/index.php/shop/IndexWxPay/returnPay?i=".$i.'&is_app='.$is_app;
|
||
|
||
|
||
|
||
lb_api_notice_increment22($reply_path,$data);
|
||
|
||
|
||
|