From a767a4251bfaaf88a31c8e6358c6338c6f34dd50 Mon Sep 17 00:00:00 2001 From: Jrohy Date: Thu, 14 Jan 2021 15:54:44 +0800 Subject: [PATCH] =?UTF-8?q?sql=E6=9D=A1=E4=BB=B6=E6=9F=A5=E8=AF=A2?= =?UTF-8?q?=E5=8C=BA=E5=88=86=E5=A4=A7=E5=B0=8F=E5=86=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- core/mysql.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/core/mysql.go b/core/mysql.go index 65c0b2e7..b99ff765 100644 --- a/core/mysql.go +++ b/core/mysql.go @@ -316,7 +316,7 @@ func (mysql *Mysql) CleanDataByName(usernames []string) error { return errors.New("can't connect mysql") } defer db.Close() - runSql := "UPDATE users SET download=0, upload=0 WHERE username in (" + runSql := "UPDATE users SET download=0, upload=0 WHERE BINARY username in (" for i, name := range usernames { runSql = runSql + "'" + name + "'" if i == len(usernames)-1 { @@ -339,7 +339,7 @@ func (mysql *Mysql) GetUserByName(name string) *User { return nil } defer db.Close() - user, err := queryUser(db, fmt.Sprintf("SELECT * FROM users WHERE username='%s'", name)) + user, err := queryUser(db, fmt.Sprintf("SELECT * FROM users WHERE BINARY username='%s'", name)) if err != nil { return nil } @@ -353,7 +353,7 @@ func (mysql *Mysql) GetUserByPass(pass string) *User { return nil } defer db.Close() - user, err := queryUser(db, fmt.Sprintf("SELECT * FROM users WHERE passwordShow='%s'", pass)) + user, err := queryUser(db, fmt.Sprintf("SELECT * FROM users WHERE BINARY passwordShow='%s'", pass)) if err != nil { return nil }