From e90725c067f202b594f8e8e908403a41ebe44b44 Mon Sep 17 00:00:00 2001 From: colin Date: Fri, 8 Aug 2025 18:22:34 +0800 Subject: [PATCH] feat(account): my session returns the user id --- .../LINGYUN/Abp/Account/Dto/IdentitySessionDto.cs | 2 ++ .../LINGYUN/Abp/Account/MyProfileAppService.cs | 7 ++++--- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/aspnet-core/modules/account/LINGYUN.Abp.Account.Application.Contracts/LINGYUN/Abp/Account/Dto/IdentitySessionDto.cs b/aspnet-core/modules/account/LINGYUN.Abp.Account.Application.Contracts/LINGYUN/Abp/Account/Dto/IdentitySessionDto.cs index 0562964ed..20900165d 100644 --- a/aspnet-core/modules/account/LINGYUN.Abp.Account.Application.Contracts/LINGYUN/Abp/Account/Dto/IdentitySessionDto.cs +++ b/aspnet-core/modules/account/LINGYUN.Abp.Account.Application.Contracts/LINGYUN/Abp/Account/Dto/IdentitySessionDto.cs @@ -14,6 +14,8 @@ public class IdentitySessionDto : EntityDto public string IpAddresses { get; set; } + public Guid UserId { get; set; } + public DateTime SignedIn { get; set; } public DateTime? LastAccessed { get; set; } diff --git a/aspnet-core/modules/account/LINGYUN.Abp.Account.Application/LINGYUN/Abp/Account/MyProfileAppService.cs b/aspnet-core/modules/account/LINGYUN.Abp.Account.Application/LINGYUN/Abp/Account/MyProfileAppService.cs index cf6500bd8..a0cb80856 100644 --- a/aspnet-core/modules/account/LINGYUN.Abp.Account.Application/LINGYUN/Abp/Account/MyProfileAppService.cs +++ b/aspnet-core/modules/account/LINGYUN.Abp.Account.Application/LINGYUN/Abp/Account/MyProfileAppService.cs @@ -75,12 +75,12 @@ public class MyProfileAppService : AccountApplicationServiceBase, IMyProfileAppS public async virtual Task> GetSessionsAsync(GetMySessionsInput input) { - var user = await GetCurrentUserAsync(); + var userId = CurrentUser.GetId(); var totalCount = await IdentitySessionRepository.GetCountAsync( - user.Id, input.Device, input.ClientId); + userId, input.Device, input.ClientId); var identitySessions = await IdentitySessionRepository.GetListAsync( input.Sorting, input.MaxResultCount, input.SkipCount, - user.Id, input.Device, input.ClientId); + userId, input.Device, input.ClientId); return new PagedResultDto(totalCount, identitySessions.Select(session => new IdentitySessionDto @@ -90,6 +90,7 @@ public class MyProfileAppService : AccountApplicationServiceBase, IMyProfileAppS SignedIn = session.SignedIn, ClientId = session.ClientId, Device = session.Device, + UserId = session.UserId, DeviceInfo = session.DeviceInfo, IpAddresses = session.IpAddresses, LastAccessed = session.LastAccessed,