diff --git a/mobile/source/helpers/dalianpay/demo/dalianpay.php b/mobile/source/helpers/dalianpay/demo/dalianpay.php index b593809..7ddb3e1 100644 --- a/mobile/source/helpers/dalianpay/demo/dalianpay.php +++ b/mobile/source/helpers/dalianpay/demo/dalianpay.php @@ -20,6 +20,21 @@ class dalianpay{ } return $plaintext; } + + public function norify_decrypt($postData){ + require_once(BASE_PATH . 'helpers/dalianpay/library/Base.php'); + $Base = new Base(); + $response = json_decode($postData, true); + $response_data_crypted = $response['data']; + $response_sign = $response['sign']; + + // 解密响应密文 + $response_data = $Base->Crypt->decryptTradeData($response_data_crypted); + // echo "decryptTradeData:\r\n"; + // echo $response_data . "\r\n"; + return $response_data; + } + public function pay($openid_crypt, $order_sn, $order_amount) { session_start(); diff --git a/mobile/wxnotify.php b/mobile/wxnotify.php index ee4f6fa..a2f1dac 100644 --- a/mobile/wxnotify.php +++ b/mobile/wxnotify.php @@ -33,8 +33,15 @@ $logFilePath = './wxlog.txt'; // 日志文件保存路径 // 获取异步回调的数据 $postData = file_get_contents('php://input'); +// 解密postData +require_once(BASE_PATH . 'helpers/dalianpay/demo/dalianpay.php'); +require_once(BASE_PATH . 'helpers/dalianpay/library/Base.php'); + +$new_plugin = new dalianpay(); +$response_data = $new_plugin->norify_decrypt($postData); + // 添加时间戳和换行符 -$logMessage = date('Y-m-d H:i:s') . " - " . $postData . "\n"; +$logMessage = date('Y-m-d H:i:s') . " - " . $response_data . "\n"; // 将日志写入文件 file_put_contents($logFilePath, $logMessage, FILE_APPEND | LOCK_EX);