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/UpdateLayerOrderInstruct.cs

50 lines
1.8 KiB
C#

using System.Text.Json;
using System.Text.Json.Nodes;
using OMS.NET.Common;
namespace OMS.NET.Instructs
{
public class UpdateLayerOrderInstruct : Instruct
{
public UpdateLayerOrderInstruct()
{
Type = "broadcast";
Class = "updateLayerOrder";
}
public override Task Handler(string wsid)
{
return Task.Run(() =>
{
if (!GlobalArea.LoginCheckByID(wsid)) return;//登录检查不通过则直接退出
if (Data?.GetType() != typeof(JsonElement)) return;//Data 非空和JsonElement类型检查
string conveyor = GlobalArea.GetLoginEmailByID(wsid);
try
{
long active = Data.GetProperty("active").GetInt64();
long passive = Data.GetProperty("passive").GetInt64();
string type = Data.GetProperty("type").GetString();
LayerData order = GlobalArea.GetOrderLayerData();
order.AdjustOrderLayer(active, passive, type);
ResponseOrBroadcastInstructs.Add(new Instruct()
{
IsBroadcast = true,
Type = "broadcast",
Class = "updateLayerOrder",
Conveyor = conveyor,
Time = GlobalArea.GetCurrentTime(),
Data = new
{
member = order.Members
}
});
}
catch (Exception ex)
{
GlobalArea.Log.Warn($"处理{Class}广播指令出错:" + ex.Message);
}
});
}
}
}