1
This commit is contained in:
parent
dc638f9ec1
commit
9f6e25e80e
@ -17,24 +17,6 @@ class PayNotifyController {
|
|||||||
return $conn;
|
return $conn;
|
||||||
}
|
}
|
||||||
|
|
||||||
private function _redPubkey()
|
|
||||||
{
|
|
||||||
$pem = "-----BEGIN PUBLIC KEY-----\n" .
|
|
||||||
chunk_split(self::PUB_KEY, 64, "\n") .
|
|
||||||
"-----END PUBLIC KEY-----\n";
|
|
||||||
echo $pem;
|
|
||||||
return openssl_pkey_get_public($pem);
|
|
||||||
}
|
|
||||||
|
|
||||||
private function _redPrikey()
|
|
||||||
{
|
|
||||||
$pem = "-----BEGIN RSA PRIVATE KEY-----\n" .
|
|
||||||
chunk_split(self::PRI_KEY, 64, "\n") .
|
|
||||||
"-----END RSA PRIVATE KEY-----\n";
|
|
||||||
error_log($pem);
|
|
||||||
return openssl_pkey_get_private($pem);
|
|
||||||
}
|
|
||||||
|
|
||||||
private function _reaEncode($str) {
|
private function _reaEncode($str) {
|
||||||
$prikey = self::_redPrikey();
|
$prikey = self::_redPrikey();
|
||||||
return openssl_sign($str, $sign, $prikey, OPENSSL_ALGO_SHA1) ? base64_encode($sign) : false;
|
return openssl_sign($str, $sign, $prikey, OPENSSL_ALGO_SHA1) ? base64_encode($sign) : false;
|
||||||
@ -42,8 +24,8 @@ class PayNotifyController {
|
|||||||
|
|
||||||
public function payNotify()
|
public function payNotify()
|
||||||
{
|
{
|
||||||
die();
|
|
||||||
error_log('payNotify:' . json_encode($_REQUEST));
|
error_log('payNotify:' . json_encode($_REQUEST));
|
||||||
|
/*
|
||||||
$sign_info = $this->_reaEncode(
|
$sign_info = $this->_reaEncode(
|
||||||
'MerNo=' . $_REQUEST['MerNo'] . '&' .
|
'MerNo=' . $_REQUEST['MerNo'] . '&' .
|
||||||
'BillNo=' . $_REQUEST['BillNo'] . '&' .
|
'BillNo=' . $_REQUEST['BillNo'] . '&' .
|
||||||
@ -53,13 +35,13 @@ class PayNotifyController {
|
|||||||
);
|
);
|
||||||
if ($sign_info != $_REQUEST['SignInfo']) {
|
if ($sign_info != $_REQUEST['SignInfo']) {
|
||||||
die('sign error');
|
die('sign error');
|
||||||
}
|
}*/
|
||||||
$nowtime = time();
|
$nowtime = time();
|
||||||
$conn = $this->getMysql($_REQUEST['OrderNo']);
|
$conn = $this->getMysql($_REQUEST['BillNo']);
|
||||||
$conn->execScript("INSERT INTO notify_his(orderid, request_data, ipv4, createtime)" .
|
$conn->execScript("INSERT INTO notify_his(orderid, request_data, ipv4, createtime)" .
|
||||||
"VALUES(:orderid, :request_data, :ipv4, :createtime);",
|
"VALUES(:orderid, :request_data, :ipv4, :createtime);",
|
||||||
array(
|
array(
|
||||||
':orderid' => $_REQUEST['OrderNo'],
|
':orderid' => $_REQUEST['BillNo'],
|
||||||
':request_data' => json_encode($_REQUEST),
|
':request_data' => json_encode($_REQUEST),
|
||||||
':ipv4' => phpcommon\getIPv4(),
|
':ipv4' => phpcommon\getIPv4(),
|
||||||
':createtime' => time()
|
':createtime' => time()
|
||||||
@ -68,7 +50,7 @@ class PayNotifyController {
|
|||||||
$row = $conn->execQueryOne('SELECT orderid, accountid, sp_pay_result, status FROM orderinfo ' .
|
$row = $conn->execQueryOne('SELECT orderid, accountid, sp_pay_result, status FROM orderinfo ' .
|
||||||
'WHERE orderid=:orderid;',
|
'WHERE orderid=:orderid;',
|
||||||
array(
|
array(
|
||||||
'orderid' => $_REQUEST['OrderNo']
|
'orderid' => $_REQUEST['BillNo']
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
if ($row) {
|
if ($row) {
|
||||||
@ -76,9 +58,9 @@ class PayNotifyController {
|
|||||||
$ret = $conn->execScript('INSERT INTO confirmed_order(orderid, status, createtime)' .
|
$ret = $conn->execScript('INSERT INTO confirmed_order(orderid, status, createtime)' .
|
||||||
'VALUES(:orderid, :status, :createtime);',
|
'VALUES(:orderid, :status, :createtime);',
|
||||||
array(
|
array(
|
||||||
':orderid' => $_REQUEST['OrderNo'],
|
':orderid' => $_REQUEST['BillNo'],
|
||||||
':status' => 0,
|
':status' => 0,
|
||||||
':createtime' => 0,
|
':createtime' => $nowtime,
|
||||||
));
|
));
|
||||||
if (!$ret) {
|
if (!$ret) {
|
||||||
die('dberror');
|
die('dberror');
|
||||||
@ -89,8 +71,8 @@ class PayNotifyController {
|
|||||||
' sp_orderid = :sp_orderid' .
|
' sp_orderid = :sp_orderid' .
|
||||||
'WHERE orderid=:orderid;',
|
'WHERE orderid=:orderid;',
|
||||||
array(
|
array(
|
||||||
'orderid' => $_REQUEST['OrderNo'],
|
'orderid' => $_REQUEST['BillNo'],
|
||||||
'sp_orderid' => $_REQUEST['BillNo'],
|
'sp_orderid' => $_REQUEST['OrderNo'],
|
||||||
'sp_confirm_time' => $nowtime
|
'sp_confirm_time' => $nowtime
|
||||||
));
|
));
|
||||||
if ($ret) {
|
if ($ret) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user