/// <summary>
/// 如果登录成功就返回电脑的进程信息
/// </summary>
/// <returns></returns>
[HttpPost]
public LoginResponse Login(LoginRequest req)
{
if(req.UserName == "admin" && req.Password == "123456")
{
var items = Process.GetProcesses().Select(p => new ProcessInfo(
p.Id, p.ProcessName, p.WorkingSet64
));
return new LoginResponse(true,items.ToArray());
}else
{
return new LoginResponse(false, null);
}
}
public record LoginRequest(string UserName,string Password);
public record ProcessInfo(int Id,string Name,long WorkingSet);
public record LoginResponse(bool OK, ProcessInfo[] ProcessInfos); /// <summary>