Fix GetOnlineUserCount() panic

This commit is contained in:
Yang Luo 2024-03-05 20:48:42 +08:00
parent 778f0fcb77
commit 2c477f2ba2
1 changed files with 7 additions and 2 deletions

View File

@ -14,7 +14,11 @@
package casdoor
import "github.com/casdoor/casdoor-go-sdk/casdoorsdk"
import (
"fmt"
"github.com/casdoor/casdoor-go-sdk/casdoorsdk"
)
func GetUsers() []*casdoorsdk.User {
if adapter != nil {
@ -61,7 +65,8 @@ func GetOnlineUserCount() int {
} else {
count, err := casdoorsdk.GetUserCount("1")
if err != nil {
panic(err)
fmt.Printf("GetOnlineUserCount() error, %s\n", err.Error())
return -1
}
return count