diff --git a/app/http/middleware/ContextMiddleware.php b/app/http/middleware/ContextMiddleware.php index c7e2a17..91d3e23 100644 --- a/app/http/middleware/ContextMiddleware.php +++ b/app/http/middleware/ContextMiddleware.php @@ -23,8 +23,8 @@ class ContextMiddleware extends middleware if ($request->header('x-encrypted') == 'true') { $encryptedData = $request->param('encryptedData',''); if($encryptedData) { - $jsonData = $this->decryptCryptoJSData($encryptedData); - $request->withPost($jsonData); + $jsonInput = $this->decryptCryptoJSData($encryptedData); + $request->withInput($jsonInput); } } @@ -161,7 +161,7 @@ class ContextMiddleware extends middleware * @return array 解密后的数据 * @throws ValidateException 解密失败时抛出异常 */ - private function decryptCryptoJSData(string $encryptedData): array + private function decryptCryptoJSData(string $encryptedData): string { // Base64解码 $data = base64_decode($encryptedData); @@ -188,7 +188,7 @@ class ContextMiddleware extends middleware OPENSSL_RAW_DATA, $iv ); - return json_decode($decrypted, true); + return $decrypted; } private function evpBytesToKey($salt): array