This commit is contained in:
aozhiwei 2019-08-21 21:19:09 +08:00
parent dc638f9ec1
commit 9f6e25e80e

View File

@ -17,24 +17,6 @@ class PayNotifyController {
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) {
$prikey = self::_redPrikey();
return openssl_sign($str, $sign, $prikey, OPENSSL_ALGO_SHA1) ? base64_encode($sign) : false;
@ -42,8 +24,8 @@ class PayNotifyController {
public function payNotify()
{
die();
error_log('payNotify:' . json_encode($_REQUEST));
/*
$sign_info = $this->_reaEncode(
'MerNo=' . $_REQUEST['MerNo'] . '&' .
'BillNo=' . $_REQUEST['BillNo'] . '&' .
@ -53,13 +35,13 @@ class PayNotifyController {
);
if ($sign_info != $_REQUEST['SignInfo']) {
die('sign error');
}
}*/
$nowtime = time();
$conn = $this->getMysql($_REQUEST['OrderNo']);
$conn = $this->getMysql($_REQUEST['BillNo']);
$conn->execScript("INSERT INTO notify_his(orderid, request_data, ipv4, createtime)" .
"VALUES(:orderid, :request_data, :ipv4, :createtime);",
array(
':orderid' => $_REQUEST['OrderNo'],
':orderid' => $_REQUEST['BillNo'],
':request_data' => json_encode($_REQUEST),
':ipv4' => phpcommon\getIPv4(),
':createtime' => time()
@ -68,7 +50,7 @@ class PayNotifyController {
$row = $conn->execQueryOne('SELECT orderid, accountid, sp_pay_result, status FROM orderinfo ' .
'WHERE orderid=:orderid;',
array(
'orderid' => $_REQUEST['OrderNo']
'orderid' => $_REQUEST['BillNo']
)
);
if ($row) {
@ -76,9 +58,9 @@ class PayNotifyController {
$ret = $conn->execScript('INSERT INTO confirmed_order(orderid, status, createtime)' .
'VALUES(:orderid, :status, :createtime);',
array(
':orderid' => $_REQUEST['OrderNo'],
':orderid' => $_REQUEST['BillNo'],
':status' => 0,
':createtime' => 0,
':createtime' => $nowtime,
));
if (!$ret) {
die('dberror');
@ -89,8 +71,8 @@ class PayNotifyController {
' sp_orderid = :sp_orderid' .
'WHERE orderid=:orderid;',
array(
'orderid' => $_REQUEST['OrderNo'],
'sp_orderid' => $_REQUEST['BillNo'],
'orderid' => $_REQUEST['BillNo'],
'sp_orderid' => $_REQUEST['OrderNo'],
'sp_confirm_time' => $nowtime
));
if ($ret) {