public static List <BizLogModel> ShowBizLogInfo(BizLog log) { int totalRecords = 99; int pageIndex = 1; int pageSize = 99; using (APIClient client = new APIClient()) { var getData = client.QueryLog(out totalRecords, new BizLogFilter() { PageIndex = pageIndex, PageSize = pageSize, SystemCode = GetSystemType.GetSystemTypeCode(log.SystemCode) }); return(getData.ToList()); } }
public static PagedList <BizLogModel> QueryBizLogInfo(BizLog log, int pageIndex, int pageSize, DateTime?startTime, DateTime?endTime, out int totalRecords) { BizLogModel[] getData = new BizLogModel[] {}; using (APIClient client = new APIClient()) { getData = client.QueryLog(out totalRecords, new BizLogFilter() { PageIndex = pageIndex, PageSize = pageSize, Keyword = log.Keyword, KeywordTypeID = (int)log.KeywordType, Summary = log.Summary, SystemCode = GetSystemType.GetSystemTypeCode(log.SystemCode), ModuleName = log.ModuleName, UserRealName = log.UserRealName, CreateOnStart = startTime, CreateOnEnd = endTime }); } return(getData.ToPagedList(pageIndex, pageSize)); }
/// <summary> /// Mapping /// </summary> /// <param name="log"></param> /// <returns></returns> static BizLogModel Map(BizLog log) { if (log == null) { return(null); } BizLogModel data = new BizLogModel(); data.CreateOn = DateTime.Now; //统一处理 data.Details = log.Details; data.IP = log.IP; data.Keyword = log.Keyword; data.KeywordTypeID = (int)log.KeywordType; data.Mac = log.Mac; data.ModuleName = log.ModuleName; data.Summary = log.Summary; data.SystemCode = GetSystemType.GetSystemTypeCode(log.SystemCode); //系统 data.URL = log.URL; data.UserCode = log.UserCode; data.UserRealName = log.UserRealName; data.UserType = (int)log.UserType; return(data); }
internal static void Sort <T>(List <T> items, GetSystemType <T> getType, Type parentType) { #if !NET_DOTS lookupDictionary = null; #endif // Populate dictionary mapping systemType to system-and-before/after-types. // This is clunky - it is easier to understand, and cleaner code, to // just use a Dictionary<Type, SysAndDep>. However, Tiny doesn't currently have // the ability to use Type as a key to a NativeHash, so we're stuck until that gets addressed. // // Likewise, this is important shared code. It can be done cleaner with 2 versions, but then... // 2 sets of bugs and slightly different behavior will creep in. // var sysAndDep = new SysAndDep <T> [items.Count]; for (int i = 0; i < items.Count; ++i) { var sys = items[i]; sysAndDep[i] = new SysAndDep <T> { item = sys, type = getType(sys), updateBefore = new List <Type>(), nAfter = 0, }; } for (int i = 0; i < sysAndDep.Length; ++i) { var systemType = sysAndDep[i].type; var before = TypeManager.GetSystemAttributes(systemType, typeof(UpdateBeforeAttribute)); var after = TypeManager.GetSystemAttributes(systemType, typeof(UpdateAfterAttribute)); foreach (var attr in before) { var dep = attr as UpdateBeforeAttribute; if (!typeof(ComponentSystemBase).IsAssignableFrom(dep.SystemType)) { #if !NET_DOTS Debug.LogWarning( $"Ignoring invalid [UpdateBefore] attribute on {systemType} because {dep.SystemType} is not a subclass of {nameof(ComponentSystemBase)}.\n" + $"Set the target parameter of [UpdateBefore] to a system class in the same {nameof(ComponentSystemGroup)} as {systemType}."); #else Debug.LogWarning($"WARNING: invalid [UpdateBefore] attribute:"); Debug.LogWarning(TypeManager.GetSystemName(dep.SystemType)); Debug.LogWarning(" is not derived from ComponentSystemBase. Set the target parameter of [UpdateBefore] to a system class in the same ComponentSystemGroup."); #endif continue; } if (dep.SystemType == systemType) { #if !NET_DOTS Debug.LogWarning( $"Ignoring invalid [UpdateBefore] attribute on {systemType} because a system cannot be updated before itself.\n" + $"Set the target parameter of [UpdateBefore] to a different system class in the same {nameof(ComponentSystemGroup)} as {systemType}."); #else Debug.LogWarning($"WARNING: invalid [UpdateBefore] attribute:"); Debug.LogWarning(TypeManager.GetSystemName(systemType)); Debug.LogWarning(" depends on itself. Set the target parameter of [UpdateBefore] to a system class in the same ComponentSystemGroup."); #endif continue; } if (parentType == typeof(InitializationSystemGroup)) { if (dep.SystemType == typeof(BeginInitializationEntityCommandBufferSystem)) { #if !NET_DOTS throw new ArgumentException( $"Invalid [UpdateBefore] {dep.SystemType} attribute on {systemType}, because that system is already restricted to be first."); #else throw new ArgumentException($"Invalid [UpdateBefore] BeginInitializationEntityCommandBufferSystem, because that system is already restricted to be first."); #endif } if (dep.SystemType == typeof(EndInitializationEntityCommandBufferSystem)) { WarningForBeforeCheck(systemType, dep.SystemType); continue; } } if (parentType == typeof(SimulationSystemGroup)) { if (dep.SystemType == typeof(BeginSimulationEntityCommandBufferSystem)) { #if !NET_DOTS throw new ArgumentException( $"Invalid [UpdateBefore] {dep.SystemType} attribute on {systemType}, because that system is already restricted to be first."); #else throw new ArgumentException($"Invalid [UpdateBefore] BeginSimulationEntityCommandBufferSystem, because that system is already restricted to be first."); #endif } if (dep.SystemType == typeof(LateSimulationSystemGroup)) { WarningForBeforeCheck(systemType, dep.SystemType); continue; } if (dep.SystemType == typeof(EndSimulationEntityCommandBufferSystem)) { WarningForBeforeCheck(systemType, dep.SystemType); continue; } } if (parentType == typeof(PresentationSystemGroup)) { if (dep.SystemType == typeof(BeginPresentationEntityCommandBufferSystem)) { #if !NET_DOTS throw new ArgumentException( $"Invalid [UpdateBefore] {dep.SystemType} attribute on {systemType}, because that system is already restricted to be first."); #else throw new ArgumentException($"Invalid [UpdateBefore] BeginPreesntationEntityCommandBufferSystem, because that system is already restricted to be first."); #endif } } int depIndex = LookupSysAndDep(dep.SystemType, sysAndDep); if (depIndex < 0) { #if !NET_DOTS Debug.LogWarning( $"Ignoring invalid [UpdateBefore] attribute on {systemType} because {dep.SystemType} belongs to a different {nameof(ComponentSystemGroup)}.\n" + $"This attribute can only order systems that are children of the same {nameof(ComponentSystemGroup)}.\n" + $"Make sure that both systems are in the same parent group with [UpdateInGroup(typeof({parentType})].\n" + $"You can also change the relative order of groups when appropriate, by using [UpdateBefore] and [UpdateAfter] attributes at the group level."); #else Debug.LogWarning("WARNING: invalid [UpdateBefore] dependency:"); Debug.LogWarning(TypeManager.GetSystemName(systemType)); Debug.LogWarning(" depends on a non-sibling system: "); Debug.LogWarning(TypeManager.GetSystemName(dep.SystemType)); #endif continue; } sysAndDep[i].updateBefore.Add(dep.SystemType); sysAndDep[depIndex].nAfter++; } foreach (var attr in after) { var dep = attr as UpdateAfterAttribute; if (!typeof(ComponentSystemBase).IsAssignableFrom(dep.SystemType)) { #if !NET_DOTS Debug.LogWarning( $"Ignoring invalid [UpdateAfter] attribute on {systemType} because {dep.SystemType} is not a subclass of {nameof(ComponentSystemBase)}.\n" + $"Set the target parameter of [UpdateAfter] to a system class in the same {nameof(ComponentSystemGroup)} as {systemType}."); #else Debug.LogWarning($"WARNING: invalid [UpdateAfter] attribute:"); Debug.LogWarning(TypeManager.GetSystemName(dep.SystemType)); Debug.LogWarning(" is not derived from ComponentSystemBase. Set the target parameter of [UpdateAfter] to a system class in the same ComponentSystemGroup."); #endif continue; } if (dep.SystemType == systemType) { #if !NET_DOTS Debug.LogWarning( $"Ignoring invalid [UpdateAfter] attribute on {systemType} because a system cannot be updated after itself.\n" + $"Set the target parameter of [UpdateAfter] to a different system class in the same {nameof(ComponentSystemGroup)} as {systemType}."); #else Debug.LogWarning($"WARNING: invalid [UpdateAfter] attribute:"); Debug.LogWarning(TypeManager.GetSystemName(systemType)); Debug.LogWarning(" depends on itself. Set the target parameter of [UpdateAfter] to a system class in the same ComponentSystemGroup."); #endif continue; } if (parentType == typeof(InitializationSystemGroup)) { if (dep.SystemType == typeof(BeginInitializationEntityCommandBufferSystem)) { WarningForAfterCheck(systemType, dep.SystemType); continue; } if (dep.SystemType == typeof(EndInitializationEntityCommandBufferSystem)) { #if !NET_DOTS throw new ArgumentException( $"Invalid [UpdateAfter] {dep.SystemType} attribute on {systemType}, because that system is already restricted to be last."); #else throw new ArgumentException($"Invalid [UpdateAfter] EndInitializationEntityCommandBufferSystem, because that system is already restricted to be last."); #endif } } if (parentType == typeof(SimulationSystemGroup)) { if (dep.SystemType == typeof(BeginSimulationEntityCommandBufferSystem)) { WarningForAfterCheck(systemType, dep.SystemType); continue; } if (dep.SystemType == typeof(LateSimulationSystemGroup)) { #if !NET_DOTS throw new ArgumentException( $"Invalid [UpdateAfter] {dep.SystemType} attribute on {systemType}, because that system is already restricted to be last."); #else throw new ArgumentException($"Invalid [UpdateAfter] EndLateSimulationEntityCommandBufferSystem, because that system is already restricted to be last."); #endif } if (dep.SystemType == typeof(EndSimulationEntityCommandBufferSystem)) { #if !NET_DOTS throw new ArgumentException( $"Invalid [UpdateAfter] {dep.SystemType} attribute on {systemType}, because that system is already restricted to be last."); #else throw new ArgumentException($"Invalid [UpdateAfter] EndSimulationEntityCommandBufferSystem, because that system is already restricted to be last."); #endif } } if (parentType == typeof(PresentationSystemGroup)) { if (dep.SystemType == typeof(BeginPresentationEntityCommandBufferSystem)) { WarningForAfterCheck(systemType, dep.SystemType); continue; } } int depIndex = LookupSysAndDep(dep.SystemType, sysAndDep); if (depIndex < 0) { #if !NET_DOTS Debug.LogWarning( $"Ignoring invalid [UpdateAfter] attribute on {systemType} because {dep.SystemType} belongs to a different {nameof(ComponentSystemGroup)}.\n" + $"This attribute can only order systems that are children of the same {nameof(ComponentSystemGroup)}.\n" + $"Make sure that both systems are in the same parent group with [UpdateInGroup(typeof({parentType})].\n" + $"You can also change the relative order of groups when appropriate, by using [UpdateBefore] and [UpdateAfter] attributes at the group level."); #else Debug.LogWarning("WARNING: invalid [UpdateAfter] dependency:"); Debug.LogWarning(TypeManager.GetSystemName(systemType)); Debug.LogWarning(" depends on a non-sibling system: "); Debug.LogWarning(TypeManager.GetSystemName(dep.SystemType)); #endif continue; } sysAndDep[depIndex].updateBefore.Add(systemType); sysAndDep[i].nAfter++; } } // Clear the systems list and rebuild it in sorted order from the lookup table var readySystems = new Heap <TypeHeapElement>(items.Count); items.Clear(); for (int i = 0; i < sysAndDep.Length; ++i) { if (sysAndDep[i].nAfter == 0) { readySystems.Insert(new TypeHeapElement(i, sysAndDep[i].type)); } } while (!readySystems.Empty) { var sysIndex = readySystems.Extract().unsortedIndex; var sd = sysAndDep[sysIndex]; sysAndDep[sysIndex] = new SysAndDep <T>(); // "Remove()" items.Add(sd.item); foreach (var beforeType in sd.updateBefore) { int beforeIndex = LookupSysAndDep(beforeType, sysAndDep); if (beforeIndex < 0) { throw new Exception("Bug in SortSystemUpdateList(), beforeIndex < 0"); } if (sysAndDep[beforeIndex].nAfter <= 0) { throw new Exception("Bug in SortSystemUpdateList(), nAfter <= 0"); } sysAndDep[beforeIndex].nAfter--; if (sysAndDep[beforeIndex].nAfter == 0) { readySystems.Insert(new TypeHeapElement(beforeIndex, sysAndDep[beforeIndex].type)); } } } for (int i = 0; i < sysAndDep.Length; ++i) { if (sysAndDep[i].item != null) { // Since no System in the circular dependency would have ever been added // to the heap, we should have values for everything in sysAndDep. Check, // just in case. #if ENABLE_UNITY_COLLECTIONS_CHECKS var visitedSystems = new List <Type>(); var startIndex = i; var currentIndex = i; while (true) { if (sysAndDep[currentIndex].item != null) { visitedSystems.Add(sysAndDep[currentIndex].type); } currentIndex = LookupSysAndDep(sysAndDep[currentIndex].updateBefore[0], sysAndDep); if (currentIndex < 0 || currentIndex == startIndex || sysAndDep[currentIndex].item == null) { throw new CircularSystemDependencyException(visitedSystems); } } #else sysAndDep[i] = new SysAndDep <T>(); #endif } } }