mirror of https://github.com/casbin/casnode.git
Fix GetOnlineUserCount() panic
This commit is contained in:
parent
778f0fcb77
commit
2c477f2ba2
|
@ -14,7 +14,11 @@
|
||||||
|
|
||||||
package casdoor
|
package casdoor
|
||||||
|
|
||||||
import "github.com/casdoor/casdoor-go-sdk/casdoorsdk"
|
import (
|
||||||
|
"fmt"
|
||||||
|
|
||||||
|
"github.com/casdoor/casdoor-go-sdk/casdoorsdk"
|
||||||
|
)
|
||||||
|
|
||||||
func GetUsers() []*casdoorsdk.User {
|
func GetUsers() []*casdoorsdk.User {
|
||||||
if adapter != nil {
|
if adapter != nil {
|
||||||
|
@ -61,7 +65,8 @@ func GetOnlineUserCount() int {
|
||||||
} else {
|
} else {
|
||||||
count, err := casdoorsdk.GetUserCount("1")
|
count, err := casdoorsdk.GetUserCount("1")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
fmt.Printf("GetOnlineUserCount() error, %s\n", err.Error())
|
||||||
|
return -1
|
||||||
}
|
}
|
||||||
|
|
||||||
return count
|
return count
|
||||||
|
|
Loading…
Reference in New Issue