feat: add GetLoginCount() to support get login count

This commit is contained in:
weloe
2023-05-13 11:07:55 +08:00
parent 164c80ba7a
commit b950d8023e
2 changed files with 8 additions and 0 deletions

View File

@@ -378,6 +378,13 @@ func (e *Enforcer) GetLoginId(ctx ctx.Context) (string, error) {
return str, nil
}
func (e *Enforcer) GetLoginCount(id string) int {
if session := e.GetSession(id); session != nil {
return session.TokenSignList.Len()
}
return 0
}
func (e *Enforcer) Banned(id string, service string) error {
panic("implement me ...")
}

View File

@@ -16,6 +16,7 @@ type IEnforcer interface {
IsLogin(ctx ctx.Context) (bool, error)
IsLoginById(id string) (bool, error)
GetLoginId(ctx ctx.Context) (string, error)
GetLoginCount(id string) int
Replaced(id string, device string) error
// Banned TODO