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.
67 lines
2.3 KiB
C#
67 lines
2.3 KiB
C#
using System.Text.Json;
|
|
using OMS.NET.Common;
|
|
using OMS.NET.DbClass;
|
|
using ZstdSharp.Unsafe;
|
|
|
|
namespace OMS.NET.Instructs
|
|
{
|
|
/// <summary>
|
|
/// 用于测试和代码复制
|
|
/// </summary>
|
|
public class TestInstruct : Instruct
|
|
{
|
|
public TestInstruct()
|
|
{
|
|
Type = "test";
|
|
}
|
|
|
|
public override Task Handler(string wsid)
|
|
{
|
|
return Task.Run(() =>
|
|
{
|
|
//GlobalArea.UserConnects.Where(x => x.ID == wsid).First().UserEmail = "xxx@xx.com";//login
|
|
// Log.Info("当前客户端连接数:" + GlobalArea.ConnectClientsCount);
|
|
// Log.Info("当前登录用户数:" + GlobalArea.LoginUserCount);
|
|
//测试数据表连接
|
|
if (Data?.GetType() != typeof(JsonElement)) return;//Data 非空和JsonElement类型检查
|
|
try
|
|
{
|
|
int op = Data.GetInt32();
|
|
Map map = new()
|
|
{
|
|
Id = "map1",
|
|
Name = "test",
|
|
Description = "haksjhdkasd"
|
|
};
|
|
switch (op)
|
|
{
|
|
case 0:
|
|
map.Test();
|
|
break;
|
|
case 1:
|
|
map.Insert();
|
|
Log.Debug($"插入测试成功,新的id为{map.Id}");
|
|
break;
|
|
case 2:
|
|
Log.Debug(string.Join(',', map.ShowDetail()));
|
|
break;
|
|
case 3:
|
|
map.Description = "随便写一个有意义的字符串";
|
|
map.Update();
|
|
break;
|
|
case 4:
|
|
map.Delete();
|
|
Log.Debug($"删除测试成功");
|
|
break;
|
|
default:
|
|
throw new Exception("do nothing");
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
Log.Warn($"处理{Type}指令出错:" + ex.Message);
|
|
}
|
|
});
|
|
}
|
|
}
|
|
} |