一个非常平稳的版本

一个非常平稳的版本,兼容了新老服务器
This commit is contained in:
2026-04-10 19:08:44 +08:00
parent 36c2fa4061
commit 6f59da74c4
16 changed files with 68 additions and 1082 deletions

1
.gitignore vendored
View File

@@ -47,3 +47,4 @@ ConsoleApplication1
ConsoleApplication666
ConsoleApplication666
ConsoleApplication1
ConsoleApplication2

View File

@@ -59,6 +59,7 @@
<Compile Include="CacheDTO.cs" />
<Compile Include="CacheKey.cs" />
<Compile Include="DataTongJi.cs" />
<Compile Include="FangTaiData.cs" />
<Compile Include="FCS.cs" />
<Compile Include="ForkSystem.cs" />
<Compile Include="GaiXie.cs" />

View File

@@ -0,0 +1,15 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Domain;
namespace CommonEntity
{
public class FangTaiData
{
public int hotelID { get; set; }
public RoomStatus roomStatus { get; set; }
public string RoomNUM { get; set; }
}
}

View File

@@ -1,139 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">x86</Platform>
<ProductVersion>8.0.30703</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{4646F920-6D41-4519-8E03-5528B64EC7FE}</ProjectGuid>
<OutputType>Exe</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>ConsoleApplication2</RootNamespace>
<AssemblyName>ConsoleApplication2</AssemblyName>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<TargetFrameworkProfile>
</TargetFrameworkProfile>
<FileAlignment>512</FileAlignment>
<PublishUrl>publish\</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>
<ApplicationRevision>0</ApplicationRevision>
<ApplicationVersion>1.0.0.%2a</ApplicationVersion>
<IsWebBootstrapper>false</IsWebBootstrapper>
<UseApplicationTrust>false</UseApplicationTrust>
<BootstrapperEnabled>true</BootstrapperEnabled>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
<PlatformTarget>x86</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>TRACE;DEBUG;AAA;BBB;CCC;</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
<PlatformTarget>x86</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="CSRedisCore, Version=3.8.670.0, Culture=neutral, PublicKeyToken=9aa6a3079358d437, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\lib\Redis\CSRedisCore.dll</HintPath>
</Reference>
<Reference Include="FluentScheduler">
<HintPath>..\lib\taskschedule\FluentScheduler.dll</HintPath>
</Reference>
<Reference Include="jose-jwt">
<HintPath>..\lib\jwt\jose-jwt.dll</HintPath>
</Reference>
<Reference Include="Newtonsoft.Json, Version=13.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\lib\Newtonsoft.Json.dll</HintPath>
</Reference>
<Reference Include="RestSharp, Version=105.2.3.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\lib\RestSharp\RestSharp.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.ValueTuple">
<HintPath>..\lib\Redis\System.ValueTuple.dll</HintPath>
</Reference>
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<None Include="app.config">
<SubType>Designer</SubType>
</None>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\CommonEntity\CommonEntity.csproj">
<Project>{1D7073B2-4CC3-49F5-9F37-50A21D74A39D}</Project>
<Name>CommonEntity</Name>
</ProjectReference>
<ProjectReference Include="..\Common\Common.csproj">
<Project>{B3F29715-E925-4E56-9248-580F06C3BC11}</Project>
<Name>Common</Name>
</ProjectReference>
<ProjectReference Include="..\Domain\Domain.csproj">
<Project>{A42D287A-8EF4-48F6-B14C-7F9CA834F786}</Project>
<Name>Domain</Name>
</ProjectReference>
<ProjectReference Include="..\RCUHost\RCUHost.csproj">
<Project>{3AF4C628-0B47-412C-950A-DBC0161F2A7F}</Project>
<Name>RCUHost</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<BootstrapperPackage Include=".NETFramework,Version=v4.0">
<Visible>False</Visible>
<ProductName>Microsoft .NET Framework 4 %28x86 和 x64%29</ProductName>
<Install>true</Install>
</BootstrapperPackage>
<BootstrapperPackage Include="Microsoft.Net.Client.3.5">
<Visible>False</Visible>
<ProductName>.NET Framework 3.5 SP1 Client Profile</ProductName>
<Install>false</Install>
</BootstrapperPackage>
<BootstrapperPackage Include="Microsoft.Net.Framework.3.5.SP1">
<Visible>False</Visible>
<ProductName>.NET Framework 3.5 SP1</ProductName>
<Install>false</Install>
</BootstrapperPackage>
<BootstrapperPackage Include="Microsoft.Windows.Installer.3.1">
<Visible>False</Visible>
<ProductName>Windows Installer 3.1</ProductName>
<Install>true</Install>
</BootstrapperPackage>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>

View File

@@ -1,13 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<PublishUrlHistory />
<InstallUrlHistory />
<SupportUrlHistory />
<UpdateUrlHistory />
<BootstrapperUrlHistory />
<ErrorReportUrlHistory />
<FallbackCulture>zh-CN</FallbackCulture>
<VerifyUploadedFiles>false</VerifyUploadedFiles>
</PropertyGroup>
</Project>

View File

