From a4ac41e71839743ea34b10dd4b9ea61581876a0d Mon Sep 17 00:00:00 2001 From: Jrohy Date: Mon, 23 Mar 2020 21:42:10 +0800 Subject: [PATCH] fix bug --- cmd/root.go | 1 - core/mysql.go | 4 +++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/cmd/root.go b/cmd/root.go index 595b86d4..6521e04a 100644 --- a/cmd/root.go +++ b/cmd/root.go @@ -52,7 +52,6 @@ exit: fmt.Printf("%d.%-15s\n\n", i+1, menuList[i]) } } - fmt.Println("\n") switch util.LoopInput("请选择: ", menuList, false) { case 1: trojan.ControllMenu() diff --git a/core/mysql.go b/core/mysql.go index f80fcda8..509a602f 100644 --- a/core/mysql.go +++ b/core/mysql.go @@ -82,7 +82,9 @@ func (mysql *Mysql) DeleteUser(id uint) error { db := mysql.GetDB() defer db.Close() userList := *mysql.GetData(strconv.Itoa(int(id))) - _ = DelValue(userList[0].Username + "_pass") + if userList[0].Username != "admin" { + _ = DelValue(userList[0].Username + "_pass") + } if _, err := db.Exec(fmt.Sprintf("DELETE FROM users WHERE id=%d;", id)); err != nil { fmt.Println(err) return err