|
|
|
@ -1,9 +1,13 @@
|
|
|
|
|
using Autofac;
|
|
|
|
|
using Entity.DbModel.Station;
|
|
|
|
|
using HybirdFrameworkCore.Autofac;
|
|
|
|
|
using HybirdFrameworkCore.Autofac.Attribute;
|
|
|
|
|
using HybirdFrameworkCore.Redis;
|
|
|
|
|
using log4net;
|
|
|
|
|
using Newtonsoft.Json;
|
|
|
|
|
using Repository.Station;
|
|
|
|
|
using Service.Cloud.Msg;
|
|
|
|
|
using Service.Cloud.Msg.Host.Req;
|
|
|
|
|
using Service.Init;
|
|
|
|
|
|
|
|
|
|
namespace Service.Cloud.Client;
|
|
|
|
@ -14,6 +18,7 @@ public class CloudClientMgr
|
|
|
|
|
private static readonly ILog Log = LogManager.GetLogger(typeof(CloudClientMgr));
|
|
|
|
|
public static CloudClient? CloudClient { get; set; }
|
|
|
|
|
|
|
|
|
|
private static DateTime _dateTime = DateTime.Now.AddSeconds(-30);
|
|
|
|
|
public static void Init()
|
|
|
|
|
{
|
|
|
|
|
CloudClient = AppInfo.Container.Resolve<CloudClient>();
|
|
|
|
@ -36,7 +41,7 @@ public class CloudClientMgr
|
|
|
|
|
|
|
|
|
|
RedisHelper? redisHelper = AppInfo.Container.Resolve<RedisHelper>();
|
|
|
|
|
BinInfoRepository binInfoRepository = AppInfo.Container.Resolve<BinInfoRepository>();
|
|
|
|
|
/*redisHelper?.GetSubscriber().Subscribe("UploadTelemetryData", (channel, value) =>
|
|
|
|
|
redisHelper?.GetSubscriber().Subscribe("UploadTelemetryData", (channel, value) =>
|
|
|
|
|
{
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
@ -80,6 +85,13 @@ public class CloudClientMgr
|
|
|
|
|
ot = 0xFF,
|
|
|
|
|
bt = DateTime.Now
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
if ((DateTime.Now - _dateTime).TotalSeconds <= 30)
|
|
|
|
|
{
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
_dateTime = DateTime.Now;
|
|
|
|
|
CloudClient?.SendChargeDevDataInfo(req);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -88,6 +100,6 @@ public class CloudClientMgr
|
|
|
|
|
{
|
|
|
|
|
Log.Info("error", e);
|
|
|
|
|
}
|
|
|
|
|
});*/
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|