冷链平台服务处理

bzd_lkh 4eec3d1163 first commit 1 ay önce
MqttServer 4eec3d1163 first commit 1 ay önce
Nats 4eec3d1163 first commit 1 ay önce
Plugins 4eec3d1163 first commit 1 ay önce
TimeTask 4eec3d1163 first commit 1 ay önce
conf 4eec3d1163 first commit 1 ay önce
controllers 4eec3d1163 first commit 1 ay önce
lib 4eec3d1163 first commit 1 ay önce
logs 4eec3d1163 first commit 1 ay önce
models 4eec3d1163 first commit 1 ay önce
routers 4eec3d1163 first commit 1 ay önce
static 4eec3d1163 first commit 1 ay önce
tests 4eec3d1163 first commit 1 ay önce
views 4eec3d1163 first commit 1 ay önce
.gitignore 4eec3d1163 first commit 1 ay önce
Cold_mqtt 4eec3d1163 first commit 1 ay önce
README.md 4eec3d1163 first commit 1 ay önce
Z_Build.bat 4eec3d1163 first commit 1 ay önce
go.mod 4eec3d1163 first commit 1 ay önce
go.sum 4eec3d1163 first commit 1 ay önce
main.go 4eec3d1163 first commit 1 ay önce
run.sh 4eec3d1163 first commit 1 ay önce

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方案,在获取开机第一条数据时 不确定因素相对可控

3.1.2