mirror of
https://github.com/project-redbud/FunGame-Core.git
synced 2025-04-21 19:49:34 +08:00
添加before&after
This commit is contained in:
parent
6876430f7a
commit
0b272dd6b8
@ -1,5 +1,4 @@
|
||||
using System.Data;
|
||||
using System.Data.Common;
|
||||
using Milimoe.FunGame.Core.Api.Transmittal;
|
||||
using Milimoe.FunGame.Core.Library.SQLScript.Entity;
|
||||
|
||||
@ -14,8 +13,13 @@ namespace Milimoe.FunGame.Core.Library.Common.Architecture
|
||||
this.SQLHelper = SQLHelper;
|
||||
}
|
||||
|
||||
public abstract bool BeforeAuthenticator();
|
||||
|
||||
public abstract bool AfterAuthenticator();
|
||||
|
||||
public bool Authenticate(string script)
|
||||
{
|
||||
if (!BeforeAuthenticator()) return false;
|
||||
SQLHelper.ExecuteDataSet(script);
|
||||
if (SQLHelper.Success)
|
||||
{
|
||||
@ -23,6 +27,7 @@ namespace Milimoe.FunGame.Core.Library.Common.Architecture
|
||||
if (ds.Tables.Count > 0 &&
|
||||
ds.Tables[0].Rows.Count > 0)
|
||||
{
|
||||
if (!AfterAuthenticator()) return false;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@ -31,6 +36,7 @@ namespace Milimoe.FunGame.Core.Library.Common.Architecture
|
||||
|
||||
public bool Authenticate<T>(string script, string column, T keyword)
|
||||
{
|
||||
if (!BeforeAuthenticator()) return false;
|
||||
SQLHelper.ExecuteDataSet(script);
|
||||
if (SQLHelper.Success)
|
||||
{
|
||||
@ -40,24 +46,26 @@ namespace Milimoe.FunGame.Core.Library.Common.Architecture
|
||||
ds.Tables[0].Rows.Count > 0 &&
|
||||
ds.Tables[0].AsEnumerable().Where(row => row.Field<T>(column)!.Equals(keyword)).Any())
|
||||
{
|
||||
if (!AfterAuthenticator()) return false;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public bool Authenticate(string script, string username, string password)
|
||||
public bool Authenticate(string username, string password)
|
||||
{
|
||||
SQLHelper.ExecuteDataSet(script);
|
||||
if (!BeforeAuthenticator()) return false;
|
||||
SQLHelper.ExecuteDataSet(UserQuery.Select_Users_LoginQuery(username, password));
|
||||
if (SQLHelper.Success)
|
||||
{
|
||||
DataSet ds = SQLHelper.DataSet;
|
||||
if (ds.Tables.Count > 0 &&
|
||||
ds.Tables[0].Columns.Contains(UserQuery.Column_Username) &&
|
||||
ds.Tables[0].Columns.Contains(UserQuery.Column_Password) &&
|
||||
ds.Tables[0].Rows.Count > 0 &&
|
||||
ds.Tables[0].AsEnumerable().Where(row => (string)row[UserQuery.Column_Username] == username && (string)row[UserQuery.Column_Password] == password).Any())
|
||||
ds.Tables[0].Rows.Count > 0)
|
||||
{
|
||||
if (!AfterAuthenticator()) return false;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user