增加 心跳推送,空人说我太冷了,我太热了的时候 自动打开空调

This commit is contained in:
2026-03-11 16:30:23 +08:00
parent 72fa1a5524
commit 426d99959c
6 changed files with 52 additions and 1 deletions

Binary file not shown.

View File

@@ -789,6 +789,17 @@ namespace Common
long unixTimestampMillisecondsManual = (long)(DateTime.UtcNow - unixEpoch).TotalSeconds;
return unixTimestampMillisecondsManual;
}
/// <summary>
/// 格林尼治时间 毫秒
/// </summary>
/// <returns></returns>
public static long GetUnixTime_MS()
{
DateTime unixEpoch = new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc);
long unixTimestampMillisecondsManual = (long)(DateTime.UtcNow - unixEpoch).TotalMilliseconds;
return unixTimestampMillisecondsManual;
}
public static DateTime GetTimeFromUnixTime(long timestampSeconds)
{
// Unix 时间戳的起始时间1970-01-01 00:00:00 UTC

View File

@@ -70,6 +70,7 @@
<Compile Include="HostNumber_CacheData.cs" />
<Compile Include="HostSearchEntity.cs" />
<Compile Include="JWTData.cs" />
<Compile Include="Kafka_XinTiao.cs" />
<Compile Include="KongQi.cs" />
<Compile Include="LieECOTaskExtra.cs" />
<Compile Include="LingChenECO.cs" />

View File

@@ -0,0 +1,16 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace CommonEntity
{
public struct Kafka_XinTiao
{
public string current_time { get; set; }
public long ts_ms { get; set; }
public string hotel_id { get; set; }
public string device_id { get; set; }
public string room_id { get; set; }
}
}

View File

@@ -1270,6 +1270,22 @@ namespace RCUHost.Implement
string CODE = context111.SystemHeader.Value.HostNumber.ToHotelCode().ToString();
string hotelCode = CODE;
string EndPoint = context111.RemoteEndPoint.ToString();
if (cmdType == 0x02)
{
string RoomNUMBER = CSRedisCacheHelper.HMGet<string>(5, CacheKey.RoomNumber_HostNumber, HostNNN)[0];
if (!string.IsNullOrEmpty(RoomNUMBER))
{
string hotelid = CODE;
string roomid = RoomNUMBER;
Kafka_XinTiao k = new Kafka_XinTiao();
k.hotel_id = CODE;
k.device_id = HostNNN;
k.room_id = RoomNUMBER;
k.ts_ms = Tools.GetUnixTime_MS();
k.current_time = CPUData.GetNowPrecise().ToString("yyyy-MM-dd HH:mm:ss.ffffff") ;
CSRedisCacheHelper.Publish("redis-heartbeat", Newtonsoft.Json.JsonConvert.SerializeObject(k));
}
}
if (cmdType != 0x01 && cmdType != 0xb1)
//if (!(cmdType==0x01||cmdType==0xb1) )
//在线状态 不排队 注册0x01
@@ -2506,7 +2522,7 @@ namespace RCUHost.Implement
//温控器
var DataLen1 = Convert.ToInt32(WenKongQiDataLen);
///ushort StatusReceiver = reader.ReadUInt16();
//ushort StatusReceiver = reader.ReadUInt16();
ushort StatusReceiver = BitConverter.ToUInt16(reader.ReadBytes(2).Reverse().ToArray(), 0);
int XiaoShu_BuFen = 0;
float xiaoshu_l = 0.0f;

View File

@@ -1626,6 +1626,13 @@ namespace WebSite.Controllers
}
else
{
string tiaowen = request.header.name;
if (tiaowen.Equals("IncrementTemperatureRequest") || tiaowen.Equals("IncrementTemperatureRequest"))
{
HostModalManager.SetDevice(host, hostModal, 1, 0);
Thread.Sleep(50);
}
//对房间设备进行操作
HostModalManager.SetDevice(host, hostModal, status, brightness, temperature, fanSpeed, mode, valve);
}