forked from ddrilling/AsbCloudServer
Adapt RequestLogUserDto for frontend usage
This commit is contained in:
parent
852e13f140
commit
5d45eb7289
@ -1,19 +1,16 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace AsbCloudApp.Data
|
||||
{
|
||||
public class RequestLogUserDto
|
||||
{
|
||||
public int Id { get; set; }
|
||||
public int UserId { get; set; }
|
||||
public string Login { get; set; }
|
||||
public string Ip { get; set; }
|
||||
public long ElapsedMs { get; set; }
|
||||
public DateTime LastDate { get; set; }
|
||||
public long Requests { get; set; }
|
||||
public long Errors { get; set; }
|
||||
public long Errors { get; set; }
|
||||
public UserDto User { get; set; }
|
||||
}
|
||||
}
|
||||
|
@ -22,7 +22,7 @@ namespace AsbCloudInfrastructure.Services
|
||||
private readonly ConcurrentQueue<RequestLogDto> slowRequests = new ConcurrentQueue<RequestLogDto>();
|
||||
private readonly ConcurrentQueue<RequestLogDto> errorRequests = new ConcurrentQueue<RequestLogDto>();
|
||||
private readonly ConcurrentDictionary<string, RequestLogUserDto> users = new ConcurrentDictionary<string, RequestLogUserDto>();
|
||||
|
||||
|
||||
private static IEnumerable<RequestLogDto> Get(IEnumerable<RequestLogDto> list, int take = -1)
|
||||
{
|
||||
IEnumerable<RequestLogDto> orderedlist = list.OrderByDescending(r => r.Date);
|
||||
@ -35,7 +35,7 @@ namespace AsbCloudInfrastructure.Services
|
||||
{
|
||||
IEnumerable<RequestLogUserDto> result = users.Values.OrderByDescending(u => u.LastDate);
|
||||
if (take > 0)
|
||||
result = result.Take(take);
|
||||
result = result.Take(take);
|
||||
return result;
|
||||
}
|
||||
|
||||
@ -109,9 +109,10 @@ namespace AsbCloudInfrastructure.Services
|
||||
if (!users.ContainsKey(key))
|
||||
users[key] = new RequestLogUserDto
|
||||
{
|
||||
Id = requestLog.UserId,
|
||||
UserId = requestLog.UserId,
|
||||
Ip = requestLog.UserIp,
|
||||
Login = requestLog.UserLogin,
|
||||
//User = userService.Get(requestLog.UserId),
|
||||
};
|
||||
users[key].ElapsedMs += requestLog.ElapsedMilliseconds;
|
||||
users[key].LastDate = requestLog.Date;
|
||||
|
Loading…
Reference in New Issue
Block a user