修复了主要问题

This commit is contained in:
2023-12-15 10:52:18 +00:00
parent 467e6e2a61
commit 89acc8f025
2 changed files with 13 additions and 7 deletions

View File

@ -65,7 +65,7 @@ void BookStoreMain(bool is_server, std::string config_dir) {
} }
if (session_map[session_token].login_stack.empty() || if (session_map[session_token].login_stack.empty() ||
session_map[session_token].login_stack.top().first != "root") { session_map[session_token].login_stack.top().first != "root") {
std::cout << session_token << ' ' << operation_token << " -1" std::cout << session_token << ' ' << operation_token << " 1\nInvalid"
<< std::endl; << std::endl;
std::cout.flush(); std::cout.flush();
continue; continue;

View File

@ -22,6 +22,9 @@
} }
const socket = io(); const socket = io();
let __raw_response=""; let __raw_response="";
let operation_count=localStorage.getItem("operation_count");
let session_token=localStorage.getItem("session_token");
let outhentication_key=localStorage.getItem("outhentication_key");
socket.on('response', (msg) => { socket.on('response', (msg) => {
__raw_response=msg; __raw_response=msg;
}); });
@ -40,12 +43,18 @@
await sleep(100); await sleep(100);
} }
} }
async function ShutDownWholeSystem()
{
await RawRequest("#ShutDownSystem "+session_token+" "+operation_count+" "+outhentication_key);
return "You Guess";
}
async function Request(req) async function Request(req)
{ {
let operation_count=localStorage.getItem("operation_count"); operation_count=localStorage.getItem("operation_count");
let session_token=localStorage.getItem("session_token"); session_token=localStorage.getItem("session_token");
let outhentication_key=localStorage.getItem("outhentication_key"); outhentication_key=localStorage.getItem("outhentication_key");
operation_count++; operation_count++;
localStorage.setItem("operation_count", operation_count);
let raw_request="#Request "+session_token+" "+operation_count+" "+outhentication_key+"\n"+req; let raw_request="#Request "+session_token+" "+operation_count+" "+outhentication_key+"\n"+req;
let raw_response=await RawRequest(raw_request); let raw_response=await RawRequest(raw_request);
console.log("get raw_response:"+raw_response); console.log("get raw_response:"+raw_response);
@ -71,9 +80,6 @@
localStorage.setItem("operation_count", operation_count); localStorage.setItem("operation_count", operation_count);
return response; return response;
} }
let session_token=localStorage.getItem("session_token");
let outhentication_key=localStorage.getItem("outhentication_key");
let operation_count=localStorage.getItem("operation_count");
(async () => { (async () => {
if(session_token==null||outhentication_key==null||operation_count==null){ if(session_token==null||outhentication_key==null||operation_count==null){
let tmp_channel=generateRandomString(10); let tmp_channel=generateRandomString(10);