🐛 Fix online condition

This commit is contained in:
LittleSheep 2024-06-26 20:13:34 +08:00
parent 7c0713a12f
commit 8c2649e29d

View File

@ -40,7 +40,7 @@ func GetStatus(uid uint) (models.Status, error) {
func GetStatusDisturbable(uid uint) error { func GetStatusDisturbable(uid uint) error {
status, err := GetStatus(uid) status, err := GetStatus(uid)
isOnline := wsConn[uid] == nil || len(wsConn[uid]) < 0 isOnline := wsConn[uid] != nil && len(wsConn[uid]) > 0
if isOnline && err != nil { if isOnline && err != nil {
return nil return nil
} else if err == nil && status.IsNoDisturb { } else if err == nil && status.IsNoDisturb {
@ -52,7 +52,7 @@ func GetStatusDisturbable(uid uint) error {
func GetStatusOnline(uid uint) error { func GetStatusOnline(uid uint) error {
status, err := GetStatus(uid) status, err := GetStatus(uid)
isOnline := wsConn[uid] == nil || len(wsConn[uid]) < 0 isOnline := wsConn[uid] != nil && len(wsConn[uid]) > 0
if isOnline && err != nil { if isOnline && err != nil {
return nil return nil
} else if err == nil && status.IsInvisible { } else if err == nil && status.IsInvisible {