From 20771d4d8b3091ef56628607bc1b0049625f3a81 Mon Sep 17 00:00:00 2001 From: Shingo INADA Date: Mon, 31 May 2021 08:16:33 +0900 Subject: [PATCH] fix sql for IsBanned --- gdxsv/db_sqlite.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/gdxsv/db_sqlite.go b/gdxsv/db_sqlite.go index 67246ef..3f92695 100644 --- a/gdxsv/db_sqlite.go +++ b/gdxsv/db_sqlite.go @@ -602,9 +602,9 @@ func (db SQLiteDB) GetString(key string) (string, error) { func (db SQLiteDB) IsBanned(ip, cpuid string) (bool, error) { banned := 0 err := db.QueryRowx(`SELECT 1 FROM account WHERE -(last_login_ip = ? OR (last_login_cpuid <> "" AND last_login_cpuid = ?)) AND -(SELECT login_key FROM user WHERE user_id IN (SELECT key FROM m_ban WHERE datetime() < until)) = login_key -LIMIT 1`, ip, cpuid).Scan(&banned) + (last_login_ip = ? OR ( last_login_cpuid <> "" AND last_login_cpuid = ?)) AND + (login_key IN (SELECT login_key FROM user WHERE user_id IN (SELECT key FROM m_ban WHERE datetime() < until))) LIMIT 1`, + ip, cpuid).Scan(&banned) if err == sql.ErrNoRows { return false, nil }