From b6b9a4ffb21c74616923c52f21d505178cea33be Mon Sep 17 00:00:00 2001 From: ZhuangYumin Date: Fri, 15 Dec 2023 11:58:47 +0000 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E4=BA=86=E6=9D=83=E9=99=90?= =?UTF-8?q?=E4=B8=8E=E7=94=A8=E6=88=B7=E5=90=8D=E6=9F=A5=E8=AF=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backend/src/engine.cpp | 3 ++- frontend/Web/communication.js | 14 +++++++++++++- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/backend/src/engine.cpp b/backend/src/engine.cpp index 6f7cc8a..950df7b 100644 --- a/backend/src/engine.cpp +++ b/backend/src/engine.cpp @@ -454,5 +454,6 @@ std::vector BookStoreEngineClass::ExecuteReport( } std::string BookStoreEngineClass::QueryUserInfo(const std::string &user_name) { - return user_name + std::to_string(user_data_base.GetPrevilege(user_name)); + return user_name + " " + + std::to_string(user_data_base.GetPrevilege(user_name)); } \ No newline at end of file diff --git a/frontend/Web/communication.js b/frontend/Web/communication.js index 350e62f..380edf4 100644 --- a/frontend/Web/communication.js +++ b/frontend/Web/communication.js @@ -80,4 +80,16 @@ async function Request(req) localStorage.setItem("outhentication_key", outhentication_key); localStorage.setItem("operation_count", operation_count); } -})(); \ No newline at end of file +})(); + +async function GetMyName() +{ + let ret = await RawRequest("#Who "+session_token+" InfoQuery "+outhentication_key); + return ret.split('\n')[1].split(' ')[0]; +} + +async function GetMyPrivilege() +{ + let ret = await RawRequest("#Who "+session_token+" InfoQuery "+outhentication_key); + return parseInt(ret.split('\n')[1].split(' ')[1]); +} \ No newline at end of file