From 93f6b684d73e1b610d0e11d7aa99565fe3fbe64e Mon Sep 17 00:00:00 2001 From: u2nyakim Date: Fri, 29 Aug 2025 16:19:27 +0800 Subject: [PATCH] =?UTF-8?q?up.=20=E5=8F=8C=E5=90=91=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E5=8A=A0=E5=AF=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/http/middleware/ContextMiddleware.php | 10 +++++----- z_ele/src/utils/request.ts | 1 - 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/app/http/middleware/ContextMiddleware.php b/app/http/middleware/ContextMiddleware.php index f4fb167..86e60cd 100644 --- a/app/http/middleware/ContextMiddleware.php +++ b/app/http/middleware/ContextMiddleware.php @@ -23,13 +23,13 @@ class ContextMiddleware extends middleware if ($request->header('x-encrypted') == 'true') { $encryptedData = $request->param('encryptedData',''); if($encryptedData) { -// try{ + try{ $jsonInput = \app\Request::decryptCryptoJSData($encryptedData); -// }catch (\Throwable){ -// $jsonInput = null; -// } + }catch (\Throwable){ + $jsonInput = null; + } - if($jsonInput) { + if(empty($jsonInput)) { return json(['code'=>500,'message'=>'E0.数据解密失败']); } $request->withInput($jsonInput); diff --git a/z_ele/src/utils/request.ts b/z_ele/src/utils/request.ts index d2db9f7..d1a6307 100644 --- a/z_ele/src/utils/request.ts +++ b/z_ele/src/utils/request.ts @@ -37,7 +37,6 @@ export function decryptData(ciphertext: string): any { if (!jsonString) { throw new Error('Decryption failed: Invalid key or ciphertext'); } - return JSON.parse(jsonString); } /**