初始化
This commit is contained in:
32
TestWebSocket/App.config
Normal file
32
TestWebSocket/App.config
Normal file
@@ -0,0 +1,32 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<configuration>
|
||||
<configSections>
|
||||
<!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
|
||||
<section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
|
||||
</configSections>
|
||||
<startup>
|
||||
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.8" />
|
||||
</startup>
|
||||
<runtime>
|
||||
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.Runtime.CompilerServices.Unsafe" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-5.0.0.0" newVersion="5.0.0.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-13.0.0.0" newVersion="13.0.0.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="MySql.Data" publicKeyToken="c5687fc88969c44d" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-8.0.29.0" newVersion="8.0.29.0" />
|
||||
</dependentAssembly>
|
||||
</assemblyBinding>
|
||||
</runtime>
|
||||
<entityFramework>
|
||||
<providers>
|
||||
<provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" />
|
||||
<provider invariantName="MySql.Data.MySqlClient" type="MySql.Data.MySqlClient.MySqlProviderServices, MySql.Data.EntityFramework, Version=8.0.29.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d">
|
||||
</provider></providers>
|
||||
</entityFramework>
|
||||
</configuration>
|
||||
294
TestWebSocket/BLL.cs
Normal file
294
TestWebSocket/BLL.cs
Normal file
@@ -0,0 +1,294 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Web;
|
||||
using System.Xml;
|
||||
using System.Data;
|
||||
using System.Data.SqlClient;
|
||||
using TestWebSocket;
|
||||
using MySql.Data.MySqlClient;
|
||||
using System.Text;
|
||||
//using Newtonsoft.Json;
|
||||
//using Newtonsoft.Json.Linq;
|
||||
|
||||
namespace WebSocketToolsConsole
|
||||
{
|
||||
public static class BLL
|
||||
{
|
||||
/// <summary>
|
||||
/// 获取所有人脸机
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
//public static DataSet GetDevices()
|
||||
//{
|
||||
// return MysqlHelpers.ExecuteDataset(MysqlHelpers.connectionString, CommandType.Text, "select a.*from tb_Devices a");
|
||||
//}
|
||||
/// <summary>
|
||||
/// 保存人脸机信息
|
||||
/// </summary>
|
||||
/// <param name="serialNo"></param>
|
||||
/// <param name="devName"></param>
|
||||
/// <returns></returns>
|
||||
public static int SaveDevice(string serialNo, string factory,string ip,string location)
|
||||
{
|
||||
try
|
||||
{
|
||||
string sql = string.Format("select Facelid from DeviceManage where SerialNo='{0}'", serialNo);
|
||||
object id = MysqlHelpers.ExecuteScalar(sql);
|
||||
if (id != null && Convert.ToInt64(id) > 0)
|
||||
{
|
||||
sql = string.Format("update DeviceManage set SerialNo='{0}',Factory='{1}',Status={2},maintainStatus={3} where Facelid={4}", serialNo, factory, 1, 0, id);
|
||||
//LogHelper.WriteLine(sql);
|
||||
return MysqlHelpers.ExecuteNonQuery(sql);
|
||||
}
|
||||
else
|
||||
{
|
||||
int status = 0;
|
||||
sql = "insert into DeviceManage (SerialNo,CreatedDate,Factory,Status,bindingStatus,faceIp,faceAddress,maintainStatus) values (@SerialNo,@CreatedDate,@Factory,@Status,@bindingStatus,@faceIp,@faceAddress,@maintainStatus)";
|
||||
MySqlParameter[] sqlParams = new MySqlParameter[8] {
|
||||
new MySqlParameter("@SerialNo", serialNo),
|
||||
new MySqlParameter("@CreatedDate", DateTime.Now),
|
||||
new MySqlParameter("@Factory", factory),
|
||||
new MySqlParameter("@Status",1),
|
||||
new MySqlParameter("@bindingStatus",status),
|
||||
new MySqlParameter("@faceIp",ip),
|
||||
new MySqlParameter("@faceAddress",location),
|
||||
new MySqlParameter("@maintainStatus",0)};
|
||||
return MysqlHelpers.ExecuteNonQuery(sql,sqlParams);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
LogHelper.WriteLine("SaveDevice()函数异常:" + ex.Message);
|
||||
|
||||
throw;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 更新设备状态
|
||||
/// </summary>
|
||||
/// <param name="serialNo"></param>
|
||||
/// <returns></returns>
|
||||
public static int Online(string serialNo)
|
||||
{
|
||||
try
|
||||
{
|
||||
string sql = string.Format("update DeviceManage set Status=0 where SerialNo='{0}'", serialNo);
|
||||
return MysqlHelpers.ExecuteNonQuery(sql);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
LogHelper.WriteLine(ex.Message);
|
||||
throw;
|
||||
}
|
||||
|
||||
}
|
||||
public static int consoleface(FaceIssue fi)
|
||||
{
|
||||
try
|
||||
{
|
||||
string sql = "insert into FaceIssue (faceSn,creationtime,pmsid,picture,issuestate) values (@faceSn,@creationtime,@pmsid,@picture,@issuestate)";
|
||||
MySqlParameter[] sqlParams = new MySqlParameter[5] {
|
||||
new MySqlParameter("@faceSn", fi.faceSn),
|
||||
new MySqlParameter("@creationtime",fi.creationtime),
|
||||
new MySqlParameter("@pmsid", fi.pmsid),
|
||||
new MySqlParameter("@picture",fi.picture),
|
||||
new MySqlParameter("@issuestate",fi.issuestate)};
|
||||
return MysqlHelpers.ExecuteNonQuery(sql,sqlParams);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
LogHelper.WriteLine(ex.Message);
|
||||
return 0;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 添加退房时间
|
||||
/// </summary>
|
||||
/// <param name="date"></param>
|
||||
/// <param name="hotel"></param>
|
||||
/// <param name="room"></param>
|
||||
/// <returns></returns>
|
||||
public static int reviseDate(string hotel, string room)
|
||||
{
|
||||
string sql = "";
|
||||
try
|
||||
{
|
||||
sql += string.Format("UPDATE CheckInInfo SET checkOutTime = SYSDATE() WHERE HotelCode={0} and Roomid={1} and checkOutTime='2000-01-01'", hotel, room);
|
||||
int sd = MysqlHelpers.ExecuteNonQuery(sql);
|
||||
return sd;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
LogHelper.WriteLine("添加退房时间报错"+sql+""+ex.Message);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// 添加退房时间
|
||||
/// </summary>
|
||||
/// <param name="date"></param>
|
||||
/// <param name="hotel"></param>
|
||||
/// <param name="room"></param>
|
||||
/// <returns></returns>
|
||||
public static int getmessage(int pmsid)
|
||||
{
|
||||
string sql = "";
|
||||
try
|
||||
{
|
||||
sql += $"select * from pmsInterface where pmsId={pmsid}";
|
||||
LogHelper.WriteLine(sql);
|
||||
DataTable ds = MysqlHelpers.ExecuteDataTable(sql);
|
||||
string hote = ds.Rows[0]["hotelid"].ToString();
|
||||
string room = ds.Rows[0]["room"].ToString();
|
||||
LogHelper.WriteLine("记录酒店id和房间id"+ hote+"::::"+ room);
|
||||
return reviseDate(hote, room);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
LogHelper.WriteLine("退房时间报错"+ sql +"信息"+ ex.Message);
|
||||
return 0;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 添加pms日志
|
||||
/// </summary>
|
||||
/// <param name="log"></param>
|
||||
/// <returns></returns>
|
||||
public static int addPmsLog(pmsLog log)
|
||||
{
|
||||
try
|
||||
{
|
||||
string sql = "insert into pmsLog (pmsid,step,app,Creationtime,message,Data) values (@pmsid,@step,@app,@Creationtime,@message,@Data)";
|
||||
MySqlParameter[] sqlParams = new MySqlParameter[6] {
|
||||
new MySqlParameter("@pmsid", log.pmsid),
|
||||
new MySqlParameter("@step",log.step),
|
||||
new MySqlParameter("@app", log.app),
|
||||
new MySqlParameter("@Creationtime",DateTime.Now),
|
||||
new MySqlParameter("@message",log.message),
|
||||
new MySqlParameter("@Data",log.Data)};
|
||||
return MysqlHelpers.ExecuteNonQuery(sql, sqlParams);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
LogHelper.WriteLine(ex.Message);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 添加ResendLog日志
|
||||
/// </summary>
|
||||
/// <param name="log"></param>
|
||||
/// <returns></returns>
|
||||
public static int addResendLog(ResendLog log)
|
||||
{
|
||||
try
|
||||
{
|
||||
string sql = "insert into ResendLog (pmsid,SerialNo,message,State) values (@pmsid,@SerialNo,@message,@State)";
|
||||
MySqlParameter[] sqlParams = new MySqlParameter[4] {
|
||||
new MySqlParameter("@pmsid", log.pmsid),
|
||||
new MySqlParameter("@SerialNo",log.SerialNo),
|
||||
new MySqlParameter("@message", log.message),
|
||||
new MySqlParameter("@State",log.State)};
|
||||
return MysqlHelpers.ExecuteNonQuery(sql, sqlParams);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
LogHelper.WriteLine(ex.Message);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// 查询未下发人脸机的pms数据
|
||||
/// </summary>
|
||||
public static List<ResendLog> GetResendLog()
|
||||
{
|
||||
List<ResendLog> Resend = new List<ResendLog>();
|
||||
string sql = string.Format("select* from ResendLog where State=1");
|
||||
MySqlDataReader dr = MysqlHelpers.ExecuteReader(sql);
|
||||
while (dr.Read())
|
||||
{
|
||||
ResendLog log = new ResendLog();
|
||||
log.message= dr["message"].ToString();
|
||||
log.ID= int.Parse(dr["ID"].ToString());
|
||||
log.message= dr["message"].ToString();
|
||||
log.pmsid= int.Parse(dr["pmsid"].ToString());
|
||||
log.SerialNo = dr["SerialNo"].ToString();
|
||||
log.State = int.Parse(dr["State"].ToString());
|
||||
Resend.Add(log);
|
||||
}
|
||||
return Resend;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 添加下发数据状态
|
||||
/// </summary>
|
||||
/// <param name="pmsid"></param>
|
||||
/// <param name="state"></param>
|
||||
public static int amendResendLog(int pmsid,int state)
|
||||
{
|
||||
try
|
||||
{
|
||||
string sql = string.Format("UPDATE ResendLog SET State ={0} WHERE pmsid = {1}", state, pmsid);
|
||||
LogHelper.WriteLine(sql);
|
||||
int sd = MysqlHelpers.ExecuteNonQuery(sql);
|
||||
return sd;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
LogHelper.WriteLine(ex.Message);
|
||||
return 0;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static int InsertFacedevicerxtxinfoLogBatch(List<facedevicerxtxinfo> logs)
|
||||
{
|
||||
List<String> allstatements = new List<String>();
|
||||
|
||||
string strInsertSql = "insert into facedevicerxtxinfo (pmsid,sn,msgid,cmd,data,datatime,direction,trresult,ipaddr,iplocation) values ";
|
||||
string strValSql = "";
|
||||
|
||||
StringBuilder finalSqlBuiler = new StringBuilder();
|
||||
foreach (var it in logs)
|
||||
{
|
||||
finalSqlBuiler.Append("(");
|
||||
finalSqlBuiler.Append(it.pmsid + ", ");
|
||||
finalSqlBuiler.Append("'" + it.sn + "', ");
|
||||
finalSqlBuiler.Append("'" + it.msgid + "', ");
|
||||
finalSqlBuiler.Append("'" + it.cmd + "', ");
|
||||
finalSqlBuiler.Append("'" + it.data + "', ");
|
||||
finalSqlBuiler.Append("'" + it.datatime + "', ");
|
||||
finalSqlBuiler.Append("'" + it.direction + "', ");
|
||||
finalSqlBuiler.Append(it.trresult + ", ");
|
||||
finalSqlBuiler.Append("'" + it.ipaddr + "', ");
|
||||
finalSqlBuiler.Append("'" + it.iplocation + "'");
|
||||
finalSqlBuiler.Append("), ");
|
||||
}
|
||||
strValSql = finalSqlBuiler.ToString();
|
||||
strValSql = strValSql.Substring(0, strValSql.Length - 2);
|
||||
|
||||
try
|
||||
{
|
||||
return MysqlHelpers.ExecuteNonQuery(strInsertSql + strValSql);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
LogHelper.WriteLine("批量添加数据到facedevicerxtxinfo异常:" + ex.Message);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
548
TestWebSocket/Entity.cs
Normal file
548
TestWebSocket/Entity.cs
Normal file
@@ -0,0 +1,548 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace WebSocketToolsConsole
|
||||
{
|
||||
public class Entity
|
||||
{
|
||||
public enum Factory
|
||||
{
|
||||
杭州锐颖 = 0,
|
||||
深圳实义德 = 1,
|
||||
深圳嘉禾兴 = 2
|
||||
}
|
||||
public class UiImg
|
||||
{
|
||||
public string name;
|
||||
public string image;
|
||||
public int x;
|
||||
public int y;
|
||||
public int w;
|
||||
public int h;
|
||||
}
|
||||
/// <summary>
|
||||
/// 实义德人脸机传输数据类型
|
||||
/// </summary>
|
||||
///
|
||||
public class Rootinfo
|
||||
{
|
||||
public int pmsid { get; set; }
|
||||
|
||||
public msgx msgx { get; set; }
|
||||
}
|
||||
public class cmdinfo
|
||||
{
|
||||
public string msgid { get; set; }
|
||||
|
||||
public string sn { get; set; }
|
||||
public string cmd { get; set; }
|
||||
public msgxinfo msg { get; set; }
|
||||
}
|
||||
public class msgxinfo
|
||||
{
|
||||
/// <summary>
|
||||
/// 消息ID
|
||||
/// </summary>
|
||||
public string status { get; set; }
|
||||
/// <summary>
|
||||
/// 终端序列号
|
||||
/// </summary>
|
||||
public string sn { get; set; }
|
||||
/// <summary>
|
||||
/// 消息类型: setPerson/removePerson、open/reboot(开门重启)
|
||||
/// </summary>
|
||||
public string msg { get; set; }
|
||||
/// <summary>
|
||||
/// pmsid
|
||||
/// </summary>
|
||||
/// <summary>
|
||||
/// 消息主体:Content-Type: application/x-www-formurlencoded
|
||||
/// </summary>
|
||||
public msginfo data { get; set; }
|
||||
}
|
||||
|
||||
public class msginfo
|
||||
{
|
||||
|
||||
public string cameraDetectType { get; set; }
|
||||
|
||||
public string faceFeaturePairNumber { get; set; }
|
||||
|
||||
public string faceFeaturePairSuccessOrFailWaitTime { get; set; }
|
||||
public string openDoorType { get; set; }
|
||||
|
||||
public string openDoorContinueTime { get; set; }
|
||||
|
||||
public string doorType { get; set; }
|
||||
public string APKVersion { get; set; }
|
||||
|
||||
public string sn { get; set; }
|
||||
|
||||
public string idCardFaceFeaturePairNumber { get; set; }
|
||||
|
||||
public string appWelcomeMsg { get; set; }
|
||||
|
||||
public string deviceSoundSize { get; set; }
|
||||
|
||||
public string deviceDefendTime { get; set; }
|
||||
public string deviceName { get; set; }
|
||||
|
||||
public string tipsPairFail { get; set; }
|
||||
|
||||
public string picQualityRate { get; set; }
|
||||
public string beginRecoDistance { get; set; }
|
||||
|
||||
public string pairSuccessOpenDoor { get; set; }
|
||||
|
||||
public string fillLightTimes { get; set; }
|
||||
public string lowPowerTimes { get; set; }
|
||||
|
||||
public string recognitionSwitch { get; set; }
|
||||
}
|
||||
public class pmsinterface
|
||||
{
|
||||
public int pmsId { get; set; }
|
||||
public DateTime DateTime { get; set; }
|
||||
public string pmsContent { get; set; }
|
||||
public int hotelid { get; set; }
|
||||
public int room { get; set; }
|
||||
public string faceSN { get; set; }
|
||||
public int issueresult { get; set; }
|
||||
public int pmstype { get; set; }
|
||||
public string messageid { get; set; }
|
||||
public string APKVersion { get; set; }
|
||||
|
||||
}
|
||||
public class msgx
|
||||
{
|
||||
/// <summary>
|
||||
/// 消息ID
|
||||
/// </summary>
|
||||
public string msgid { get; set; }
|
||||
/// <summary>
|
||||
/// 终端序列号
|
||||
/// </summary>
|
||||
public string sn { get; set; }
|
||||
/// <summary>
|
||||
/// 消息类型: setPerson/removePerson、open/reboot(开门重启)
|
||||
/// </summary>
|
||||
public string cmd { get; set; }
|
||||
/// <summary>
|
||||
/// pmsid
|
||||
/// </summary>
|
||||
/// <summary>
|
||||
/// 消息主体:Content-Type: application/x-www-formurlencoded
|
||||
/// </summary>
|
||||
public string msg { get; set; }
|
||||
}
|
||||
|
||||
|
||||
public class msgxs
|
||||
{
|
||||
/// <summary>
|
||||
/// 消息ID
|
||||
/// </summary>
|
||||
public string msgid { get; set; }
|
||||
|
||||
|
||||
public int pmsid { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 终端序列号
|
||||
/// </summary>
|
||||
public string sn { get; set; }
|
||||
/// <summary>
|
||||
/// 消息类型: setPerson/removePerson、open/reboot(开门重启)
|
||||
/// </summary>
|
||||
public string cmd { get; set; }
|
||||
/// <summary>
|
||||
/// pmsid
|
||||
/// </summary>
|
||||
/// <summary>
|
||||
/// 消息主体:Content-Type: application/x-www-formurlencoded
|
||||
/// </summary>
|
||||
public Msg msg { get; set; }
|
||||
|
||||
|
||||
}
|
||||
|
||||
public class Msg
|
||||
{
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public int status { get; set; }
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public string msg { get; set; }
|
||||
}
|
||||
/// <summary>
|
||||
/// pmsid
|
||||
/// </summary>
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 实义德人脸机返回结果
|
||||
/// </summary>
|
||||
public class msgx_response_msg
|
||||
{
|
||||
/// <summary>
|
||||
/// 状态码:0-成功,其他状态见状态码表
|
||||
/// </summary>
|
||||
public int status { get; set; }
|
||||
/// <summary>
|
||||
/// 状态描述:状态码的详细描述,比如:成功
|
||||
/// </summary>
|
||||
public string msg { get; set; }
|
||||
/// <summary>
|
||||
/// 返回数据:返回请求的数据,比如:请求人员列表,则data即为人员列表的json字符串
|
||||
/// </summary>
|
||||
public string data { get; set; }
|
||||
}
|
||||
/// <summary>
|
||||
/// 实义德人脸机过闸人员结构
|
||||
/// </summary>
|
||||
public class msgx_person
|
||||
{
|
||||
/// <summary>
|
||||
/// 秘钥:终端设备的秘钥
|
||||
/// </summary>
|
||||
public string key { get; set; }
|
||||
/// <summary>
|
||||
/// 人员ID:ID,验证人员唯一性的字段,必填
|
||||
/// </summary>
|
||||
public string id { get; set; }
|
||||
/// <summary>
|
||||
/// 人员的名字
|
||||
/// </summary>
|
||||
public string name { get; set; }
|
||||
/// <summary>
|
||||
/// 卡号:作为维根号发送到闸机
|
||||
/// </summary>
|
||||
public string IC_NO { get; set; }
|
||||
/// <summary>
|
||||
/// 身份证号
|
||||
/// </summary>
|
||||
public string ID_NO { get; set; }
|
||||
/// <summary>
|
||||
/// 照片:JPG头像照片要求宽高640x480像素,转为Base64字符串传输,JPG 分辨率最大支持1080x1080
|
||||
/// </summary>
|
||||
public string photo { get; set; }
|
||||
/// <summary>
|
||||
/// 最大过闸次数:一共可以过闸的最大次数[0,10000);当此值设置等于10000时,代表可以无限次过闸,默认:10000
|
||||
/// </summary>
|
||||
public long passCount { get; set; }
|
||||
/// <summary>
|
||||
/// 起始时间:此时间之后拥有过闸权限,单位:秒(传-1表示无限制),默认无限制
|
||||
/// </summary>
|
||||
public double startTs { get; set; }
|
||||
/// <summary>
|
||||
/// 截止时间:此时间之后无过闸权限,单位:秒(传-1表示无限制),默认无限制
|
||||
/// </summary>
|
||||
public double endTs { get; set; }
|
||||
/// <summary>
|
||||
/// 访客:true-是访客,false-非访客,默认false
|
||||
/// </summary>
|
||||
public bool visitor { get; set; }
|
||||
/// <summary>
|
||||
/// 以周为单位设置每 天不同的时间段:有权限过闸多个时间段,可以周为单位设置每 天不同的时间段,也可以设置每天相同的时间 段,不支持进行缺省设置(时间段格式: “09:00-12:35”,不同时间段间用“;”分割)
|
||||
/// </summary>
|
||||
public string weekly { get; set; }
|
||||
}
|
||||
/// <summary>
|
||||
/// 人员添加
|
||||
/// </summary>
|
||||
public class SavePersonRequest
|
||||
{
|
||||
/// <summary>
|
||||
/// ID编号:回复id编号;成对出现,用来关联平台的发送和设备的回复
|
||||
/// </summary>
|
||||
public int id { get; set; }
|
||||
/// <summary>
|
||||
/// 方法:personnelData.savePersons
|
||||
/// </summary>
|
||||
public string method { get; set; }
|
||||
/// <summary>
|
||||
/// 人员信息列表
|
||||
/// </summary>
|
||||
public List<Params> @params { get; set; }
|
||||
}
|
||||
/// <summary>
|
||||
/// 人员信息列表
|
||||
/// </summary>
|
||||
public class Params
|
||||
{
|
||||
/// <summary>
|
||||
/// 人员信息
|
||||
/// </summary>
|
||||
public Person Person { get; set; }
|
||||
}
|
||||
/// <summary>
|
||||
/// 人员信息
|
||||
/// </summary>
|
||||
public class Person
|
||||
{
|
||||
/// <summary>
|
||||
/// 人员类型,1-内部员工,2-访客, 3-黑名单;必填
|
||||
/// </summary>
|
||||
public int Type { get; set; }
|
||||
/// <summary>
|
||||
/// 证件号,与CertificateType组合构成全局唯一人员标识,不允许更新,避免前端和平台端不一致。必填
|
||||
/// </summary>
|
||||
public string Code { get; set; }
|
||||
/// <summary>
|
||||
/// 默认权限组。必填
|
||||
/// </summary>
|
||||
public string GroupName { get; set; }
|
||||
/// <summary>
|
||||
/// 姓名必填
|
||||
/// </summary>
|
||||
public string Name { get; set; }
|
||||
/// <summary>
|
||||
/// 性别必填
|
||||
/// </summary>
|
||||
public string Sex { get; set; }
|
||||
/// <summary>
|
||||
/// 出生日期必填
|
||||
/// </summary>
|
||||
public string Birthday { get; set; }
|
||||
/// <summary>
|
||||
/// 访客信息,人员类型是访客时有效(非访客不填)
|
||||
/// </summary>
|
||||
public GuestInfo GuestInfo { get; set; }
|
||||
/// <summary>
|
||||
/// 通过HTTP协议下载图片的地址;只支持JPG格式;
|
||||
/// </summary>
|
||||
public string URL { get; set; }
|
||||
/// <summary>
|
||||
/// Base64编码的图片数据,与URL字段互斥; base64数据不用带上格式信息如【data:image/jpg;base64,】
|
||||
/// </summary>
|
||||
public string Images { get; set; }
|
||||
/// <summary>
|
||||
/// 卡信息
|
||||
/// </summary>
|
||||
public Cards Cards { get; set; }
|
||||
}
|
||||
/// <summary>
|
||||
/// 访客信息,人员类型是访客时有效(非访客不填)
|
||||
/// </summary>
|
||||
public class GuestInfo
|
||||
{
|
||||
/// <summary>
|
||||
/// 单位
|
||||
/// </summary>
|
||||
public string Corp { get; set; }
|
||||
/// <summary>
|
||||
/// 电话
|
||||
/// </summary>
|
||||
public string Phone { get; set; }
|
||||
/// <summary>
|
||||
/// 车牌号码
|
||||
/// </summary>
|
||||
public string CarLicense { get; set; }
|
||||
/// <summary>
|
||||
/// 随行人数
|
||||
/// </summary>
|
||||
public int Partner { get; set; }
|
||||
/// <summary>
|
||||
/// 被访人
|
||||
/// </summary>
|
||||
public string Host { get; set; }
|
||||
/// <summary>
|
||||
/// 准入时间
|
||||
/// </summary>
|
||||
public AccessTime AccessTime { get; set; }
|
||||
}
|
||||
/// <summary>
|
||||
/// 准入时间
|
||||
/// </summary>
|
||||
public class AccessTime
|
||||
{
|
||||
/// <summary>
|
||||
/// 开始时间
|
||||
/// </summary>
|
||||
public string from { get; set; }
|
||||
/// <summary>
|
||||
/// 结束时间
|
||||
/// </summary>
|
||||
public string to { get; set; }
|
||||
}
|
||||
/// <summary>
|
||||
/// 卡信息
|
||||
/// </summary>
|
||||
public class Cards
|
||||
{
|
||||
/// <summary>
|
||||
/// 卡号
|
||||
/// </summary>
|
||||
public string ID { get; set; }
|
||||
/// <summary>
|
||||
/// 卡类型:1普通卡,2胁迫卡
|
||||
/// </summary>
|
||||
public int Type { get; set; }
|
||||
/// <summary>
|
||||
/// 有效期日期:开始日期yyyy-MM-dd,结束日期yyyy-MM-dd
|
||||
/// </summary>
|
||||
public string[] Validity { get; set; }
|
||||
/// <summary>
|
||||
/// 有效期时间(默认:00:00:00,23:59:59):开始时间HH:mm:ss,结束时间HH:mm:ss
|
||||
/// </summary>
|
||||
public string[] ValidityTime { get; set; }
|
||||
public Memo Memo { get; set; }
|
||||
}
|
||||
/// <summary>
|
||||
/// optional其他信息
|
||||
/// </summary>
|
||||
public class Memo
|
||||
{
|
||||
/// <summary>
|
||||
/// 门禁位置
|
||||
/// </summary>
|
||||
public string Entrance { get; set; }
|
||||
}
|
||||
/// <summary>
|
||||
/// 人员添加设备回应
|
||||
/// </summary>
|
||||
public class Response
|
||||
{
|
||||
/// <summary>
|
||||
/// ID编号:回复id编号;成对出现,用来关联平台的发送和设备的回复
|
||||
/// </summary>
|
||||
public int id { get; set; }
|
||||
/// <summary>
|
||||
/// 方法:personnelData.savePersons,removePersons
|
||||
/// </summary>
|
||||
public string method { get; set; }
|
||||
/// <summary>
|
||||
/// 返回结果
|
||||
/// </summary>
|
||||
public bool result { get; set; }
|
||||
/// <summary>
|
||||
/// 人员信息列表
|
||||
/// </summary>
|
||||
public List<ParamsResponse> @params { get; set; }
|
||||
}
|
||||
/// <summary>
|
||||
/// 响应人员信息
|
||||
/// </summary>
|
||||
public class ParamsResponse
|
||||
{
|
||||
/// <summary>
|
||||
/// 人员类型,1-内部员工,2-访客, 3-黑名单
|
||||
/// </summary>
|
||||
//public string CertificateType { get; set; }
|
||||
/// <summary>
|
||||
/// 证件号,与CertificateType组合构成全局唯一人员标识,不允许更新,避免前端和平台端不一致
|
||||
/// </summary>
|
||||
public string Code { get; set; }
|
||||
/// <summary>
|
||||
/// 当前人员是否添加成功,失败有错误码和错误信息
|
||||
/// </summary>
|
||||
public bool Result { get; set; }
|
||||
/// <summary>
|
||||
/// 错误码
|
||||
/// </summary>
|
||||
public int ErrorCode { get; set; }
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
//public string[] ErrorCodePic { get; set; }
|
||||
/// <summary>
|
||||
/// 错误信息
|
||||
/// </summary>
|
||||
//public string ErrorMessage { get; set; }
|
||||
}
|
||||
/// <summary>
|
||||
/// 人员删除
|
||||
/// </summary>
|
||||
public class RemovePersonRequest
|
||||
{
|
||||
/// <summary>
|
||||
/// ID编号:回复id编号;成对出现,用来关联平台的发送和设备的回复
|
||||
/// </summary>
|
||||
public int id { get; set; }
|
||||
/// <summary>
|
||||
/// 方法:personnelData.removePersons
|
||||
/// </summary>
|
||||
public string method { get; set; }
|
||||
/// <summary>
|
||||
/// 人员信息列表
|
||||
/// </summary>
|
||||
public List<RemoveParams> @params { get; set; }
|
||||
}
|
||||
/// <summary>
|
||||
/// 人员信息列表
|
||||
/// </summary>
|
||||
public class RemoveParams
|
||||
{
|
||||
public string Code { get; set; }
|
||||
}
|
||||
/// <summary>
|
||||
/// 人员删除设备回应
|
||||
/// </summary>
|
||||
//public class RemovePersonResponse
|
||||
//{
|
||||
// /// <summary>
|
||||
// /// ID编号:回复id编号;成对出现,用来关联平台的发送和设备的回复
|
||||
// /// </summary>
|
||||
// public int id { get; set; }
|
||||
// /// <summary>
|
||||
// /// 方法:personnelData.removePersons
|
||||
// /// </summary>
|
||||
// public string method { get; set; }
|
||||
// /// <summary>
|
||||
// /// 返回结果
|
||||
// /// </summary>
|
||||
// public bool result { get; set; }
|
||||
// /// <summary>
|
||||
// /// 人员信息列表
|
||||
// /// </summary>
|
||||
// public List<Response> @params { get; set; }
|
||||
//}
|
||||
/// <summary>
|
||||
/// 响应人员信息
|
||||
/// </summary>
|
||||
//public class RemoveParamsResponse
|
||||
//{
|
||||
// /// <summary>
|
||||
// /// 证件号,与CertificateType组合构成全局唯一人员标识,不允许更新,避免前端和平台端不一致
|
||||
// /// </summary>
|
||||
// public string Code { get; set; }
|
||||
// /// <summary>
|
||||
// /// 当前人员是否添加成功,失败有错误码和错误信息
|
||||
// /// </summary>
|
||||
// public bool Result { get; set; }
|
||||
// /// <summary>
|
||||
// /// 错误码
|
||||
// /// </summary>
|
||||
// public int ErrorCode { get; set; }
|
||||
//}
|
||||
|
||||
public class Json
|
||||
{
|
||||
public int status { get; set; }
|
||||
public string msg { get; set; }
|
||||
public Data data { get; set; } = new Data();
|
||||
}
|
||||
public class Data
|
||||
{
|
||||
public int total_number { get; set; }
|
||||
public int offset { get; set; }
|
||||
public int person_number { get; set; }
|
||||
public List<User> person { get; set; } = new List<User>();
|
||||
}
|
||||
public class User
|
||||
{
|
||||
public string id { get; set; }
|
||||
public int passCount { get; set; }
|
||||
public string startTs { get; set; }
|
||||
public string endTs { get; set; }
|
||||
public string name { get; set; }
|
||||
public string ID_NO { get; set; }
|
||||
public string IC_NO { get; set; }
|
||||
}
|
||||
}
|
||||
}
|
||||
22
TestWebSocket/FaceIssue.cs
Normal file
22
TestWebSocket/FaceIssue.cs
Normal file
@@ -0,0 +1,22 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace TestWebSocket
|
||||
{
|
||||
public class FaceIssue
|
||||
{
|
||||
public int id { get; set; }
|
||||
public string faceSn { get; set; }
|
||||
public System.DateTime creationtime { get; set; }
|
||||
public string pmsid { get; set; }
|
||||
public string picture { get; set; }
|
||||
public int issuestate { get; set; }
|
||||
public string messageid { get; set; }
|
||||
public string APKVersion { get; set; }
|
||||
public string Factory { get; set; }
|
||||
|
||||
}
|
||||
}
|
||||
15
TestWebSocket/FaceMessage.cs
Normal file
15
TestWebSocket/FaceMessage.cs
Normal file
@@ -0,0 +1,15 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace TestWebSocket
|
||||
{
|
||||
public class FaceMessage
|
||||
{
|
||||
public string status { get; set; }
|
||||
public string msg { get; set; }
|
||||
public object data { get; set; }
|
||||
}
|
||||
}
|
||||
108
TestWebSocket/FaceReturuinfo.cs
Normal file
108
TestWebSocket/FaceReturuinfo.cs
Normal file
@@ -0,0 +1,108 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Web.UI.WebControls.WebParts;
|
||||
|
||||
namespace TestWebSocket
|
||||
{
|
||||
public class FaceReturuinfo
|
||||
{
|
||||
public string msgid { get; set; }
|
||||
public string sn { get; set; }
|
||||
public string cmd { get; set; }
|
||||
public magsinfo msg { get; set; }
|
||||
}
|
||||
public class magsinfo
|
||||
{
|
||||
public int status { get; set; }
|
||||
public string msg { get; set; }
|
||||
}
|
||||
public class Faceinfo
|
||||
{
|
||||
public string msgid { get; set; }
|
||||
public string sn { get; set; }
|
||||
public string cmd { get; set; }
|
||||
public msginfo msg { get; set; }
|
||||
}
|
||||
|
||||
public class msginfo
|
||||
{
|
||||
|
||||
public string Token { get; set; }
|
||||
public string ProtocolVersion { get; set; }
|
||||
public string DateTime { get; set; }
|
||||
public string Brand { get; set; }
|
||||
public Paranames Para { get; set; }
|
||||
public string HwVer { get; set; }
|
||||
public string AppVer { get; set; }
|
||||
public string CMD { get; set; }
|
||||
}
|
||||
public class Paranames
|
||||
{
|
||||
public int ErrCode { get; set; }
|
||||
public string ErrMsg { get; set; }
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public class Faceinfos<T>
|
||||
{
|
||||
public string msgid { get; set; }
|
||||
public string sn { get; set; }
|
||||
public string cmd { get; set; }
|
||||
public msginfos<T> msg { get; set; }
|
||||
}
|
||||
|
||||
public class msginfos<T>
|
||||
{
|
||||
|
||||
public string Token { get; set; }
|
||||
public string ProtocolVersion { get; set; }
|
||||
public string DateTime { get; set; }
|
||||
public string Brand { get; set; }
|
||||
public List<T> Para { get; set; }
|
||||
public string HwVer { get; set; }
|
||||
public string AppVer { get; set; }
|
||||
public string CMD { get; set; }
|
||||
}
|
||||
|
||||
//public class Paranames
|
||||
//{
|
||||
// public int ErrCode { get; set; }
|
||||
// public string ErrMsg { get; set; }
|
||||
//}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
//"Token":"Boonlive JSON command system",
|
||||
//"ProtocolVersion":"2.1",
|
||||
//"DateTime":"2024-04-17 16:05:36",
|
||||
//"Brand":"yh",
|
||||
//"CMD":"RestoreFactorySetting",
|
||||
//"HwVer":"1.4.3",
|
||||
//"AppVer":"1.5.1",
|
||||
//"Para":
|
||||
//{
|
||||
// "ErrCode":0,
|
||||
//"ErrMsg":"OK"
|
||||
//}
|
||||
51
TestWebSocket/InfoBody.cs
Normal file
51
TestWebSocket/InfoBody.cs
Normal file
@@ -0,0 +1,51 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Web;
|
||||
|
||||
namespace Face.Web.Areas.App.Models
|
||||
{
|
||||
public class InfoBody
|
||||
{
|
||||
/// <summary>
|
||||
/// //ID,验证人员唯一性的字段
|
||||
/// </summary>
|
||||
public string id { get; set; }
|
||||
/// <summary>
|
||||
/// //人员的名字
|
||||
/// </summary>
|
||||
public string name { get; set; }
|
||||
/// <summary>
|
||||
/// //作为维根号发送到闸机
|
||||
/// </summary>
|
||||
public string ic_no { get; set; }
|
||||
/// <summary>
|
||||
/// //员工身份证号
|
||||
/// </summary>
|
||||
public string id_no { get; set; }
|
||||
/// <summary>
|
||||
/// //JPG头像照片要求宽高640x480像素,转为Base64字符串传输,最大支持1080x1080
|
||||
/// </summary>
|
||||
public string photo { get; set; }
|
||||
/// <summary>
|
||||
/// 起始时间
|
||||
/// </summary>
|
||||
public string startTs { get; set; }
|
||||
/// <summary>
|
||||
/// 截止时间
|
||||
/// </summary>
|
||||
public string endTs { get; set; }
|
||||
/// <summary>
|
||||
/// //在有效时间戳内,最大过闸次数。当此值设置等于10000时,代表可以无限次过闸,默认:10000
|
||||
/// </summary>
|
||||
public string passCount { get; set; }
|
||||
/// <summary>
|
||||
/// //true-是访客,false-非访客,默认false;兼容以前协议
|
||||
/// </summary>
|
||||
public string visitor { get; set; }
|
||||
/// <summary>
|
||||
/// 以周为单位设置每 天不同的时间段
|
||||
/// </summary>
|
||||
public string weekly { get; set; }
|
||||
}
|
||||
}
|
||||
112
TestWebSocket/LogHelper.cs
Normal file
112
TestWebSocket/LogHelper.cs
Normal file
@@ -0,0 +1,112 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace TestWebSocket
|
||||
{
|
||||
public class LogHelper
|
||||
{
|
||||
/// <summary>
|
||||
/// 日志帮助类
|
||||
/// </summary>
|
||||
|
||||
static string LogFile = "";
|
||||
/// <summary>
|
||||
/// 在Logs文件夹(不存在则自动创建)下创建一个日志文件
|
||||
/// </summary>
|
||||
/// <param name="FileName"></param>
|
||||
public static void Init()
|
||||
{
|
||||
string directory = AppDomain.CurrentDomain.BaseDirectory + "\\Logs";
|
||||
if (!Directory.Exists(directory))
|
||||
{
|
||||
Directory.CreateDirectory(directory);
|
||||
}
|
||||
|
||||
string day2 = "";
|
||||
string day3 = "";
|
||||
string day4 = "";
|
||||
string day5 = "";
|
||||
string day6 = "";
|
||||
string day7 = "";
|
||||
|
||||
DateTime curTime = DateTime.Now;
|
||||
|
||||
LogFile = directory + "\\" + curTime.ToString("yyyy-MM-dd") + ".txt";
|
||||
if (!File.Exists(LogFile))
|
||||
{
|
||||
day2 = directory + "\\" + curTime.AddDays(1).ToString("yyyy-MM-dd") + ".txt";
|
||||
day3 = directory + "\\" + curTime.AddDays(2).ToString("yyyy-MM-dd") + ".txt";
|
||||
day4 = directory + "\\" + curTime.AddDays(3).ToString("yyyy-MM-dd") + ".txt";
|
||||
day5 = directory + "\\" + curTime.AddDays(4).ToString("yyyy-MM-dd") + ".txt";
|
||||
day6 = directory + "\\" + curTime.AddDays(5).ToString("yyyy-MM-dd") + ".txt";
|
||||
day7 = directory + "\\" + curTime.AddDays(6).ToString("yyyy-MM-dd") + ".txt";
|
||||
|
||||
FileStream fs = File.Create(LogFile);
|
||||
fs.Close();
|
||||
|
||||
FileStream fs2 = File.Create(day2);
|
||||
FileStream fs3 = File.Create(day3);
|
||||
FileStream fs4 = File.Create(day4);
|
||||
FileStream fs5 = File.Create(day5);
|
||||
FileStream fs6 = File.Create(day6);
|
||||
FileStream fs7 = File.Create(day7);
|
||||
fs2.Close();
|
||||
fs3.Close();
|
||||
fs4.Close();
|
||||
fs5.Close();
|
||||
fs6.Close();
|
||||
fs7.Close();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 追加一条信息
|
||||
/// </summary>
|
||||
/// <param name="text"></param>
|
||||
public static void Write(string text)
|
||||
{
|
||||
lock (LogFile)
|
||||
{
|
||||
Init();
|
||||
using (StreamWriter sw = new StreamWriter(LogFile, true, Encoding.UTF8))
|
||||
{
|
||||
sw.Write(DateTime.Now.ToString("[yyyy-MM-dd HH:mm:ss] ") + text);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
public static void Writeinfo(string text)
|
||||
{
|
||||
lock (LogFile)
|
||||
{
|
||||
Init();
|
||||
using (StreamWriter sw = new StreamWriter(LogFile, true, Encoding.UTF8))
|
||||
{
|
||||
sw.Write(DateTime.Now.ToString("测试数据") + text);
|
||||
}
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// 追加一行信息
|
||||
/// </summary>
|
||||
/// <param name="text"></param>
|
||||
public static void WriteLine(string text)
|
||||
{
|
||||
lock (LogFile)
|
||||
{
|
||||
Init();
|
||||
text += "\r\n";
|
||||
using (StreamWriter sw = new StreamWriter(LogFile, true, Encoding.UTF8))
|
||||
{
|
||||
sw.Write(DateTime.Now.ToString("[yyyy-MM-dd HH:mm:ss] ") + text);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
354
TestWebSocket/MysqlHelpers.cs
Normal file
354
TestWebSocket/MysqlHelpers.cs
Normal file
@@ -0,0 +1,354 @@
|
||||
using MySql.Data.MySqlClient;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace TestWebSocket
|
||||
{
|
||||
public class MysqlHelpers
|
||||
{
|
||||
public static readonly string connectionString = "Server=blv-cloud-db.mysql.rds.aliyuncs.com;Database=face;Uid=blv_rcu;Pwd=fnadiaJDIJ7546;charset=utf8;port=3307;";
|
||||
|
||||
public MysqlHelpers() { }
|
||||
#region ExecuteNonQuery
|
||||
//执行SQL语句,返回影响的记录数
|
||||
/// <summary>
|
||||
/// 执行SQL语句,返回影响的记录数
|
||||
/// </summary>
|
||||
/// <param name="SQLString">SQL语句</param>
|
||||
/// <returns>影响的记录数</returns>
|
||||
public static int ExecuteNonQuery(string SQLString)
|
||||
{
|
||||
using (MySqlConnection connection = new MySqlConnection(connectionString))
|
||||
{
|
||||
using (MySqlCommand cmd = new MySqlCommand(SQLString, connection))
|
||||
{
|
||||
try
|
||||
{
|
||||
connection.Open();
|
||||
int rows = cmd.ExecuteNonQuery();
|
||||
return rows;
|
||||
}
|
||||
catch (MySql.Data.MySqlClient.MySqlException e)
|
||||
{
|
||||
connection.Close();
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// 执行SQL语句,返回影响的记录数
|
||||
/// </summary>
|
||||
/// <param name="SQLString">SQL语句</param>
|
||||
/// <returns>影响的记录数</returns>
|
||||
public static int ExecuteNonQuery(string SQLString, params MySqlParameter[] cmdParms)
|
||||
{
|
||||
using (MySqlConnection connection = new MySqlConnection(connectionString))
|
||||
{
|
||||
using (MySqlCommand cmd = new MySqlCommand())
|
||||
{
|
||||
try
|
||||
{
|
||||
PrepareCommand(cmd, connection, null, SQLString, cmdParms);
|
||||
int rows = cmd.ExecuteNonQuery();
|
||||
cmd.Parameters.Clear();
|
||||
return rows;
|
||||
}
|
||||
catch (MySql.Data.MySqlClient.MySqlException e)
|
||||
{
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
//执行多条SQL语句,实现数据库事务。
|
||||
/// <summary>
|
||||
/// 执行多条SQL语句,实现数据库事务。
|
||||
/// </summary>
|
||||
/// <param name="SQLStringList">多条SQL语句</param>
|
||||
public static bool ExecuteNoQueryTran(List<String> SQLStringList)
|
||||
{
|
||||
using (MySqlConnection conn = new MySqlConnection(connectionString))
|
||||
{
|
||||
conn.Open();
|
||||
MySqlCommand cmd = new MySqlCommand();
|
||||
cmd.Connection = conn;
|
||||
MySqlTransaction tx = conn.BeginTransaction();
|
||||
cmd.Transaction = tx;
|
||||
try
|
||||
{
|
||||
for (int n = 0; n < SQLStringList.Count; n++)
|
||||
{
|
||||
string strsql = SQLStringList[n];
|
||||
if (strsql.Trim().Length > 1)
|
||||
{
|
||||
cmd.CommandText = strsql;
|
||||
PrepareCommand(cmd, conn, tx, strsql, null);
|
||||
cmd.ExecuteNonQuery();
|
||||
}
|
||||
}
|
||||
cmd.ExecuteNonQuery();
|
||||
tx.Commit();
|
||||
return true;
|
||||
}
|
||||
catch
|
||||
{
|
||||
tx.Rollback();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
#region ExecuteScalar
|
||||
/// <summary>
|
||||
/// 执行一条计算查询结果语句,返回查询结果(object)。
|
||||
/// </summary>
|
||||
/// <param name="SQLString">计算查询结果语句</param>
|
||||
/// <returns>查询结果(object)</returns>
|
||||
public static object ExecuteScalar(string SQLString)
|
||||
{
|
||||
using (MySqlConnection connection = new MySqlConnection(connectionString))
|
||||
{
|
||||
using (MySqlCommand cmd = new MySqlCommand(SQLString, connection))
|
||||
{
|
||||
try
|
||||
{
|
||||
connection.Open();
|
||||
object obj = cmd.ExecuteScalar();
|
||||
if ((Object.Equals(obj, null)) || (Object.Equals(obj, System.DBNull.Value)))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
else
|
||||
{
|
||||
return obj;
|
||||
}
|
||||
}
|
||||
catch (MySql.Data.MySqlClient.MySqlException e)
|
||||
{
|
||||
connection.Close();
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// 执行一条计算查询结果语句,返回查询结果(object)。
|
||||
/// </summary>
|
||||
/// <param name="SQLString">计算查询结果语句</param>
|
||||
/// <returns>查询结果(object)</returns>
|
||||
public static object ExecuteScalar(string SQLString, params MySqlParameter[] cmdParms)
|
||||
{
|
||||
using (MySqlConnection connection = new MySqlConnection(connectionString))
|
||||
{
|
||||
using (MySqlCommand cmd = new MySqlCommand())
|
||||
{
|
||||
try
|
||||
{
|
||||
PrepareCommand(cmd, connection, null, SQLString, cmdParms);
|
||||
object obj = cmd.ExecuteScalar();
|
||||
cmd.Parameters.Clear();
|
||||
if ((Object.Equals(obj, null)) || (Object.Equals(obj, System.DBNull.Value)))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
else
|
||||
{
|
||||
return obj;
|
||||
}
|
||||
}
|
||||
catch (MySql.Data.MySqlClient.MySqlException e)
|
||||
{
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
#region ExecuteReader
|
||||
/// <summary>
|
||||
/// 执行查询语句,返回MySqlDataReader ( 注意:调用该方法后,一定要对MySqlDataReader进行Close )
|
||||
/// </summary>
|
||||
/// <param name="strSQL">查询语句</param>
|
||||
/// <returns>MySqlDataReader</returns>
|
||||
public static MySqlDataReader ExecuteReader(string strSQL)
|
||||
{
|
||||
MySqlConnection connection = new MySqlConnection(connectionString);
|
||||
MySqlCommand cmd = new MySqlCommand(strSQL, connection);
|
||||
try
|
||||
{
|
||||
connection.Open();
|
||||
MySqlDataReader myReader = cmd.ExecuteReader(CommandBehavior.CloseConnection);
|
||||
return myReader;
|
||||
}
|
||||
catch (MySql.Data.MySqlClient.MySqlException e)
|
||||
{
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// 执行查询语句,返回MySqlDataReader ( 注意:调用该方法后,一定要对MySqlDataReader进行Close )
|
||||
/// </summary>
|
||||
/// <param name="strSQL">查询语句</param>
|
||||
/// <returns>MySqlDataReader</returns>
|
||||
public static MySqlDataReader ExecuteReader(string SQLString, params MySqlParameter[] cmdParms)
|
||||
{
|
||||
MySqlConnection connection = new MySqlConnection(connectionString);
|
||||
MySqlCommand cmd = new MySqlCommand();
|
||||
try
|
||||
{
|
||||
PrepareCommand(cmd, connection, null, SQLString, cmdParms);
|
||||
MySqlDataReader myReader = cmd.ExecuteReader(CommandBehavior.CloseConnection);
|
||||
cmd.Parameters.Clear();
|
||||
return myReader;
|
||||
}
|
||||
catch (MySql.Data.MySqlClient.MySqlException e)
|
||||
{
|
||||
throw e;
|
||||
}
|
||||
// finally
|
||||
// {
|
||||
// cmd.Dispose();
|
||||
// connection.Close();
|
||||
// }
|
||||
}
|
||||
#endregion
|
||||
#region ExecuteDataTable
|
||||
/// <summary>
|
||||
/// 执行查询语句,返回DataTable
|
||||
/// </summary>
|
||||
/// <param name="SQLString">查询语句</param>
|
||||
/// <returns>DataTable</returns>
|
||||
public static DataTable ExecuteDataTable(string SQLString)
|
||||
{
|
||||
using (MySqlConnection connection = new MySqlConnection(connectionString))
|
||||
{
|
||||
DataSet ds = new DataSet();
|
||||
try
|
||||
{
|
||||
connection.Open();
|
||||
MySqlDataAdapter command = new MySqlDataAdapter(SQLString, connection);
|
||||
command.Fill(ds, "ds");
|
||||
}
|
||||
catch (MySql.Data.MySqlClient.MySqlException ex)
|
||||
{
|
||||
throw new Exception(ex.Message);
|
||||
}
|
||||
return ds.Tables[0];
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// 执行查询语句,返回DataSet
|
||||
/// </summary>
|
||||
/// <param name="SQLString">查询语句</param>
|
||||
/// <returns>DataTable</returns>
|
||||
public static DataTable ExecuteDataTable(string SQLString, params MySqlParameter[] cmdParms)
|
||||
{
|
||||
using (MySqlConnection connection = new MySqlConnection(connectionString))
|
||||
{
|
||||
MySqlCommand cmd = new MySqlCommand();
|
||||
PrepareCommand(cmd, connection, null, SQLString, cmdParms);
|
||||
using (MySqlDataAdapter da = new MySqlDataAdapter(cmd))
|
||||
{
|
||||
DataSet ds = new DataSet();
|
||||
try
|
||||
{
|
||||
da.Fill(ds, "ds");
|
||||
cmd.Parameters.Clear();
|
||||
}
|
||||
catch (MySql.Data.MySqlClient.MySqlException ex)
|
||||
{
|
||||
throw new Exception(ex.Message);
|
||||
}
|
||||
return ds.Tables[0];
|
||||
}
|
||||
}
|
||||
}
|
||||
//获取起始页码和结束页码
|
||||
public static DataTable ExecuteDataTable(string cmdText, int startResord, int maxRecord)
|
||||
{
|
||||
using (MySqlConnection connection = new MySqlConnection(connectionString))
|
||||
{
|
||||
DataSet ds = new DataSet();
|
||||
try
|
||||
{
|
||||
connection.Open();
|
||||
MySqlDataAdapter command = new MySqlDataAdapter(cmdText, connection);
|
||||
command.Fill(ds, startResord, maxRecord, "ds");
|
||||
}
|
||||
catch (MySql.Data.MySqlClient.MySqlException ex)
|
||||
{
|
||||
throw new Exception(ex.Message);
|
||||
}
|
||||
return ds.Tables[0];
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
/// <summary>
|
||||
/// 获取分页数据 在不用存储过程情况下
|
||||
/// </summary>
|
||||
/// <param name="recordCount">总记录条数</param>
|
||||
/// <param name="selectList">选择的列逗号隔开,支持top num</param>
|
||||
/// <param name="tableName">表名字</param>
|
||||
/// <param name="whereStr">条件字符 必须前加 and</param>
|
||||
/// <param name="orderExpression">排序 例如 ID</param>
|
||||
/// <param name="pageIdex">当前索引页</param>
|
||||
/// <param name="pageSize">每页记录数</param>
|
||||
/// <returns></returns>
|
||||
public static DataTable getPager(out int recordCount, string selectList, string tableName, string whereStr, string orderExpression, int pageIdex, int pageSize)
|
||||
{
|
||||
int rows = 0;
|
||||
DataTable dt = new DataTable();
|
||||
MatchCollection matchs = Regex.Matches(selectList, @"top\s+\d{1,}", RegexOptions.IgnoreCase);//含有top
|
||||
string sqlStr = sqlStr = string.Format("select {0} from {1} where 1=1 {2}", selectList, tableName, whereStr);
|
||||
if (!string.IsNullOrEmpty(orderExpression)) { sqlStr += string.Format(" Order by {0}", orderExpression); }
|
||||
if (matchs.Count > 0) //含有top的时候
|
||||
{
|
||||
DataTable dtTemp = ExecuteDataTable(sqlStr);
|
||||
rows = dtTemp.Rows.Count;
|
||||
}
|
||||
else //不含有top的时候
|
||||
{
|
||||
string sqlCount = string.Format("select count(*) from {0} where 1=1 {1} ", tableName, whereStr);
|
||||
//获取行数
|
||||
object obj = ExecuteScalar(sqlCount);
|
||||
if (obj != null)
|
||||
{
|
||||
rows = Convert.ToInt32(obj);
|
||||
}
|
||||
}
|
||||
dt = ExecuteDataTable(sqlStr, (pageIdex - 1) * pageSize, pageSize);
|
||||
recordCount = rows;
|
||||
return dt;
|
||||
}
|
||||
#region 创建command
|
||||
private static void PrepareCommand(MySqlCommand cmd, MySqlConnection conn, MySqlTransaction trans, string cmdText, MySqlParameter[] cmdParms)
|
||||
{
|
||||
if (conn.State != ConnectionState.Open)
|
||||
conn.Open();
|
||||
cmd.Connection = conn;
|
||||
cmd.CommandText = cmdText;
|
||||
if (trans != null)
|
||||
cmd.Transaction = trans;
|
||||
cmd.CommandType = CommandType.Text;//cmdType;
|
||||
if (cmdParms != null)
|
||||
{
|
||||
foreach (MySqlParameter parameter in cmdParms)
|
||||
{
|
||||
if ((parameter.Direction == ParameterDirection.InputOutput || parameter.Direction == ParameterDirection.Input) &&
|
||||
(parameter.Value == null))
|
||||
{
|
||||
parameter.Value = DBNull.Value;
|
||||
}
|
||||
cmd.Parameters.Add(parameter);
|
||||
}
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
2291
TestWebSocket/Program.cs
Normal file
2291
TestWebSocket/Program.cs
Normal file
File diff suppressed because it is too large
Load Diff
36
TestWebSocket/Properties/AssemblyInfo.cs
Normal file
36
TestWebSocket/Properties/AssemblyInfo.cs
Normal file
@@ -0,0 +1,36 @@
|
||||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// 有关程序集的一般信息由以下
|
||||
// 控制。更改这些特性值可修改
|
||||
// 与程序集关联的信息。
|
||||
[assembly: AssemblyTitle("TestWebSocket")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("TestWebSocket")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2021")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
// 将 ComVisible 设置为 false 会使此程序集中的类型
|
||||
//对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型
|
||||
//请将此类型的 ComVisible 特性设置为 true。
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
// 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID
|
||||
[assembly: Guid("3b29da63-7818-4c39-969a-19cb471b3cc9")]
|
||||
|
||||
// 程序集的版本信息由下列四个值组成:
|
||||
//
|
||||
// 主版本
|
||||
// 次版本
|
||||
// 生成号
|
||||
// 修订号
|
||||
//
|
||||
// 可以指定所有值,也可以使用以下所示的 "*" 预置版本号和修订号
|
||||
// 方法是按如下所示使用“*”: :
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("1.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
||||
25
TestWebSocket/ResendLog.cs
Normal file
25
TestWebSocket/ResendLog.cs
Normal file
@@ -0,0 +1,25 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace TestWebSocket
|
||||
{
|
||||
public class ResendLog
|
||||
{
|
||||
public int ID { get; set; }
|
||||
|
||||
public int pmsid { get; set; }
|
||||
|
||||
|
||||
public string SerialNo { get; set;}
|
||||
|
||||
|
||||
public string message { get; set;}
|
||||
|
||||
|
||||
public int State { get; set;}
|
||||
|
||||
}
|
||||
}
|
||||
76
TestWebSocket/Root.cs
Normal file
76
TestWebSocket/Root.cs
Normal file
@@ -0,0 +1,76 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace TestWebSocket
|
||||
{
|
||||
public class Root
|
||||
{
|
||||
public List<DataItem> data { get; set; }
|
||||
}
|
||||
public class DataItem
|
||||
{
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public string ExtendedLocation { get; set; }
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public string OriginQuery { get; set; }
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public string appinfo { get; set; }
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public int disp_type { get; set; }
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public string fetchkey { get; set; }
|
||||
/// <summary>
|
||||
/// 本地局域网
|
||||
/// </summary>
|
||||
public string location { get; set; }
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public string origip { get; set; }
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public string origipquery { get; set; }
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public string resourceid { get; set; }
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public int role_id { get; set; }
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public int shareImage { get; set; }
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public int showLikeShare { get; set; }
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public string showlamp { get; set; }
|
||||
/// <summary>
|
||||
/// IP地址查询
|
||||
/// </summary>
|
||||
public string titlecont { get; set; }
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public string tplt { get; set; }
|
||||
}
|
||||
}
|
||||
125
TestWebSocket/Sendmessageinfo.cs
Normal file
125
TestWebSocket/Sendmessageinfo.cs
Normal file
@@ -0,0 +1,125 @@
|
||||
using Fleck;
|
||||
using Newtonsoft.Json;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Web.UI.WebControls.WebParts;
|
||||
using WebSocketToolsConsole;
|
||||
|
||||
namespace TestWebSocket
|
||||
{
|
||||
|
||||
public class Sendmessageinfo
|
||||
{
|
||||
|
||||
public string MsgID { get; set; }
|
||||
public string SN { get; set; }
|
||||
|
||||
public string CMD { get; set; }
|
||||
public string Token { get; set; }
|
||||
public string ProtocolVersion { get; set; }
|
||||
public string DateTime { get; set; }
|
||||
public string Brand { get; set; }
|
||||
public Datainfo Para { get; set; }
|
||||
public Sendmessageinfo()
|
||||
{
|
||||
Para = new Datainfo();
|
||||
}
|
||||
}
|
||||
public class Parainfo
|
||||
{
|
||||
public string Key { get; set; }
|
||||
public string Logo { get; set; }
|
||||
public string BkgImg { get; set; }
|
||||
public string RoomNo { get; set; }
|
||||
}
|
||||
|
||||
public class Datainfo
|
||||
{
|
||||
public string Key { get; set; }
|
||||
}
|
||||
|
||||
public class datainfo
|
||||
{
|
||||
public string imageBj { get; set; }
|
||||
public string imagelogo { get; set; }
|
||||
public string Roomname { get; set; }
|
||||
}
|
||||
|
||||
public class SenbJandrnameandlogo {
|
||||
public string MsgID { get; set; }
|
||||
public string Token { get; set; }
|
||||
public string ProtocolVersion { get; set; }
|
||||
public string DateTime { get; set; }
|
||||
public string Brand { get; set; }
|
||||
|
||||
public string SN { get; set; }
|
||||
|
||||
public string CMD { get; set; }
|
||||
public Parainfo Para { get; set; }
|
||||
public SenbJandrnameandlogo()
|
||||
{
|
||||
Para = new Parainfo();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
public class SendUpData
|
||||
{
|
||||
public string MsgID { get; set; }
|
||||
public string SN { get; set; }
|
||||
|
||||
public string CMD { get; set; }
|
||||
public string Token { get; set; }
|
||||
public string ProtocolVersion { get; set; }
|
||||
public string DateTime { get; set; }
|
||||
public string Brand { get; set; }
|
||||
public SenDatainfo Para { get; set; }
|
||||
public SendUpData()
|
||||
{
|
||||
Para = new SenDatainfo();
|
||||
}
|
||||
}
|
||||
public class SenDatainfo
|
||||
{
|
||||
public string Host { get; set; }
|
||||
public string Port { get; set; }
|
||||
|
||||
public string UserName { get; set; }
|
||||
public string PW { get; set; }
|
||||
public string Folder { get; set; }
|
||||
public string Key { get; set; }
|
||||
}
|
||||
|
||||
public class SendUpDataAPK
|
||||
{
|
||||
public string MsgID { get; set; }
|
||||
public string SN { get; set; }
|
||||
|
||||
public string CMD { get; set; }
|
||||
public string Token { get; set; }
|
||||
public string ProtocolVersion { get; set; }
|
||||
public string DateTime { get; set; }
|
||||
public string Brand { get; set; }
|
||||
public SenDatainfoAPK Para { get; set; }
|
||||
public SendUpDataAPK()
|
||||
{
|
||||
Para = new SenDatainfoAPK();
|
||||
}
|
||||
}
|
||||
public class SenDatainfoAPK
|
||||
{
|
||||
public string Host { get; set; }
|
||||
public string Port { get; set; }
|
||||
|
||||
public string UserName { get; set; }
|
||||
public string PW { get; set; }
|
||||
public string File { get; set; }
|
||||
public string Key { get; set; }
|
||||
}
|
||||
}
|
||||
4230
TestWebSocket/SqlHelper.cs
Normal file
4230
TestWebSocket/SqlHelper.cs
Normal file
File diff suppressed because it is too large
Load Diff
63
TestWebSocket/SqlSugarBase.cs
Normal file
63
TestWebSocket/SqlSugarBase.cs
Normal file
@@ -0,0 +1,63 @@
|
||||
using SqlSugar;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using static WebSocketToolsConsole.Entity;
|
||||
|
||||
namespace TestWebSocket
|
||||
{
|
||||
public class SqlSugarBase
|
||||
{
|
||||
public static SqlSugarScope FaceDb = new SqlSugarScope(new ConnectionConfig()
|
||||
{
|
||||
DbType = SqlSugar.DbType.MySql,
|
||||
ConnectionString = "Server=blv-cloud-db.mysql.rds.aliyuncs.com;Database=face;Uid=blv_rcu;Pwd=fnadiaJDIJ7546;charset=utf8;port=3307;",
|
||||
IsAutoCloseConnection = true //不设成true要手动close
|
||||
},
|
||||
db =>
|
||||
{
|
||||
//(A)全局生效配置点,一般AOP和程序启动的配置扔这里面 ,所有上下文生效
|
||||
//调试SQL事件,可以删掉
|
||||
db.Aop.OnLogExecuting = (sql, pars) =>
|
||||
{
|
||||
//Console.WriteLine(sql);//输出sql,查看执行sql 性能无影响
|
||||
|
||||
//获取原生SQL推荐 5.1.4.63 性能OK
|
||||
//UtilMethods.GetNativeSql(sql,pars)
|
||||
|
||||
//获取无参数化SQL 对性能有影响,特别大的SQL参数多的,调试使用
|
||||
//UtilMethods.GetSqlString(DbType.SqlServer,sql,pars)
|
||||
|
||||
};
|
||||
});
|
||||
|
||||
public static SqlSugarScope RcuDb = new SqlSugarScope(new ConnectionConfig()
|
||||
{
|
||||
DbType = SqlSugar.DbType.MySql,
|
||||
ConnectionString = "Server=blv-cloud-db.mysql.rds.aliyuncs.com;Database=blv_rcu_db;Uid=blv_rcu;Pwd=fnadiaJDIJ7546;charset=utf8;port=3307;",
|
||||
IsAutoCloseConnection = true //不设成true要手动close
|
||||
});
|
||||
|
||||
public static SqlSugarClient FaceDbClient()
|
||||
{
|
||||
SqlSugarClient Db = new SqlSugarClient(new ConnectionConfig()
|
||||
{
|
||||
ConnectionString = "Server=blv-cloud-db.mysql.rds.aliyuncs.com;Database=Face;Uid=blv_rcu;Pwd=fnadiaJDIJ7546;charset=utf8;port=3307;",
|
||||
DbType = SqlSugar.DbType.MySql,
|
||||
InitKeyType = InitKeyType.Attribute,//从特性读取主键和自增列信息
|
||||
IsAutoCloseConnection = true,//开启自动释放模式和EF原理一样我就不多解释了
|
||||
});
|
||||
//用来打印Sql方便调式
|
||||
Db.Aop.OnLogExecuting = (sql, pars) =>
|
||||
{
|
||||
Db.Utilities.SerializeObject(pars.ToDictionary(it => it.ParameterName, it => it.Value));
|
||||
Debug.WriteLine(sql);
|
||||
};
|
||||
return Db;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
228
TestWebSocket/TestOnlyCode.cs
Normal file
228
TestWebSocket/TestOnlyCode.cs
Normal file
File diff suppressed because one or more lines are too long
94
TestWebSocket/TestSqlClass.cs
Normal file
94
TestWebSocket/TestSqlClass.cs
Normal file
@@ -0,0 +1,94 @@
|
||||
using System; // 引入System命名空间,提供基础类型
|
||||
using System.Collections.Generic; // 引入集合命名空间,提供泛型集合
|
||||
using System.Data; // 引入数据命名空间,提供数据访问基础接口
|
||||
using System.Threading; // 引入线程命名空间,提供多线程编程支持
|
||||
using MySql.Data.MySqlClient; // 引入MySQL的ADO.NET提供程序命名空间
|
||||
|
||||
public class BatchDatabaseExecutor
|
||||
{
|
||||
private List<string> _commands = new List<string>(); // 存储待执行的SQL命令列表
|
||||
private Timer _timer; // 定时器,用于定期执行数据库操作
|
||||
private string _connectionString; // 数据库连接字符串
|
||||
|
||||
public BatchDatabaseExecutor(string connectionString) // 构造函数,初始化连接字符串和定时器
|
||||
{
|
||||
_connectionString = connectionString; // 初始化数据库连接字符串
|
||||
// 设置定时器,每1000毫秒(1秒)执行一次
|
||||
_timer = new Timer(TimerCallback, null, 0, 1000);
|
||||
}
|
||||
|
||||
public void AddCommand(string command) // 向命令列表添加SQL命令
|
||||
{
|
||||
lock (_commands) // 使用lock确保线程安全
|
||||
{
|
||||
_commands.Add(command); // 添加命令到列表
|
||||
}
|
||||
}
|
||||
|
||||
private void TimerCallback(object o) // 定时器回调方法,执行数据库操作
|
||||
{
|
||||
List<string> commandsToExecute;
|
||||
lock (_commands) // 使用lock确保线程安全
|
||||
{
|
||||
if (_commands.Count == 0) // 如果没有命令需要执行,直接返回
|
||||
return;
|
||||
|
||||
commandsToExecute = new List<string>(_commands); // 复制命令列表
|
||||
_commands.Clear(); // 清空原命令列表,准备下一次收集
|
||||
}
|
||||
|
||||
ExecuteBatch(commandsToExecute); // 执行批量命令
|
||||
}
|
||||
|
||||
private void ExecuteBatch(List<string> commands) // 执行批量数据库命令
|
||||
{
|
||||
try
|
||||
{
|
||||
using (var connection = new MySqlConnection(_connectionString)) // 创建数据库连接
|
||||
{
|
||||
connection.Open(); // 打开数据库连接
|
||||
|
||||
using (var transaction = connection.BeginTransaction()) // 开始数据库事务
|
||||
{
|
||||
foreach (var commandText in commands) // 遍历命令列表
|
||||
{
|
||||
using (var command = new MySqlCommand(commandText, connection, transaction)) // 创建命令对象
|
||||
{
|
||||
command.ExecuteNonQuery(); // 执行命令
|
||||
}
|
||||
}
|
||||
|
||||
transaction.Commit(); // 提交事务
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex) // 捕获并处理异常
|
||||
{
|
||||
Console.WriteLine("An error occurred: " + ex.Message); // 打印异常信息
|
||||
// 在这里可以添加错误处理逻辑,比如重试或记录日志
|
||||
}
|
||||
}
|
||||
|
||||
public void Dispose() // 释放资源
|
||||
{
|
||||
_timer?.Change(Timeout.Infinite, Timeout.Infinite); // 停止定时器
|
||||
_timer?.Dispose(); // 释放定时器资源
|
||||
}
|
||||
}
|
||||
|
||||
// 使用实例
|
||||
/*class Program
|
||||
{
|
||||
static void Main(string[] args)
|
||||
{
|
||||
var executor = new BatchDatabaseExecutor("your_connection_string_here"); // 实例化数据库执行器
|
||||
|
||||
// 不同方法调用
|
||||
*//* executor.AddCommand("INSERT INTO table_name (column1) VALUES ('value1');");
|
||||
executor.AddCommand("UPDATE table_name SET column1='value2' WHERE id=1;");
|
||||
executor.AddCommand("DELETE FROM table_name WHERE id=2;");*//*
|
||||
|
||||
executor.Dispose(); // 调用Dispose方法释放资源
|
||||
}
|
||||
}
|
||||
*/
|
||||
202
TestWebSocket/TestWebSocket.csproj
Normal file
202
TestWebSocket/TestWebSocket.csproj
Normal file
@@ -0,0 +1,202 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="..\packages\EntityFramework.6.4.4\build\EntityFramework.props" Condition="Exists('..\packages\EntityFramework.6.4.4\build\EntityFramework.props')" />
|
||||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProjectGuid>{3B29DA63-7818-4C39-969A-19CB471B3CC9}</ProjectGuid>
|
||||
<OutputType>Exe</OutputType>
|
||||
<RootNamespace>TestWebSocket</RootNamespace>
|
||||
<AssemblyName>TestWebSocket</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
|
||||
<Deterministic>true</Deterministic>
|
||||
<IsWebBootstrapper>false</IsWebBootstrapper>
|
||||
<NuGetPackageImportStamp>
|
||||
</NuGetPackageImportStamp>
|
||||
<TargetFrameworkProfile />
|
||||
<PublishUrl>D:\publish\faceconsole\</PublishUrl>
|
||||
<Install>true</Install>
|
||||
<InstallFrom>Disk</InstallFrom>
|
||||
<UpdateEnabled>false</UpdateEnabled>
|
||||
<UpdateMode>Foreground</UpdateMode>
|
||||
<UpdateInterval>7</UpdateInterval>
|
||||
<UpdateIntervalUnits>Days</UpdateIntervalUnits>
|
||||
<UpdatePeriodically>false</UpdatePeriodically>
|
||||
<UpdateRequired>false</UpdateRequired>
|
||||
<MapFileExtensions>true</MapFileExtensions>
|
||||
<AutorunEnabled>true</AutorunEnabled>
|
||||
<ApplicationRevision>53</ApplicationRevision>
|
||||
<ApplicationVersion>1.0.0.%2a</ApplicationVersion>
|
||||
<UseApplicationTrust>false</UseApplicationTrust>
|
||||
<PublishWizardCompleted>true</PublishWizardCompleted>
|
||||
<BootstrapperEnabled>true</BootstrapperEnabled>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<ManifestCertificateThumbprint>E82633E97B8ED6C37BCEE1F8581C179B1F647E22</ManifestCertificateThumbprint>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<ManifestKeyFile>TestWebSocket_TemporaryKey.pfx</ManifestKeyFile>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<GenerateManifests>true</GenerateManifests>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<SignManifests>false</SignManifests>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<StartupObject />
|
||||
</PropertyGroup>
|
||||
<PropertyGroup />
|
||||
<ItemGroup>
|
||||
<Reference Include="BouncyCastle.Crypto, Version=1.8.5.0, Culture=neutral, PublicKeyToken=0e99375e54769942">
|
||||
<HintPath>..\packages\BouncyCastle.1.8.5\lib\BouncyCastle.Crypto.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\EntityFramework.6.4.4\lib\net45\EntityFramework.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="EntityFramework.SqlServer, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\EntityFramework.6.4.4\lib\net45\EntityFramework.SqlServer.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Fleck, Version=1.2.0.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Fleck.1.2.0\lib\net45\Fleck.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Google.Protobuf, Version=3.19.4.0, Culture=neutral, PublicKeyToken=a7d26565bac4d604, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Google.Protobuf.3.19.4\lib\net45\Google.Protobuf.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="K4os.Compression.LZ4, Version=1.2.6.0, Culture=neutral, PublicKeyToken=2186fa9121ef231d, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\K4os.Compression.LZ4.1.2.6\lib\net46\K4os.Compression.LZ4.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="K4os.Compression.LZ4.Streams, Version=1.2.6.0, Culture=neutral, PublicKeyToken=2186fa9121ef231d, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\K4os.Compression.LZ4.Streams.1.2.6\lib\net46\K4os.Compression.LZ4.Streams.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="K4os.Hash.xxHash, Version=1.0.6.0, Culture=neutral, PublicKeyToken=32cd54395057cec3, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\K4os.Hash.xxHash.1.0.6\lib\net46\K4os.Hash.xxHash.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="MySql.Data, Version=8.0.29.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\MySql.Data.8.0.29\lib\net452\MySql.Data.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="MySql.Data.EntityFramework, Version=8.0.29.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\MySql.Data.EntityFramework.8.0.29\lib\net452\MySql.Data.EntityFramework.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Newtonsoft.Json, Version=13.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Newtonsoft.Json.13.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="SqlSugar, Version=5.1.4.93, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\SqlSugar.5.1.4.93\lib\SqlSugar.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Buffers, Version=4.0.3.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\System.Buffers.4.5.1\lib\net461\System.Buffers.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.ComponentModel" />
|
||||
<Reference Include="System.ComponentModel.DataAnnotations" />
|
||||
<Reference Include="System.Configuration" />
|
||||
<Reference Include="System.Configuration.Install" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Drawing" />
|
||||
<Reference Include="System.Management" />
|
||||
<Reference Include="System.Memory, Version=4.0.1.1, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\System.Memory.4.5.4\lib\net461\System.Memory.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Messaging" />
|
||||
<Reference Include="System.Numerics" />
|
||||
<Reference Include="System.Numerics.Vectors, Version=4.1.4.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\System.Numerics.Vectors.4.5.0\lib\net46\System.Numerics.Vectors.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Runtime.CompilerServices.Unsafe, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\System.Runtime.CompilerServices.Unsafe.5.0.0\lib\net45\System.Runtime.CompilerServices.Unsafe.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Security" />
|
||||
<Reference Include="System.Transactions" />
|
||||
<Reference Include="System.Web" />
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
<Reference Include="System.Data.DataSetExtensions" />
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Net.Http" />
|
||||
<Reference Include="System.Xml" />
|
||||
<Reference Include="Ubiety.Dns.Core, Version=2.2.1.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\MySql.Data.8.0.29\lib\net452\Ubiety.Dns.Core.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="ZstdNet, Version=1.4.5.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\MySql.Data.8.0.29\lib\net452\ZstdNet.dll</HintPath>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="BLL.cs" />
|
||||
<Compile Include="devicemanage.cs" />
|
||||
<Compile Include="devicestatushistory.cs" />
|
||||
<Compile Include="Entity.cs" />
|
||||
<Compile Include="faceerrormsg.cs" />
|
||||
<Compile Include="FaceIssue.cs" />
|
||||
<Compile Include="FaceMessage.cs" />
|
||||
<Compile Include="FaceReturuinfo.cs" />
|
||||
<Compile Include="InfoBody.cs" />
|
||||
<Compile Include="LogHelper.cs" />
|
||||
<Compile Include="MysqlHelpers.cs" />
|
||||
<Compile Include="facedevicerxtxinfo.cs" />
|
||||
<Compile Include="Sendmessageinfo.cs" />
|
||||
<Compile Include="TestSqlClass.cs" />
|
||||
<Compile Include="transferFace.cs" />
|
||||
<Compile Include="pmsLog.cs" />
|
||||
<Compile Include="pmsProcess.cs" />
|
||||
<Compile Include="Program.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="ResendLog.cs" />
|
||||
<Compile Include="Root.cs" />
|
||||
<Compile Include="SqlHelper.cs" />
|
||||
<Compile Include="SqlSugarBase.cs" />
|
||||
<Compile Include="TestOnlyCode.cs" />
|
||||
<Compile Include="WebToSocketErrMsg.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="App.config" />
|
||||
<None Include="packages.config">
|
||||
<SubType>Designer</SubType>
|
||||
</None>
|
||||
<None Include="TestWebSocket_TemporaryKey.pfx" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<BootstrapperPackage Include=".NETFramework,Version=v4.6.1">
|
||||
<Visible>False</Visible>
|
||||
<ProductName>Microsoft .NET Framework 4.6.1 %28x86 和 x64%29</ProductName>
|
||||
<Install>true</Install>
|
||||
</BootstrapperPackage>
|
||||
<BootstrapperPackage Include="Microsoft.Net.Framework.3.5.SP1">
|
||||
<Visible>False</Visible>
|
||||
<ProductName>.NET Framework 3.5 SP1</ProductName>
|
||||
<Install>false</Install>
|
||||
</BootstrapperPackage>
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
|
||||
<PropertyGroup>
|
||||
<ErrorText>这台计算机上缺少此项目引用的 NuGet 程序包。使用“NuGet 程序包还原”可下载这些程序包。有关更多信息,请参见 http://go.microsoft.com/fwlink/?LinkID=322105。缺少的文件是 {0}。</ErrorText>
|
||||
</PropertyGroup>
|
||||
<Error Condition="!Exists('..\packages\EntityFramework.6.4.4\build\EntityFramework.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\EntityFramework.6.4.4\build\EntityFramework.props'))" />
|
||||
<Error Condition="!Exists('..\packages\EntityFramework.6.4.4\build\EntityFramework.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\EntityFramework.6.4.4\build\EntityFramework.targets'))" />
|
||||
</Target>
|
||||
<Import Project="..\packages\EntityFramework.6.4.4\build\EntityFramework.targets" Condition="Exists('..\packages\EntityFramework.6.4.4\build\EntityFramework.targets')" />
|
||||
</Project>
|
||||
17
TestWebSocket/TestWebSocket.csproj.user
Normal file
17
TestWebSocket/TestWebSocket.csproj.user
Normal file
@@ -0,0 +1,17 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<PublishUrlHistory>D:\publish\faceconsole\|D:\Websocket测试\</PublishUrlHistory>
|
||||
<InstallUrlHistory />
|
||||
<SupportUrlHistory />
|
||||
<UpdateUrlHistory />
|
||||
<BootstrapperUrlHistory />
|
||||
<ErrorReportUrlHistory />
|
||||
<FallbackCulture>zh-CN</FallbackCulture>
|
||||
<VerifyUploadedFiles>false</VerifyUploadedFiles>
|
||||
<ProjectView>ShowAllFiles</ProjectView>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<EnableSecurityDebugging>false</EnableSecurityDebugging>
|
||||
</PropertyGroup>
|
||||
</Project>
|
||||
BIN
TestWebSocket/TestWebSocket_TemporaryKey.pfx
Normal file
BIN
TestWebSocket/TestWebSocket_TemporaryKey.pfx
Normal file
Binary file not shown.
58
TestWebSocket/WebToSocketErrMsg.cs
Normal file
58
TestWebSocket/WebToSocketErrMsg.cs
Normal file
@@ -0,0 +1,58 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace TestWebSocket
|
||||
{
|
||||
public class WebToSocketErrMsg
|
||||
{
|
||||
public string Token { get; set; }
|
||||
public string ProtocolVersion { get; set; }
|
||||
public string MsgID { get; set; }
|
||||
public string DateTime { get; set; }
|
||||
public string Brand { get; set; }
|
||||
public string SN { get; set; }
|
||||
public string CMD { get; set; }
|
||||
public ParaClass Para { get; set; }
|
||||
|
||||
}
|
||||
|
||||
public class ParaClass
|
||||
{
|
||||
public int ErrCode { get; set; }
|
||||
public string ErrMsg { get; set; }
|
||||
}
|
||||
|
||||
|
||||
public class ToWebFaceinfo
|
||||
{
|
||||
public string msgid { get; set; }
|
||||
public string sn { get; set; }
|
||||
public string cmd { get; set; }
|
||||
public msgsinfo msg { get; set; }
|
||||
}
|
||||
|
||||
|
||||
public class msgsinfo
|
||||
{
|
||||
public string Token { get; set; }
|
||||
public string ProtocolVersion { get; set; }
|
||||
public string DateTime { get; set; }
|
||||
public string Brand { get; set; }
|
||||
public string CMD { get; set; }
|
||||
public string HwVer { get; set; }
|
||||
public string AppVer { get; set; }
|
||||
public RtParaClass Para { get; set; }
|
||||
|
||||
}
|
||||
|
||||
public class RtParaClass
|
||||
{
|
||||
public string HotelID { get; set; }
|
||||
public string RoomID { get; set; }
|
||||
public string Groupid { get; set; }
|
||||
public string name { get; set; }
|
||||
}
|
||||
}
|
||||
35
TestWebSocket/devicemanage.cs
Normal file
35
TestWebSocket/devicemanage.cs
Normal file
@@ -0,0 +1,35 @@
|
||||
using SqlSugar;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace TestWebSocket
|
||||
{
|
||||
public class devicemanage
|
||||
{
|
||||
[SugarColumn(IsPrimaryKey = true)]
|
||||
public int Facelid { get; set; }
|
||||
|
||||
public string SerialNo { get; set; }
|
||||
public Nullable<DateTime> CreatedDate { get; set; }
|
||||
public string HotelCode { get; set; }
|
||||
public int RoomId { get; set; }
|
||||
public string Factory { get; set; }
|
||||
public bool Status { get; set; }
|
||||
public Nullable<DateTime> bindingDate { get; set; }
|
||||
public bool bindingStatus { get; set; }
|
||||
public string faceIp { get; set; }
|
||||
public string faceAddress { get; set; }
|
||||
public int maintainStatus { get; set; }
|
||||
public int isPublicArea { get; set; }
|
||||
public string AssociatedPublicArea { get; set; }
|
||||
public string APKVersion { get; set; }
|
||||
}
|
||||
|
||||
public class FaceRoomType //房间类型
|
||||
{
|
||||
public string RoomTypeName { get; set; }
|
||||
}
|
||||
}
|
||||
21
TestWebSocket/devicestatushistory.cs
Normal file
21
TestWebSocket/devicestatushistory.cs
Normal file
@@ -0,0 +1,21 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using SqlSugar;
|
||||
|
||||
namespace TestWebSocket
|
||||
{
|
||||
public class devicestatushistory
|
||||
{
|
||||
[SugarColumn(IsPrimaryKey = true)]
|
||||
public int ID { get; set; }
|
||||
|
||||
public string SN { get; set; }
|
||||
public string Factory { get; set; }
|
||||
public int Status { get; set; }
|
||||
public Nullable<DateTime> CreateTime { get; set; }
|
||||
public string Reason { get; set; }
|
||||
}
|
||||
}
|
||||
22
TestWebSocket/facedevicerxtxinfo.cs
Normal file
22
TestWebSocket/facedevicerxtxinfo.cs
Normal file
@@ -0,0 +1,22 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace TestWebSocket
|
||||
{
|
||||
public class facedevicerxtxinfo
|
||||
{
|
||||
public int pmsid { get; set; }
|
||||
public string sn { get; set; }
|
||||
public string msgid { get; set; }
|
||||
public string cmd { get; set; }
|
||||
public string data { get; set; }
|
||||
public DateTime datatime { get; set; }
|
||||
public string direction { get; set; }
|
||||
public int trresult { get; set; }
|
||||
public string ipaddr { get; set; }
|
||||
public string iplocation { get; set; }
|
||||
}
|
||||
}
|
||||
33
TestWebSocket/faceerrormsg.cs
Normal file
33
TestWebSocket/faceerrormsg.cs
Normal file
@@ -0,0 +1,33 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace TestWebSocket
|
||||
{
|
||||
public class faceerrormsg
|
||||
{
|
||||
public int id { get; set; }
|
||||
public string hotelid { get; set; }
|
||||
public string Roomid { get; set; }
|
||||
|
||||
public string brandinfo { get; set; }
|
||||
public string sn { get; set; }
|
||||
|
||||
public int pmsid { get; set; }
|
||||
public int step { get; set; }
|
||||
public int errorcode { get; set; }
|
||||
public string errormsg { get; set; }
|
||||
|
||||
public string remary { get; set; }
|
||||
public DateTime creationtime { get; set; }
|
||||
public string cmd { get; set; }
|
||||
|
||||
public string APKVersion { get; set; }
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
18
TestWebSocket/faceissue1.cs
Normal file
18
TestWebSocket/faceissue1.cs
Normal file
@@ -0,0 +1,18 @@
|
||||
using System;
|
||||
|
||||
namespace TestWebSocket
|
||||
{
|
||||
public class faceissue
|
||||
{
|
||||
public int id { get; set; }
|
||||
|
||||
public string faceSn { get; set; }
|
||||
public DateTime creationtime { get; set; }
|
||||
public string pmsid { get; set; }
|
||||
|
||||
public string picture { get; set; }
|
||||
public int issuestate { get; set; }
|
||||
public string messageid { get; set; }
|
||||
public string APKVersion { get; set; }
|
||||
}
|
||||
}
|
||||
18
TestWebSocket/packages.config
Normal file
18
TestWebSocket/packages.config
Normal file
@@ -0,0 +1,18 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="BouncyCastle" version="1.8.5" targetFramework="net461" />
|
||||
<package id="EntityFramework" version="6.4.4" targetFramework="net461" />
|
||||
<package id="Fleck" version="1.2.0" targetFramework="net48" />
|
||||
<package id="Google.Protobuf" version="3.19.4" targetFramework="net461" />
|
||||
<package id="K4os.Compression.LZ4" version="1.2.6" targetFramework="net461" />
|
||||
<package id="K4os.Compression.LZ4.Streams" version="1.2.6" targetFramework="net461" />
|
||||
<package id="K4os.Hash.xxHash" version="1.0.6" targetFramework="net461" />
|
||||
<package id="MySql.Data" version="8.0.29" targetFramework="net461" requireReinstallation="true" />
|
||||
<package id="MySql.Data.EntityFramework" version="8.0.29" targetFramework="net461" />
|
||||
<package id="Newtonsoft.Json" version="13.0.3" targetFramework="net48" />
|
||||
<package id="SqlSugar" version="5.1.4.93" targetFramework="net48" />
|
||||
<package id="System.Buffers" version="4.5.1" targetFramework="net461" />
|
||||
<package id="System.Memory" version="4.5.4" targetFramework="net461" />
|
||||
<package id="System.Numerics.Vectors" version="4.5.0" targetFramework="net461" />
|
||||
<package id="System.Runtime.CompilerServices.Unsafe" version="5.0.0" targetFramework="net461" />
|
||||
</packages>
|
||||
18
TestWebSocket/pmsLog.cs
Normal file
18
TestWebSocket/pmsLog.cs
Normal file
@@ -0,0 +1,18 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace TestWebSocket
|
||||
{
|
||||
public class pmsLog
|
||||
{
|
||||
public int pmsid { get; set; }
|
||||
public int step { get; set; }
|
||||
public int app { get; set; }
|
||||
public DateTime Creationtime { get; set; }
|
||||
public string message { get; set; }
|
||||
public string Data { get; set; }
|
||||
}
|
||||
}
|
||||
22
TestWebSocket/pmsProcess.cs
Normal file
22
TestWebSocket/pmsProcess.cs
Normal file
@@ -0,0 +1,22 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace TestWebSocket
|
||||
{
|
||||
public class pmsProcess
|
||||
{
|
||||
public int ID { get; set; }
|
||||
public string messageid { get; set; }
|
||||
|
||||
|
||||
public int receive { get; set; }
|
||||
|
||||
public int issuestate { get; set; }
|
||||
|
||||
public string cmdType { get; set; }
|
||||
public int Issueface { get; set; }
|
||||
}
|
||||
}
|
||||
17
TestWebSocket/transferFace.cs
Normal file
17
TestWebSocket/transferFace.cs
Normal file
@@ -0,0 +1,17 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace TestWebSocket
|
||||
{
|
||||
public partial class transferFace
|
||||
{
|
||||
public int id { get; set; }
|
||||
public string faceSN { get; set; }
|
||||
public string infoid { get; set; }
|
||||
public Nullable<int> faultState { get; set; }
|
||||
public Nullable<System.DateTime> creationTime { get; set; }
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user