You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
OMS.NET/Instructs/TextMessageBroadcastInstruc...

39 lines
1.3 KiB
C#

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

using System.Text.Json;
namespace OMS.NET.Instructs
{
public class TextMessageBroadcastInstruct : BroadcastInstuct
{
public TextMessageBroadcastInstruct()
{
this.Class = "textMessage";
}
public override Task Handler(string wsid)
{
return Task.Run(() =>
{
if (!GlobalArea.LoginCheckByID(wsid)) return;//登录检查不通过则直接退出
if (Data?.GetType() != typeof(JsonElement)) return;
try
{
string message = Data.GetProperty("message").GetString();
string conveyor = GlobalArea.GetLoginEmailByID(wsid);
string time = GlobalArea.GetCurrentTime();
GlobalArea.Log.Info($"[{time}] {conveyor}:{message}");
ResponseOrBroadcastInstructs.Add(new TextMessageBroadcastInstruct()
{
IsBroadcast = true,
Conveyor = conveyor,
Time = time,
Data = Data
});
}
catch (Exception ex)
{
GlobalArea.Log.Warn("处理textMessage发生问题" + ex.Message);
}
});
}
}
}