✏️ 修复 control 全局禁用

This commit is contained in:
fumiama 2021-11-27 00:56:22 +08:00
parent d4bceb1922
commit f8ca9355d2
2 changed files with 2 additions and 6 deletions

View File

@ -94,7 +94,6 @@ func (m *Control) IsEnabledIn(gid int64) bool {
m.RLock() m.RLock()
err = db.Find(m.service, &c, "WHERE gid = "+strconv.FormatInt(gid, 10)) err = db.Find(m.service, &c, "WHERE gid = "+strconv.FormatInt(gid, 10))
m.RUnlock() m.RUnlock()
logrus.Debugln("[control] db find gid =", c.GroupID)
if err == nil && gid == c.GroupID { if err == nil && gid == c.GroupID {
logrus.Debugf("[control] plugin %s of grp %d : %d", m.service, c.GroupID, c.Disable) logrus.Debugf("[control] plugin %s of grp %d : %d", m.service, c.GroupID, c.Disable)
return c.Disable == 0 return c.Disable == 0

View File

@ -133,17 +133,14 @@ func (db *Sqlite) Find(table string, objptr interface{}, condition string) error
if !rows.Next() { if !rows.Next() {
return errors.New("sql.Find: null result") return errors.New("sql.Find: null result")
} }
err = rows.Scan(addrs(objptr)...)
for rows.Next() { for rows.Next() {
if err != nil { if err != nil {
return err return err
} }
err = rows.Scan(addrs(objptr)...) err = rows.Scan(addrs(objptr)...)
if err != nil {
return err
}
} }
return nil return err
} }
// ListTables 列出所有表名 // ListTables 列出所有表名