fix 优化apilog和设备上传log
This commit is contained in:
@@ -57,7 +57,6 @@ public class EnumsController : ControllerBase
|
||||
})
|
||||
.ToList();
|
||||
|
||||
//todo cache 速度
|
||||
var dbTypes = _dbContext.Queryable<BasicTypeEntity>().OrderBy(x => x.Sequence).ToList();
|
||||
var dbResult = dbTypes.GroupBy(x => x.Type).Select(g =>
|
||||
{
|
||||
@@ -77,6 +76,29 @@ public class EnumsController : ControllerBase
|
||||
|
||||
result.AddRange(dbResult);
|
||||
|
||||
result.Add(GetCurrentEnums("LogLevel", "日志级别", typeof(LogLevel)));
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
private static CommonEnumResponse GetCurrentEnums(string code, string name, Type enumType)
|
||||
{
|
||||
return new CommonEnumResponse
|
||||
{
|
||||
Code = code,
|
||||
Name = name,
|
||||
Data = enumType.GetFields(BindingFlags.Public | BindingFlags.Static).Select(item =>
|
||||
{
|
||||
var e = (Enum)Enum.Parse(item.FieldType, item.GetValue(null).ToString());
|
||||
var fd = e.GetDescription();
|
||||
return new KeyValueDto
|
||||
{
|
||||
Key = fd,
|
||||
Value = (int)item.GetValue(null)
|
||||
};
|
||||
})
|
||||
.ToList()
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user