增加工单模块
This commit is contained in:
1 parent
dc136e449e
commit
f9dcae4610
17 files changed
+4908
No files matched your search
@@ -0,0 +1,133 @@
|
||||
using System.Runtime.Serialization;
|
||||
|
||||
namespace OrderSupportTicket.Models;
|
||||
|
||||
/// <summary>
|
||||
/// SSE 实时通知。通知只包含摘要定位信息,收到后需要重新查询对应工单。
|
||||
/// </summary>
|
||||
[DataContract]
|
||||
public sealed class TicketRealtimeNotification
|
||||
{
|
||||
/// <summary>
|
||||
/// 服务端事件 ID,用于至少一次投递时的去重。
|
||||
/// </summary>
|
||||
[DataMember(Name = "eventId")]
|
||||
public string EventId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 事件类型,例如 relay.ticket.message_added 或 resync_required。
|
||||
/// </summary>
|
||||
[DataMember(Name = "type")]
|
||||
public string Type { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 发生变更的店铺 APPID。
|
||||
/// </summary>
|
||||
[DataMember(Name = "appId")]
|
||||
public string AppId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 发生变更的微信订单号,保持为数字字符串。
|
||||
/// </summary>
|
||||
[DataMember(Name = "wechatOrderId")]
|
||||
public string WechatOrderId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 新增消息的消息 ID。
|
||||
/// </summary>
|
||||
[DataMember(Name = "messageId")]
|
||||
public string MessageId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 工单版本号,按服务端返回的字符串原样保存。
|
||||
/// </summary>
|
||||
[DataMember(Name = "version")]
|
||||
public string Version { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 事件发生时间,保留服务端 ISO 8601 字符串。
|
||||
/// </summary>
|
||||
[DataMember(Name = "occurredAt")]
|
||||
public string OccurredAt { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 是否要求客户端执行全量重新同步。
|
||||
/// </summary>
|
||||
public bool IsResyncRequired =>
|
||||
string.Equals(Type, "resync_required", System.StringComparison.OrdinalIgnoreCase);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// SSE 连接状态。
|
||||
/// </summary>
|
||||
public enum TicketRealtimeState
|
||||
{
|
||||
/// <summary>
|
||||
/// 未连接。
|
||||
/// </summary>
|
||||
Disconnected,
|
||||
|
||||
/// <summary>
|
||||
/// 正在建立连接。
|
||||
/// </summary>
|
||||
Connecting,
|
||||
|
||||
/// <summary>
|
||||
/// 已连接并接收事件。
|
||||
/// </summary>
|
||||
Connected,
|
||||
|
||||
/// <summary>
|
||||
/// 连接中断,正在自动重连。
|
||||
/// </summary>
|
||||
Reconnecting
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// SSE 通知事件参数。
|
||||
/// </summary>
|
||||
public sealed class TicketRealtimeNotificationEventArgs : System.EventArgs
|
||||
{
|
||||
/// <summary>
|
||||
/// 创建 SSE 通知事件参数。
|
||||
/// </summary>
|
||||
/// <param name="notification">收到的 SSE 通知。</param>
|
||||
public TicketRealtimeNotificationEventArgs(TicketRealtimeNotification notification)
|
||||
{
|
||||
Notification = notification;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 收到的 SSE 通知。
|
||||
/// </summary>
|
||||
public TicketRealtimeNotification Notification { get; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// SSE 连接状态变化事件参数。
|
||||
/// </summary>
|
||||
public sealed class TicketRealtimeStateChangedEventArgs : System.EventArgs
|
||||
{
|
||||
/// <summary>
|
||||
/// 创建 SSE 连接状态变化事件参数。
|
||||
/// </summary>
|
||||
/// <param name="state">变化后的连接状态。</param>
|
||||
/// <param name="message">可选的连接状态说明。</param>
|
||||
public TicketRealtimeStateChangedEventArgs(
|
||||
TicketRealtimeState state,
|
||||
string message = null)
|
||||
{
|
||||
State = state;
|
||||
Message = message;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 变化后的连接状态。
|
||||
/// </summary>
|
||||
public TicketRealtimeState State { get; }
|
||||
|
||||
/// <summary>
|
||||
/// 连接状态说明。
|
||||
/// </summary>
|
||||
public string Message { get; }
|
||||
}
|
||||
Reference in new issue
Block a user