diff --git a/src/main/java/cactusServer/models/Accounts.java b/src/main/java/cactusServer/models/Accounts.java index 42df1eb..5be7d51 100644 --- a/src/main/java/cactusServer/models/Accounts.java +++ b/src/main/java/cactusServer/models/Accounts.java @@ -37,8 +37,12 @@ } public Account getAccount(String userID) { - Account editAccount = accounts.get(userID); - return editAccount; + if(idSet.contains(userID)) { + Account editAccount = accounts.get(userID); + return editAccount; + }else { + return null; + } } public Account loginAccount(String userID,String userPass) { @@ -51,13 +55,22 @@ } public String logoutAccount(String userID) { - Accounts.getInstance().getAccount(userID).setLogin(false); - return "success"; + if(idSet.contains(userID)) { + Accounts.getInstance().getAccount(userID).setLogin(false); + return "success"; + }else { + return "null"; + } } public String deleteAccount(String userID) { - accounts.remove(userID); - return "complated remove account"; + if(idSet.contains(userID)) { + accounts.remove(userID); + idSet.remove(userID); + return "complated remove account"; + }else { + return "not exist"; + } } }