@@ -1,784 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Jose;
using System.Timers;
using Common;
using System.IO;
using System.Threading.Tasks;
using System.Threading;
using FluentScheduler;
using System.Xml;
using System.Xml.Linq;
using System.Collections;
using System.Security.Cryptography.X509Certificates;
using System.Diagnostics;
using System.Runtime.InteropServices;
using RCUHost.Protocols;
using RestSharp;
using Domain.IoTFerErEntity;
using System.Net;
using System.Collections.Concurrent;
using RCUHost.Implement;
using Domain;
using Newtonsoft.Json;
using CommonEntity;
using Newtonsoft.Json.Linq;
using CSRedis;
namespace ConsoleApplication2
{
class Program
{
public static string NormalizeVersion(string version, int desiredParts = 3)
{
// 移除末尾的冗余点并分割
var parts = version.TrimEnd('.').Split(new[] { '.' }, StringSplitOptions.RemoveEmptyEntries);
// 补零到目标位数
while (parts.Length < desiredParts)
{
parts = parts.Concat(new[] { "0" }).ToArray();
}
return string.Join(".", parts);
}
public struct A
{
public string id { get; set; }
public string name { get; set; }
}
static System.Timers.Timer t = null;
public enum Fruit
{
Apple, Bear
}
public class GA
{
public string NNN { get; set; }
public Fruit FFF { get; set; }
}
public class GGG
{
public string Name { get; set; }
}
[DllImport("kernel32.dll")]
private static extern void GetSystemTimePreciseAsFileTime(out long fileTime);
// 将 FILETIME (long) 转换为 DateTime
public static DateTime GetNowPrecise()
{
long fileTime;
GetSystemTimePreciseAsFileTime(out fileTime);
DateTime localTime = DateTime.FromFileTimeUtc(fileTime).ToLocalTime();
return localTime;
}
static byte[] GetBytesFromString(string hexString)
{
byte[] bytes = new byte[hexString.Length / 2]; // 计算字节数组的长度
for (int i = 0; i < bytes.Length; i++)
{
bytes[i] = Convert.ToByte(hexString.Substring(i * 2, 2), 16); // 每次取两个字符转换为字节
}
return bytes;
}
static void JieXi()
{
NewVersionLog s = new NewVersionLog();
var nas = JsonConvert.SerializeObject(s);
var data = Encoding.UTF8.GetBytes(nas);
Encoding.UTF8.GetString(data);
string strnn1 = "AA 55 2F 00 54 33 53 41 02 34 80 EB 03 6B 24 34 D0 B8 11 6B 24 01 01 01 39 01 01 00 10 F0 55 E8 03 E8 03 00 00 E8 03 00 00 E8 03 00 00 9E 00";
//AA 55 2F 00 54 33 53 41 02 34 80 EB 03 6B 24
//34 D0 B8 11 6B 24
//01 解析版本
//01 取电
//01 设备数量
//39
//01
//01
//00
//10 ///长度
//F0 55 //电压
//E8 03 //电流
//E8 03 00 00 功率
//E8 03 00 00 能耗
//E8 03 00 00 总能耗
//9E 00
byte[] nnnafd = GetBytesFromString(strnn1.Replace(" ", ""));
byte[] Data = GetBytesFromString(strnn1.Replace(" ", ""));
byte[] MAC = Data.Skip(15).Take(6).ToArray();
byte Version = Data.Skip(21).Take(1).FirstOrDefault();
//从第21个数据开始
byte TakeCard = Data.Skip(22).Take(1).FirstOrDefault();
//设备数量
byte DeviceCount = Data.Skip(23).Take(1).FirstOrDefault();
byte LeiXing = Data.Skip(24).Take(1).FirstOrDefault();
byte Address = Data.Skip(25).Take(1).FirstOrDefault();
byte[] Num = Data.Skip(26).Take(2).ToArray();
List<byte> lll = new List<byte>();
lll.Add(LeiXing);
lll.Add(Address);
lll.AddRange(Num);
string address = new DeviceAddress(lll.ToArray()).ToString();
byte Len = Data.Skip(28).Take(1).FirstOrDefault();
byte[] DianYa = Data.Skip(29).Take(2).ToArray();
byte[] DianLiu = Data.Skip(31).Take(2).ToArray();
byte[] Power = Data.Skip(33).Take(4).ToArray();
byte[] PowerUsed = Data.Skip(37).Take(4).ToArray();
byte[] TotalPowerUsed = Data.Skip(41).Take(4).ToArray();
int dianya = BitConverter.ToUInt16(DianYa, 0);
int dianliu = BitConverter.ToInt16(DianLiu, 0);
int gonglv = BitConverter.ToInt32(Power, 0);
int nenghao = BitConverter.ToInt32(PowerUsed, 0);
int zongnenghao = BitConverter.ToInt32(TotalPowerUsed, 0);
int V = dianya * 10 / 1000;
int A = dianliu * 10 / 1000;
int P = gonglv * 10 / 1000;
decimal KW_H = nenghao / 1000;
decimal Sum_KW_H = zongnenghao / 1000;
}
public class VVV
{
public DateTime ddd { get; set; }
public VVV()
{
this.ddd = DateTime.Now;
}
}
public class AUser
{
public string username { get; set; }
public string password { get; set; }
public int oauth_id { get; set; }
}
public static void FCSLLL()
{
try
{
//ssl 协议不兼容
var A = (SecurityProtocolType)48;
var B = (SecurityProtocolType)192;
var C = (SecurityProtocolType)768;
var D = (SecurityProtocolType)3072;
var E = (SecurityProtocolType)12288;
ServicePointManager.SecurityProtocol = A | B | C | D | E;
string FCSLoginUrl = "https://api.fcs1cloud.com";
string FCSLoginUserName = "hb.rcu";
string FCSLoginPassWord = "P@1234";
var client1 = new RestClient(FCSLoginUrl);
var request1 = new RestRequest("/api/security/authenticate", Method.POST);
//request1.AddHeader("Content-Type", "application/json");
AUser us = new AUser();
us.username = FCSLoginUserName;
us.password = FCSLoginPassWord;
us.oauth_id = 1;
request1.AddJsonBody(us);
//request1.AddBody(Newtonsoft.Json.JsonConvert.SerializeObject(us), DataFormat.Json);
var QQQ = client1.Execute(request1);
var UUN = QQQ.Content;
HttpStatusCode HHH = QQQ.StatusCode;
if (HHH == HttpStatusCode.Created || HHH == HttpStatusCode.OK)
{
string ddd = QQQ.Content;
}
}
catch (Exception ex)
{
}
}
public static ConcurrentQueue<string> ssslist = new ConcurrentQueue<string>();
public class A1
{
public string id { get; set; }
public string name { get; set; }
}
public struct Tiao
{
public string Nsa { get; set; }
}
public static void Data()
{
XuanZhuResponse resp = new XuanZhuResponse();
resp.code = "1085";
resp.roomNumber = "1001";
resp.address = "";
resp.name = "";
resp.status = 1;
if (resp.status == 1)
{
resp.brightness = 0;
resp.currentTemp = 25;
resp.settingTemp = 25;
resp.mode = 1;
resp.fanSpeed = 1;
resp.valve = 0;
}
MyHttp.SendHttpData("http://f-xcx.blv-oa.com/rcu/report", resp);
}
static void RedisTest()
{
var redis_webchat = new CSRedisClient(string.Format("47.119.147.104:26379" + ",password={0},defaultDatabase=0", "1001^_^lool"));
redis_webchat.HMSet("a", "b", "c");
}
static void AAA()
{
string nnn = "AA 55 30 00 54 33 53 41 0F 15 71 FF FF FF FF 05 07 01 00 00 00 80 07 02 00 00 00 80 07 03 00 00 00 80 07 04 00 00 00 80 07 05 00 00 00 80 CA 7C";
var data = Tools.GetBytesFromString(nnn.Replace(" ", ""));
string hostNumber = "233003055055";
var cmdtype = data[8];
var device_count = data[15];
if (cmdtype == 0x0F)
{
byte[] framenolist = data.Skip(7).Take(2).ToArray();
var zhenhao = BitConverter.ToUInt16(framenolist, 0);
string RoomNUMBER = CSRedisCacheHelper.HMGet<string>(5, CacheKey.RoomNumber_HostNumber, hostNumber)[0];
if (!string.IsNullOrEmpty(RoomNUMBER))
{
var code = Tools.HostNumberToHotelCode(hostNumber);
DeviceActionData d1 = new DeviceActionData();
d1.ts_ms = Tools.GetUnixTime();
d1.hotel_id = code.ToString();
d1.room_id = RoomNUMBER;
d1.device_id = hostNumber;
d1.frame_id = zhenhao;
d1.cmd_word = "0F";
//d1.udp_raw = Tools.ByteToString(data);
d1.udp_raw = data;
d1.direction = "下发";
List<ts_deviceitem> lll1 = new List<ts_deviceitem>();
List<ts_faultitem> lll2 = new List<ts_faultitem>();
List<ts_controlitem> lll3 = new List<ts_controlitem>();
int skip = 16;
for (int i = 1; i <= device_count; i++)
{
var t1 = data.Skip(skip + (i - 1) * 6).Take(6).ToArray();
ts_controlitem ts = new ts_controlitem();
ts.dev_addr = t1[0];
ts.dev_type = t1[1];
ts.dev_loop = t1[2];
ts.type_h = t1[3];
ts.type_l = BitConverter.ToInt16(new byte[] { t1[5], t1[4] }, 0);
lll3.Add(ts);
}
d1.control_list = lll3;
}
}
}
static void Main(string[] args)
{
byte[] ss111= Base64Url.Decode("qlUuAFQzU0E01oL4CIZhAQIABgAgAAAAAAAA/wICBwEAAAIbKgcCAAACGyp4Ig==");
var vv1= Tools.ByteToString(ss111);
#if AAA
Console.WriteLine("aaaaaaaaaaaaa");
#endif
var ggg= BitConverter.ToString(new byte[]{0xaa,0xcc});
AAA();
string aaa111 = "233003";
var bj1 = aaa111.Substring(0, 3);
var a1 = int.Parse(bj1);
var a2 = int.Parse(aaa111.Substring(3, 3));
var a3 = new byte[] { Convert.ToByte(a1), Convert.ToByte(a2) };
var uuua = BitConverter.ToUInt16(a3, 0);
BitArray bit_a = new BitArray(new byte[] { 0xAA });
bool bfa = bit_a.Get(0);
bool bfaa = bit_a.Get(1);
var DDD = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.ffffff");
Console.WriteLine(DDD);
var qqqhj = CSRedisCacheHelper.Get_Partition<HostModal_Cache>("HostModalStatusReceiver_13_000000001");
var qq223 = JsonConvert.DeserializeObject<HostModal_Cache>(File.ReadAllText("3.txt"));
RedisTest();
Data();
Console.ReadLine();
string uuawer = string.Concat("h", "eeeelll");
string QQQQSSS = File.ReadAllText("3.txt", Encoding.UTF8);
var FFF = JsonConvert.DeserializeObject<FCS_Response>(QQQQSSS);
JObject jsonObject = JObject.Parse(QQQQSSS);
var error = jsonObject.SelectToken("error");
var JJJ = FFF.data.FirstOrDefault();
if (JJJ != null)
{
string orderuuid = JJJ.job_uuid;
FCS_OrderData f = new FCS_OrderData();
f.OrderUUID = orderuuid;
f.PropertyID = "";
f.ItemType = "Clean";
f.OrderNo = JJJ.job_no;
f.ItemUUID = "";
f.LocationUUID = "";
f.HotelCode = "";
f.RoomNUMBER = "";
string fsa = Newtonsoft.Json.JsonConvert.SerializeObject(f);
//这个是 供轮循的时候调用使用
CSRedisCacheHelper.HMSet(3, 60 * 24, CacheKey.FCSOrder, "aaa", fsa);
//这个是供 取消订单的时候使用的
//这个只 支持 取消 清理
//logger.Error("记录入循环:"+orderuuid);
CSRedisCacheHelper.Set_PartitionWithTime(CacheKey.FCSRoom_Mapping_Order + "_" + "", orderuuid, 24 * 60, 3);
}
//string orderuuid = JJJ.job_uuid;
AskRoomStatusChangedReceiver h = new AskRoomStatusChangedReceiver();
RoomStatus vv = new RoomStatus();
vv.ID = 0x10;
h.SendRoomStatusSelfNew("123", "321", vv, new byte[] { 0xee, 0xff }, 0x70);
string NNU11232 = Guid.NewGuid().ToString("N");
List<A1> list112 = new List<A1>(){new A1{id="1",name="A"},
new A1(){id="2",name="B"}};
List<string> flattenedList = list112.SelectMany(a => new[] { a.id, a.name }).ToList();
string result3432432 = string.Join(",", flattenedList); // 输出 "1,A,2,B"
CSRedisCacheHelper.HMSet(5, "UUU", "1", "333333", "2", "3434342");
int afdfdsa = 1;
string fdfd = afdfdsa.ToString("000");
ssslist.Enqueue("aaaaaa");
string wer = "233003112125";
var nnha = Tools.HostNumberToHotelCode(wer);
bool isNumeric = wer.All(char.IsDigit);
byte Chaka = CSRedisCacheHelper.Get_Partition<byte>("NNNNNNNNNNN", 5);
CSRedisCacheHelper.HMSet(5, "A", "1", "333333");
CSRedisCacheHelper.HMSet(5, "A", "2", "2222222222");
CSRedisCacheHelper.HMSet(5, "A", "3", "1111111111111");
var nnafdssfd = CSRedisCacheHelper.HMGetAll(5, "A");
var nnafdssfd1 = CSRedisCacheHelper.HMGet<string>(5, "A", "3");
var bb = new byte[] { 0x00, 0x01, 0x02, 0x03 };
var KKKFFF = BitConverter.ToString(bb);
VVV vva = new VVV();
Console.WriteLine(vva.ddd);
uint yua = 30;
double ddaf = (double)yua / 1000;
double dddjkl = Math.Round(13.722);
System.Timers.Timer timer2 = new System.Timers.Timer(1000);//每20秒扫描一次
timer2.Elapsed += new ElapsedEventHandler(timer2_Elapsed); ;//定时同步PMS房态
timer2.Enabled = true;
timer2.AutoReset = true;
long lln = Tools.GetUnixTime();
DateTime nd = Tools.GetTimeFromUnixTime(lln);
// 小端数字节数组(低位在前,高位在后)
byte[] littleEndianBytes = { 0xE8, 0x03, 0x00, 0x00 }; // 表示1000
// 直接转换为intBitConverter会自动处理端序
int result = BitConverter.ToInt32(littleEndianBytes, 0);
JieXi();
DateTime ddd = GetNowPrecise();
string tii = ddd.ToString("yyyy-MM-dd HH:mm:ss.ffffff");
Console.WriteLine(tii);
Console.ReadLine();
List<GGG> lllus = new List<GGG>();
for (int i = 0; i < 10; i++)
{
GGG g = new GGG();
g.Name = i.ToString();
lllus.Add(g);
}
//Tuple<List<GGG>> lllaf = new Tuple<List<GGG>>(lllus);
List<GGG> newlist = lllus;
foreach (var item in lllus)
{
Task.Factory.StartNew(() =>
{
Console.WriteLine(item.Name);
});
}
Console.ReadLine();
System.Collections.Concurrent.ConcurrentQueue<string> NNA = new System.Collections.Concurrent.ConcurrentQueue<string>();
Task.Factory.StartNew(() =>
{
}).ContinueWith((mytask) =>
{
});
string ti = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.ffffff");
Console.WriteLine(ti);
byte[] b1 = new byte[] { 0x01, 0x02, 0x03, 0x04 };
byte[] b2 = new byte[] { 0x01, 0x02, 0x03, 0x04, 0x05 };
bool bbbnfm = b1.SequenceEqual<byte>(b2);
foreach (var name in Enum.GetNames(typeof(Domain.DeviceType)))
{
Console.WriteLine(name);
}
long lll = Tools.GetCurrentTimeStamp(DateTime.Now);
DateTime ddf = Tools.GetCurrentDateTime(lll);
var payload = new Dictionary<string, object>()
{
//{ "sub", "mr.x@contoso.com" },
//{ "exp", 1300819380 }
//iss发行人
//exp到期时间
//sub主题
//aud用户
//nbf在此之前不可用
//iat发布时间
//jtiJWT ID用于标识该JWT
};
var secretKey = Encoding.UTF8.GetBytes("#myemqtt123");
string token = Jose.JWT.Encode(payload, secretKey, JwsAlgorithm.HS256);
token = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiJtci54QGNvbnRvc28uY29tIiwiZXhwIjoxMzAwODE5MzgwfQ.nch1wu8T_rsT_bywCOm2W-qO2jcv69RsrrmpWU6fdDE";
//var MMU = Jose.JWT.DecodeBytes(token, secretKey, JwsAlgorithm.HS256);
//var NNN = Jose.JWT.Decode(token, secretKey);
//var n1 = Jose.JWT.Verify(token, secretKey);
var privateKey = new X509Certificate2("mycert.p12", "123456").PrivateKey;
string token3 = Jose.JWT.Encode(payload, privateKey, JwsAlgorithm.RS256);
Console.WriteLine(token);
GA gvb = new GA();
gvb.NNN = "fdfdf";
gvb.FFF = Fruit.Apple;
string qwerty = Newtonsoft.Json.JsonConvert.SerializeObject(gvb);
var QQR = Newtonsoft.Json.JsonConvert.DeserializeObject<GA>(qwerty);
var JK = new A { id = "1", name = "1" };
var JJ = new A { id = "1", name = "1" };
Console.WriteLine(JK.Equals(JJ));
List<A> lla = new List<A>() {
new A{id="1",name="1"},
new A{id="2",name="2"}
};
List<A> llb = new List<A>() {
new A{id="1",name="1"},
new A{id="3",name="3"},
};
var QQQ = llb.Except<A>(lla).ToList();
t = new System.Timers.Timer();
t.Interval = 1000;
t.Elapsed += new ElapsedEventHandler(t_Elapsed);
t.Start();
do
{
Console.WriteLine("输入时间");
string nnn = Console.ReadLine();
int a = int.Parse(nnn);
t.Interval = a;
} while (true);
//XmlDocument xmlDoc = new XmlDocument();
//XmlElement element = xmlDoc.CreateElement("item"); // 创建元素
//element.SetAttribute("id", "1"); // 设置属性
//element.InnerText = "示例文本"; // 设置文本内容
//xmlDoc.DocumentElement.AppendChild(element); // 将元素添加到根元素下
//xmlDoc.Save("example.xml"); // 保存XML文件
XElement xelement = new XElement("interface",
new XAttribute[]
{
new XAttribute("orderno",""),
new XAttribute("cost",""),
new XAttribute("roomtype",""),
new XAttribute("breakfast",""),
new XAttribute("occupancy",""),
new XAttribute("deposit","")
},
new XElement("item",
new XAttribute[]
{
new XAttribute("idtype", "1"),
new XAttribute("idcard", "1"),
new XAttribute("customer", "1"),
new XAttribute("sex", "1"),
new XAttribute("country", "1"),
new XAttribute("checkindate", "1"),
new XAttribute("checkoutdate", "1")
},
"示例文本")
);
string hhh = xelement.ToString();
List<int> lllg = new List<int>();
lllg = null;
lllg.DefaultIfEmpty();
double aaq = double.Parse("10.0");
int gh = Convert.ToInt32(aaq);
// 调用示例
string input = "15.0.1";
string output = NormalizeVersion(input); // 输出 "15.0.0"
// 添加调度任务
JobManager.AddJob(
// 调度业务
() => Console.WriteLine("5 minutes just passed."),
// 触发时间
s => s.ToRunEvery(5).Seconds()
);
//// 立即停止
//JobManager.Stop();
//// 在任务完成后等待或者停止
//JobManager.StopAndBlock();
Console.ReadLine();
for (int i = 0; i < 10000; i++)
{
Task.Factory.StartNew(() =>
{
Thread.Sleep(5000);
Console.WriteLine("iiiii");
});
}
Console.ReadKey();
string aaa = File.ReadAllText("1.txt", Encoding.UTF8);
aaa = aaa.Replace("\\\\\\", "\\");
int? bba1 = null;
Console.WriteLine(bba1);
bool bba = SmartRobotDisable();
ChuangWeiCommandData mmm = new ChuangWeiCommandData();
mmm.nlp_namespace = "hotelcontrol";
mmm.nlp_name = "LocalDDD";
mmm.query = "打开房灯";
mmm.resourcePackage = new PackageData()
{
skillSource = "智能家居",
domain = "iot",
aiState = 0,
voiceprint = "",
skillTitle = "",
tips = "你可以对我说,小度小度"
};
List<MessageData> c = new List<MessageData>();
MessageData mc = new MessageData();
mc.header = new header()
{
messageId = "3432423423",
name = "",
@namespace = "",
payloadVersion = "0.1.1"
};
mc.payload = new payload()
{
accessToken = "33434343",
appliance = new Appliance()
{
applianceId = "id",
additionalApplianceDetails = new Device()
{
deviceId = "lightid_0_01",
deviceName = "走廊灯",
deviceType = "LIGHT",
type = "Device"
}
}
};
c.Add(mc);
chuangweidata c12 = new chuangweidata();
c12.data = c;
mmm.nlp_cmd = c12;
var YU = Newtonsoft.Json.JsonConvert.SerializeObject(mmm);
Console.ReadKey();
}
static void timer2_Elapsed(object sender, ElapsedEventArgs e)
{
Console.WriteLine("111111111111");
}
public static bool SmartRobotDisable()
{
string st = "23:00";
string et = "08:00";
string[] st_a = st.Split(':');
string[] et_a = et.Split(':');
int h_st = int.Parse(st_a[0]);
int M_st = int.Parse(st_a[1]);
int h_et = int.Parse(et_a[0]);
int M_et = int.Parse(et_a[1]);
int y = DateTime.Now.Year;
int m = DateTime.Now.Month;
int d = DateTime.Now.Day;
int hh = DateTime.Now.Hour;
int mm = DateTime.Now.Minute;
int ss = DateTime.Now.Second;
var t1 = new DateTime(y, m, d, h_st, M_st, ss);
var t2 = new DateTime(y, m, d, h_et, M_et, ss);
bool ShiJian = false;
//正常逻辑
if (t2 >= t1)
{
var ti = DateTime.Now;
//如果当前时间大于 起 小于 至,就代表 确实是 禁用
if (ti >= t1 && ti <= t2)
{
ShiJian = true;
}
}
else
{
var ti = DateTime.Now;
var zero_ti = new DateTime(y, m, d, 23, 59, 59);
var zero_ti_0 = new DateTime(y, m, d, 0, 0, 0);
//var t3 = t2.AddDays(1);
//如果当前时间 小于0点
//或者说 当前时间 大于
if ((ti > t1 && ti < zero_ti) || ti >= zero_ti_0 && ti <= t2)
{
ShiJian = true;
}
}
return ShiJian;
}
static void t_Elapsed(object sender, ElapsedEventArgs e)
{
Console.WriteLine("1111111111111");
}
static void t_Elapsed1(object sender, ElapsedEventArgs e)
{
Console.WriteLine("22222222222222");
}
}
public class FFFA : IEquatable<FFFA>
{
public bool Equals(FFFA other)
{
throw new NotImplementedException();
}
}
public class Device
{
public string deviceType { get; set; }
public string type { get; set; }
public string deviceId { get; set; }
public string deviceName { get; set; }
}
public class Appliance
{
public string applianceId { get; set; }
public Device additionalApplianceDetails { get; set; }
}
public class header
{
public string messageId { get; set; }
public string @namespace { get; set; }
public string name { get; set; }
public string payloadVersion { get; set; }
}
public class payload
{
public string accessToken { get; set; }
public Appliance appliance { get; set; }
}
public class MessageData
{
public header header { get; set; }
public payload payload { get; set; }
}
public class chuangweidata
{
public List<MessageData> data { get; set; }
}
public class ChuangWeiCommandData
{
public string nlp_namespace { get; set; }
public string nlp_name { get; set; }
public string query { get; set; }
public chuangweidata nlp_cmd { get; set; }
public PackageData resourcePackage { get; set; }
}
public class PackageData
{
public string skillTitle { get; set; }
public string domain { get; set; }
public int aiState { get; set; }
public string voiceprint { get; set; }
public string skillSource { get; set; }
public string tips { get; set; }
}
}

