mirror of
https://github.com/weloe/token-go.git
synced 2025-10-04 07:06:33 +08:00
feat: add GetLoginCount() to support get login count
This commit is contained in:
@@ -378,6 +378,13 @@ func (e *Enforcer) GetLoginId(ctx ctx.Context) (string, error) {
|
|||||||
return str, nil
|
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 {
|
func (e *Enforcer) Banned(id string, service string) error {
|
||||||
panic("implement me ...")
|
panic("implement me ...")
|
||||||
}
|
}
|
||||||
|
@@ -16,6 +16,7 @@ type IEnforcer interface {
|
|||||||
IsLogin(ctx ctx.Context) (bool, error)
|
IsLogin(ctx ctx.Context) (bool, error)
|
||||||
IsLoginById(id string) (bool, error)
|
IsLoginById(id string) (bool, error)
|
||||||
GetLoginId(ctx ctx.Context) (string, error)
|
GetLoginId(ctx ctx.Context) (string, error)
|
||||||
|
GetLoginCount(id string) int
|
||||||
|
|
||||||
Replaced(id string, device string) error
|
Replaced(id string, device string) error
|
||||||
// Banned TODO
|
// Banned TODO
|
||||||
|
Reference in New Issue
Block a user