fix: fix some bug in lexer

This commit is contained in:
2023-12-14 03:23:10 +00:00
parent 7ca2b28548
commit bf676afd77
3 changed files with 12 additions and 4 deletions

View File

@ -300,11 +300,16 @@ std::vector<std::string> BookStoreEngineClass::ExecuteMOdify(
double price;
if (!CommandModifyLexer(cmd, new_ISBN, name, author, keyword, price))
return std::vector<std::string>({"Invalid"});
// debugPrint("successfully lexed modify");
// debugPrint("modify", new_ISBN, ' ', name, ' ', author, ' ', keyword, ' ',
// price);
if (login_stack.empty() ||
user_data_base.GetPrevilege(login_stack.top().first) < 3)
return std::vector<std::string>({"Invalid"});
// debugPrint("successfully checked authority");
if (login_stack.top().second == "" || login_stack.top().second == new_ISBN)
return std::vector<std::string>({"Invalid"});
// debugPrint("successfully checked ISBN");
if (keyword != "") {
std::vector<std::string> key_list;
if (!KeyWordSpliter(keyword, key_list, false))
@ -316,6 +321,7 @@ std::vector<std::string> BookStoreEngineClass::ExecuteMOdify(
key_set.insert(i);
}
}
// debugPrint("successfully checked keyword");
book_data_base.ModifyInfo(login_stack.top().second, new_ISBN, name, author,
keyword, price, -1);
return std::vector<std::string>();