mirror of
https://github.com/openimsdk/open-im-server.git
synced 2026-06-23 18:14:08 +08:00
在线设备的时间
This commit is contained in:
parent
58defe6373
commit
1a0f0fdfbf
@ -311,14 +311,27 @@ func (s *authServer) GetActiveDevices(ctx context.Context, req *pbauth.GetActive
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
for _, state := range m {
|
||||
if state == constant.NormalToken {
|
||||
devices = append(devices, &pbauth.DeviceInfo{
|
||||
PlatformID: int32(platformID),
|
||||
PlatformName: platformName,
|
||||
})
|
||||
break
|
||||
var maxLoginUnix int64
|
||||
var hasNormal bool
|
||||
for tokenStr, state := range m {
|
||||
if state != constant.NormalToken {
|
||||
continue
|
||||
}
|
||||
hasNormal = true
|
||||
claims, err := tokenverify.GetClaimFromToken(tokenStr, authverify.Secret(s.config.Share.Secret))
|
||||
if err != nil || claims.IssuedAt == nil {
|
||||
continue
|
||||
}
|
||||
if u := claims.IssuedAt.Unix(); u > maxLoginUnix {
|
||||
maxLoginUnix = u
|
||||
}
|
||||
}
|
||||
if hasNormal {
|
||||
devices = append(devices, &pbauth.DeviceInfo{
|
||||
PlatformID: int32(platformID),
|
||||
PlatformName: platformName,
|
||||
LoginTimeSeconds: maxLoginUnix,
|
||||
})
|
||||
}
|
||||
}
|
||||
return &pbauth.GetActiveDevicesResp{Devices: devices}, nil
|
||||
|
||||
2
protocol
2
protocol
@ -1 +1 @@
|
||||
Subproject commit 510b9a7dc27703beab55334622e4ecf17b8a4d50
|
||||
Subproject commit 7bd25d8024043c6f8ebd4c6d473a89e7034e639d
|
||||
Loading…
x
Reference in New Issue
Block a user