From 36ad8170748c6777bce0629692519f97d3942fd3 Mon Sep 17 00:00:00 2001 From: PandaX <18610165312@163.com> Date: Thu, 12 Oct 2023 20:07:19 +0800 Subject: [PATCH] =?UTF-8?q?=E3=80=90fix=E3=80=91=E8=AE=BE=E5=A4=87?= =?UTF-8?q?=E6=95=B0=E6=8D=AE=E4=BF=9D=E5=AD=98=E5=88=B0=E8=AE=BE=E5=A4=87?= =?UTF-8?q?=E5=BD=B1=E5=AD=90=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/device/api/device.go | 2 +- iothub/hook_message_work/hook_message_work.go | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/apps/device/api/device.go b/apps/device/api/device.go index ebe18e4..2ac17d5 100644 --- a/apps/device/api/device.go +++ b/apps/device/api/device.go @@ -112,7 +112,7 @@ func (p *DeviceApi) GetDeviceStatus(rc *restfulx.ReqCtx) { Type: tel.Type, Define: tel.Define, } - if v, ok := rs[strings.ToLower(tel.Key)]; ok { + if v, ok := rs[tel.Key]; ok { sdv.Value = v.Value sdv.Time = v.UpdatedAt } else { diff --git a/iothub/hook_message_work/hook_message_work.go b/iothub/hook_message_work/hook_message_work.go index cc77015..a1cea09 100644 --- a/iothub/hook_message_work/hook_message_work.go +++ b/iothub/hook_message_work/hook_message_work.go @@ -74,7 +74,6 @@ func (s *HookService) handleOne(msg *netbase.DeviceEventInfo) { global.Log.Error("规则链执行失败", errs) } // 保存设备影子 - log.Println(ruleMessage.Msg, msg.Type, msg.DeviceAuth) if msg.Type != message.RpcRequestMes { SetDeviceShadow(msg.DeviceAuth, ruleMessage.Msg, msg.Type) } @@ -172,11 +171,12 @@ func SetDeviceShadow(etoken *tool.DeviceAuth, msgVals map[string]interface{}, ms } if message.AttributesMes == msgType { err := shadow.DeviceShadowInstance.SetDevicePoint(etoken.Name, global.TslAttributesType, tel.Key, msgVals[tel.Key]) - biz.ErrIsNil(err, "设置设备影子点失败") + biz.ErrIsNilAppendErr(err, "设置设备影子点失败") } if message.TelemetryMes == msgType { + log.Println(etoken.Name, global.TslTelemetryType, tel.Key, msgVals[tel.Key]) err := shadow.DeviceShadowInstance.SetDevicePoint(etoken.Name, global.TslTelemetryType, tel.Key, msgVals[tel.Key]) - biz.ErrIsNil(err, "设置设备影子点失败") + biz.ErrIsNilAppendErr(err, "设置设备影子点失败") } } }