调整

parent 862ca1cf
...@@ -48,7 +48,7 @@ public ApiResponse CustomExtract(int allotId) ...@@ -48,7 +48,7 @@ public ApiResponse CustomExtract(int allotId)
} }
else else
{ {
scopedQueue.Send(new Notification(allotId, "Notification", new UrlContent("自定义数据提取数据失败", resultFilePath, NotificationLevel.ERR))); scopedQueue.Send(new Notification(allotId, "Notification", new TextContent("自定义数据提取数据失败", NotificationLevel.ERR)));
} }
await Task.Delay(TimeSpan.FromSeconds(5), token); await Task.Delay(TimeSpan.FromSeconds(5), token);
......
...@@ -72,30 +72,30 @@ public Notification(int userId, string method, PushContent body) ...@@ -72,30 +72,30 @@ public Notification(int userId, string method, PushContent body)
public abstract class PushContent public abstract class PushContent
{ {
protected PushContent(string content, NotificationLevel level) protected PushContent(string subject, NotificationLevel level)
{ {
Content = content; Subject = subject;
LogLevel = level; LogLevel = level.ToString();
} }
public abstract string Type { get; } public abstract string Type { get; }
public NotificationLevel LogLevel { get; set; } public string LogLevel { get; }
public string Time { get => DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); } public string Time { get => DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); }
public string Content { get; set; } public string Subject { get; set; }
} }
} }
public class EventContent : Notification.PushContent public class EventContent : Notification.PushContent
{ {
public EventContent(object eventId, string subject, string content, NotificationLevel level = NotificationLevel.INF) public EventContent(object eventId, string subject, string content, NotificationLevel level = NotificationLevel.INF)
: base(content, level) : base(subject, level)
{ {
EventId = eventId; EventId = eventId;
Subject = subject; Content = content;
} }
public object EventId { get; set; } public object EventId { get; set; }
public string Subject { get; set; } public string Content { get; set; }
public override string Type => "Event"; public override string Type => "Event";
} }
...@@ -111,11 +111,11 @@ public TextContent(string content, NotificationLevel level = NotificationLevel.I ...@@ -111,11 +111,11 @@ public TextContent(string content, NotificationLevel level = NotificationLevel.I
public class UrlContent : Notification.PushContent public class UrlContent : Notification.PushContent
{ {
public UrlContent(string subject, string url, NotificationLevel level = NotificationLevel.INF) public UrlContent(string subject, string url, NotificationLevel level = NotificationLevel.INF)
: base(url, level) : base(subject, level)
{ {
Subject = subject; Content = url;
} }
public string Subject { get; set; } public string Content { get; set; }
public override string Type => "Url"; public override string Type => "Url";
} }
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment