Files
youlegames/codes/agent/game/api/payment/ipay/TradingResultsNotice.php
2026-03-15 01:27:05 +08:00

61 lines
2.2 KiB
PHP
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<?php
header("Content-type: text/html; charset=utf-8");
/*
* Created on 2015-9-1
*
* To change the template for this generated file go to
* Window - Preferences - PHPeclipse - PHP - Code Templates
*/
require_once("base.php");
require_once("config.php");
function testResult()
{
global $queryResultUrl, $platpkey;
$string = $_POST;//接收post请求数据
$cporderid = null;
if ($string == null) {
echo "请使用post方式提交数据";
} else {
$transdata = $string['transdata'];
echo "$transdata\n";
if (stripos("%22", $transdata)) { //判断接收到的数据是否做过 Urldecode处理如果没有处理则对数据进行Urldecode处理
$string = array_map('urldecode', $string);
}
$respData = 'transdata=' . $string['transdata'] . '&sign=' . $string['sign'] . '&signtype=' . $string['signtype'];//把数据组装成验签函数要求的参数格式
// 验签函数parseResp 中 只接受明文数据。数据如transdata={"appid":"3003686553","appuserid":"10123059","cporderid":"1234qwedfq2as123sdf3f1231234r","cpprivate":"11qwe123r23q232111","currency":"RMB","feetype":0,"money":0.12,"paytype":403,"result":0,"transid":"32011601231456558678","transtime":"2016-01-23 14:57:15","transtype":0,"waresid":1}&sign=jeSp7L6GtZaO/KiP5XSA4vvq5yxBpq4PFqXyEoktkPqkE5b8jS7aeHlgV5zDLIeyqfVJKKuypNUdrpMLbSQhC8G4pDwdpTs/GTbDw/stxFXBGgrt9zugWRcpL56k9XEXM5ao95fTu9PO8jMNfIV9mMMyTRLT3lCAJGrKL17xXv4=&signtype=RSA
echo "进入了2" . $respData;
if (!parseResp($respData, $platpkey, $respJson)) {
//验签失败
echo 'failed' . "\n";
} else {
//验签成功
echo 'success' . "\n";
//以下是 验签通过之后 对数据的解析。
$transdata = $string['transdata'];
$arr = json_decode($transdata);
$appid = $arr->appid;
$appuserid = $arr->appuserid;
$cporderid = $arr->cporderid;
$cpprivate = $arr->cpprivate;
$money = $arr->paytype;
$result = $arr->result;
$transid = $arr->transid;
$transtime = $arr->transtime;
$waresid = $arr->waresid;
echo "$appid\n";
echo "$appuserid\n";
echo "$cporderid\n";
echo "$cpprivate\n";
echo "$money\n";
echo "$result\n";
echo "$transid\n";
echo "$transtime\n";
echo "$waresid\n";
}
}
}
testResult();
?>