View File

@@ -1,36 +0,0 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// 有关程序集的常规信息通过以下
// 特性集控制。更改这些特性值可修改
// 与程序集关联的信息。
[assembly: AssemblyTitle("ConsoleApplication2")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("ConsoleApplication2")]
[assembly: AssemblyCopyright("Copyright © 2025")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// 将 ComVisible 设置为 false 使此程序集中的类型
// 对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型,
// 则将该类型上的 ComVisible 特性设置为 true。
[assembly: ComVisible(false)]
// 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID
[assembly: Guid("0ecfb694-a7eb-4ecc-8809-4cb705cceb73")]
// 程序集的版本信息由下面四个值组成:
//
// 主版本
// 次版本
// 内部版本号
// 修订号
//
// 可以指定所有这些值,也可以使用“内部版本号”和“修订号”的默认值,
// 方法是按如下所示使用“*”:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]

View File

@@ -1,13 +0,0 @@
<?xml version="1.0"?>
<configuration>
<appSettings>
<add key="session_expire_minutes" value="5" />
<add key="redis_server_session" value="127.0.0.1:6379" />
<add key="redis_max_read_pool" value="1000" />
<add key="redis_max_write_pool" value="1000" />
<add key="monitor_log_expire_minutes" value="30" />
</appSettings>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/>
</startup>
</configuration>

View File

@@ -1,27 +0,0 @@
-----BEGIN RSA PRIVATE KEY-----
MIIEogIBAAKCAQEA1EvziSvbI3eETULroiF71wbYze4aO/yj5A2LN2seiRZNTLKe
lOnu4svMDwfpKizMfqYvXV9Z2NwUNdFsDd/FWl2Xfdravzwz4z5u8agQ4Qwd8fVT
naFY5DQLv+6l3nAI01eUxaKHER/FpHSZ48o8CpH/VtzqeS/bA5+LTyMODdETI0fb
futFQS4xUIjoifN2oeggL5grhk39udyKfnwc0WG6086yb9uzr39oA39vKJNKTQqL
cDiuLzooBBOq8YuKQ8qnuIt14SdxTrKmeHQ+azKlgPykzA/exTboORPAHpFk99tz
6vuMdJBgrx93wt+ljoM8uKV2/J/6CKAOQZzYUQIDAQABAoH/KS/oZQnHz28LO/IV
Gl9kp1MCEkcfeoPenWADTRJ7L3LO4b0bBx5bj6Sk8kWWoZgPadgpWEl8z5XjAI32
E2Wr5DGZh9FDSda5j7I30//HRoy97TNWBZRH//4Y9COuCnmx507BOOv58wM2/7D0
1OdnaVA/OZr34osQ8qMBZAO+YO9/HKXRQ5FUuq2R7AdSHsXoDeJHa8L1lK/62VT/
0XlSmyCpEiaoIrig/B64EeZQjdS70yFgWNlLUr8XDPK0dLtoucMW0tyi9rr+id0g
N/zhcMo1E5zxsoAQK+bJ5Whai1RItir9Xc8RCVDWHQl9RJ0V1HbHkyIeeLVyx6Nv
e7p9AoGBAPl2p1Sh46iGItr8nAu3b8Ri7WUV2KvGeGUBcmtjXUvxYD6OmYFl0bFA
urHzXxXZcuCS9+GZoTKxZThaOvT3eoqQ7mrX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xnCD0GSA6L/V0ZFrMNqBirrr5B241OesECvxIi
98bZ90h9+q/X5eMyOD35f8YTaEMpdnQCnawIwiHx06/0BfiTj+b/XQih+mqt3ZXe
xNCJqKexdiB2IWGSKcgahPacWkk/BAQFisKIFYEqHzV974S3FAz/8LIfD58xnsEN
GfzyIDkH3JrwYZ8caPTf6ZX9M1GrISN8HnWTtdNCH2xEajRa/h9ZBXjUyFKQrGk2
n2hcLrfZSbynEC/pSw/ET7H5nWwckjmAJ1l9fcnbqkU/pf6uMQmnfl0JQjJNSg==
-----END CERTIFICATE-----

Binary file not shown.

View File

@@ -788,7 +788,7 @@ namespace Dao.Implement
/// <returns></returns>
public IList<HostMappingData> LoadAllID_HostNumberMapping()
{
return base.LoadAll().Where(A => A.SysHotel.IsNewVersionProtocol == true && A.IsDeleted == false).Select(A => new HostMappingData() { Id = A.ID, HostNumber = A.HostNumber,RoomTypeId=A.RoomType.ID }).ToList();
return base.LoadAll().Where(A => A.IsDeleted == false).Select(A => new HostMappingData() { Id = A.ID, HostNumber = A.HostNumber,RoomTypeId=A.RoomType.ID }).ToList();
}

View File

@@ -1575,10 +1575,6 @@ namespace RCUHost.Implement
var VVV1 = string.Join("", KKK1);
var VVV2 = string.Join("", KKK2);
//StringBuilder sb = new StringBuilder();
//sb.Clear();
//sb.Append(VVV1);
//sb.Append(VVV2);
string sb = string.Concat(VVV1, VVV2);
string YiJingChuLiGuo = CacheKey.AllReadyDealWith0E_Prefix + "_" + HostNUMBER;
object data = MemoryCacheHelper.Get(YiJingChuLiGuo);

View File

@@ -137,6 +137,28 @@ namespace WebSite.Controllers
HttpContext.Cache.Remove(Key);
return Json(new { result = "success" }, JsonRequestBehavior.AllowGet);
}
public static string OldIOTServerUrl = "http://a.boonlive-rcu.com/";
public void ZhuanFa<T>(T reqData, string ActionMethod)
{
try
{
//string nsa = JsonConvert.SerializeObject(reqData);
logger.Error("进入转发" );
logger.Error("进入转发" + ActionMethod);
var client1 = new RestClient(OldIOTServerUrl);
var request1 = new RestRequest("iot/" + ActionMethod, Method.POST);
request1.AddJsonBody(reqData);
var QQQ = client1.Execute(request1);
string HHH = QQQ.Content;
//logger.Error("转发结果:" + HHH);
}
catch (Exception ex)
{
logger.Error("转发出错:" + ex.Message);
//return Json("语音机器人转发:"+ex.Message, JsonRequestBehavior.AllowGet);
}
}
/// <summary>
/// 小度对接
/// </summary>
@@ -164,10 +186,16 @@ namespace WebSite.Controllers
byte[] reqBody = new byte[Request.InputStream.Length];
Request.InputStream.Read(reqBody, 0, reqBody.Length);
string reqData = System.Text.Encoding.UTF8.GetString(reqBody);
string platformName = "小度音箱";
try
{
Domain.IoTXiaoDuEntity.Request.AppliancesRequest request = JsonConvert.DeserializeObject<Domain.IoTXiaoDuEntity.Request.AppliancesRequest>(reqData);//得到小度请求
if (NewOrOld.IsNew)
{
ZhuanFa<Domain.IoTXiaoDuEntity.Request.AppliancesRequest>(request, "XiaoDu");
}
if (string.IsNullOrEmpty(request.payload.cuid))
{
//logger.Error("设备cuid不能为空" + reqData + ",来自:" + GetClientIP());
@@ -606,7 +634,7 @@ namespace WebSite.Controllers
if (!is_online)
{
logger.Error(platformName + "当前访问酒店(" + host.SysHotel.Name + host.SysHotel.Code + ")客房rcu(" + host.RoomNumber + ")不在线");
return Json(ReturnXiaoDuError(request.header, "TargetOfflineError"), JsonRequestBehavior.AllowGet);//当技能检测到目标设备没有连接到设备云或者设备云不在线时会给DuerOS发送TargetOfflineError消息。
//return Json(ReturnXiaoDuError(request.header, "TargetOfflineError"), JsonRequestBehavior.AllowGet);//当技能检测到目标设备没有连接到设备云或者设备云不在线时会给DuerOS发送TargetOfflineError消息。
}
@@ -3906,6 +3934,7 @@ namespace WebSite.Controllers
byte[] reqBody = new byte[Request.InputStream.Length];
Request.InputStream.Read(reqBody, 0, reqBody.Length);
string reqData = System.Text.Encoding.UTF8.GetString(reqBody);
//logger.Error(reqData);
string g_requestid = "";
int g_hotelcode = 0;
@@ -3916,6 +3945,10 @@ namespace WebSite.Controllers
{
Domain.IoTAliGenieEntity.Request req = JsonConvert.DeserializeObject<Domain.IoTAliGenieEntity.Request>(reqData);//得到天猫精灵请求
if (NewOrOld.IsNew)
{
ZhuanFa<Domain.IoTAliGenieEntity.Request>(req, "aligenie");
}
if (string.IsNullOrEmpty(req.baseInfo.hotelId) || string.IsNullOrEmpty(req.baseInfo.roomNo))
{
@@ -4183,7 +4216,7 @@ namespace WebSite.Controllers
if (!is_online)
{
logger.Error(platformName + "当前访问酒店(" + host.SysHotel.Name + host.SysHotel.Code + ")客房rcu(" + host.RoomNumber + ")不在线");
return Json(ReturnAliGenieError("当前访问rcu主机不在线", req.baseInfo.requestId), JsonRequestBehavior.AllowGet);//当技能检测到目标设备没有连接到设备云或者设备云不在线时会给DuerOS发送TargetOfflineError消息。
//return Json(ReturnAliGenieError("当前访问rcu主机不在线", req.baseInfo.requestId), JsonRequestBehavior.AllowGet);//当技能检测到目标设备没有连接到设备云或者设备云不在线时会给DuerOS发送TargetOfflineError消息。
}
bool is_card_in = CheckGetPower(host);
@@ -5730,7 +5763,7 @@ namespace WebSite.Controllers
result.code = 0;
result.msg = "当前房间主机不在线,无法控制";
return Json(result, JsonRequestBehavior.AllowGet);
//return Json(result, JsonRequestBehavior.AllowGet);
}

View File

@@ -0,0 +1,12 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
namespace WebSite.Models
{
public class NewOrOld
{
public static bool IsNew = false;
}
}

View File

@@ -31,7 +31,7 @@
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\</OutputPath>
<DefineConstants>TRACE;DEBUG;SIMON</DefineConstants>
<DefineConstants>TRACE;DEBUG;SIMON;NEW;</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<AllowUnsafeBlocks>false</AllowUnsafeBlocks>
@@ -223,6 +223,7 @@
<Compile Include="Models\AppModels.cs" />
<Compile Include="Models\FCS.cs" />
<Compile Include="Models\HomeModels.cs" />
<Compile Include="Models\NewOrOld.cs" />
<Compile Include="Models\QianLiMa_PMS.cs" />
<Compile Include="Models\RoomServiceModels.cs" />
<Compile Include="Models\RoomStatusModels.cs" />