冷链平台服务处理

bzd_lkh 59b44cd0a2 关机无记录数据2 9 months ago
MqttServer 59b44cd0a2 关机无记录数据2 9 months ago
Nats ab9f0b826c first commit 10 months ago
Plugins ab9f0b826c first commit 10 months ago
TimeTask ab9f0b826c first commit 10 months ago
conf ab9f0b826c first commit 10 months ago
controllers ab9f0b826c first commit 10 months ago
lib ab9f0b826c first commit 10 months ago
logs ab9f0b826c first commit 10 months ago
models 7b75535cfd 记录数据多数据问题1 9 months ago
routers ab9f0b826c first commit 10 months ago
static ab9f0b826c first commit 10 months ago
tests ab9f0b826c first commit 10 months ago
views ab9f0b826c first commit 10 months ago
.gitignore ab9f0b826c first commit 10 months ago
Cold_mqtt ab9f0b826c first commit 10 months ago
README.md e3143b232b 国庆版 10 months ago
Z_Build.bat ab9f0b826c first commit 10 months ago
go.mod ab9f0b826c first commit 10 months ago
go.sum ab9f0b826c first commit 10 months ago
main.go ab9f0b826c first commit 10 months ago
run.sh ab9f0b826c first commit 10 months ago

README.md

#20240924 Warning 表 新增 字段
T_t float32 orm:"size(256);" // 温度 T_rh float32 orm:"size(256);" // 湿度 T_site string orm:"size(256);" // GPS T_sp int orm:"size(11);" // 传感器参数id

Warning 表 设置主键 T_tp 、T_sn 、T_id 、T_Ut

开机数据方案: 方案1:通过上电时间推算第一条数据

获取开机时间:
    1、MQTT上线事件(在网络异常时不准)
    2、获取设备上电推送信息(设备推送顺序无法确定)
第一条数据:
    1、缓存最近X分钟数据,排序数据时间,获取最接近开机时间一条数据(优点:相对准确,缺点:需要等待X时间后才会显示,还会出现有整点数据后 才有开机数据)
    2、取第一包数据,排序数据时间,获取最接近开机时间一条数据(优点:立即显示,缺点:不一定是真实的开机第一条数据)

方案2:根据上传的第一包中最小时间数据,查询缓存最新数据时间,判断是否大于保存周期,如果大于视为开机时间

优点:防止设备异常、网络异常 重启后多数据
缺点:设备推送顺序不确定时,在可能在两个周期时间期间插入开机数据

方案选择:暂选选择第2方案,在获取开机第一条数据时 不确定因素相对可控