feat: 更新 ILogin 接口

This commit is contained in:
Argo-Tianyi 2022-01-15 13:06:59 +08:00
parent b8078fd505
commit 9f3777209c
2 changed files with 11 additions and 20 deletions

View File

@ -1,11 +1,6 @@
using BootstrapAdmin.Web.Core;
using BootstrapAdmin.DataAccess.Models;
using BootstrapAdmin.Web.Core;
using PetaPoco;
using BootstrapAdmin.DataAccess.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace BootstrapAdmin.DataAccess.PetaPoco.Services;
@ -19,15 +14,14 @@ class LoginService : ILogin
///
/// </summary>
/// <param name="userName"></param>
/// <param name="loginTime"></param>
/// <param name="IP"></param>
/// <param name="address"></param>
/// <param name="browser"></param>
/// <param name="userAgent"></param>
/// <param name="OS"></param>
/// <param name="browser"></param>
/// <param name="address"></param>
/// <param name="userAgent"></param>
/// <param name="result"></param>
/// <returns></returns>
public Task<bool> Log(string userName, DateTime loginTime, string IP, string address, string? browser, string userAgent, string OS, bool result)
public bool Log(string userName, string? IP, string? OS, string? browser, string? address, string? userAgent, bool result)
{
var loginUser = new LoginLog()
{
@ -40,9 +34,7 @@ class LoginService : ILogin
UserAgent = userAgent,
Result = result ? "登录成功" : "登录失败"
};
Database.Insert(loginUser);
return Task.FromResult(true);
return true;
}
}

View File

@ -9,13 +9,12 @@ public interface ILogin
///
/// </summary>
/// <param name="userName"></param>
/// <param name="loginTime"></param>
/// <param name="IP"></param>
/// <param name="address"></param>
/// <param name="browser"></param>
/// <param name="userAgent"></param>
/// <param name="OS"></param>
/// <param name="browser"></param>
/// <param name="address"></param>
/// <param name="userAgent"></param>
/// <param name="result"></param>
/// <returns></returns>
Task<bool> Log(string userName, DateTime loginTime, string IP, string address, string? browser, string userAgent, string OS, bool result);
bool Log(string userName, string? IP, string? OS, string? browser, string? address, string? userAgent, bool result);
}