bug fixed

This commit is contained in:
CortexCore
2023-07-18 20:57:02 +08:00
parent 37f46e6d16
commit e7e80c982a
16 changed files with 323 additions and 134 deletions

View File

@@ -36,6 +36,10 @@ public class IDIS_Value:IDIS_Base
/// </summary>
[Key]
public string Handle { get; set; }
/// <summary>
/// 创建用户,例如:模板名称,用户名称
/// </summary>
public string CreateUser { get; set; }
}
// ReSharper disable once IdentifierTypo
public class IDIS_Query : IDIS_Value
@@ -147,12 +151,13 @@ public class IDIS_DBContext:DbContext
ChangeTracker.DetectChanges();
ChangeTracker.Clear();
queries = Values
.Where(x => x.Handle.Contains(key))
.Where(x => x.Handle.Contains(key) || x.CreateUser.Contains(key))
.Select(x => new IDIS_Query()
{
Handle = x.Handle,
CreateTime = x.CreateTime,
UpdateTime = x.UpdateTime,
CreateUser = x.CreateUser,
Datas = Datas.Where(data => data.Handle == x.Handle).ToArray(),
References = References.Where(reference => reference.Handle == x.Handle).ToArray()
}).ToArray();
@@ -171,7 +176,7 @@ public class IDIS_DBContext:DbContext
query = queries.FirstOrDefault();
return queries.Any();
}
public bool Register(string handle)
public bool Register(string handle,string createUser = Constant.System.Internal)
{
var handleExists = Values.Any(x => x.Handle == handle);
if (handleExists)
@@ -180,7 +185,8 @@ public class IDIS_DBContext:DbContext
}
var value = new IDIS_Value()
{
Handle = handle
Handle = handle,
CreateUser = createUser,
};
Values.Add(value);
SaveChangesAsync();
@@ -252,7 +258,7 @@ public partial class IDIS_Service:Node
}
public bool Query(string word,out IDIS_Query[] queries) => Context.Query(word, out queries);
public bool Register(string handle) => Context.Register(handle);
public bool Register(string handle,string createUser=Constant.System.Internal) => Context.Register(handle,createUser);
public void Register(string handle,string name, string format, string value,string category) => Context.Register(handle,name, format, value,category);
public void RegisterReference(string handle,string refenceHandle) => Context.RegisterReference(handle,refenceHandle);
public static string GenerateHandle() => $"88.123.99/{Mathf.Abs(Guid.NewGuid().GetHashCode())}";