mirror of
https://github.com/truewhile/MeBox.git
synced 2026-10-07 05:46:38 +08:00
fix: refresh emby sessions in realtime
This commit is contained in:
@@ -119,6 +119,7 @@ func (s *TelegramBotService) cmdUnbindInactive(ctx context.Context, args []strin
|
||||
return telegramCommandReply{Text: "读取用户失败:" + err.Error()}
|
||||
}
|
||||
cutoff := time.Now().Add(-time.Duration(days) * 24 * time.Hour)
|
||||
recentWindow := time.Duration(days) * 24 * time.Hour
|
||||
var userIDs []string
|
||||
var done []string
|
||||
for _, user := range users {
|
||||
@@ -132,6 +133,9 @@ func (s *TelegramBotService) cmdUnbindInactive(ctx context.Context, args []strin
|
||||
if lastActive.IsZero() || lastActive.After(cutoff) {
|
||||
continue
|
||||
}
|
||||
if s.device != nil && s.device.UserRecentlyActive(ctx, user.ID, recentWindow) {
|
||||
continue
|
||||
}
|
||||
var count int64
|
||||
_ = s.repo.DB.WithContext(ctx).Model(&model.TelegramBinding{}).Where("user_id = ?", user.ID).Count(&count).Error
|
||||
if count == 0 {
|
||||
|
||||
Reference in New Issue
Block a user