🐞fix: 修复子设备id(cs_index)参数冲突造成获取不到问题
This commit is contained in:
parent
ee5645f615
commit
528c2d5a33
Binary file not shown.
Binary file not shown.
@ -7,6 +7,7 @@ local sys = require("sys")
|
||||
local utils = require("utils")
|
||||
local config = require("config")
|
||||
local util_notify = require("util_notify")
|
||||
local led_helper = require("led_helper")
|
||||
|
||||
local uart_timeout = 100
|
||||
|
||||
@ -77,21 +78,19 @@ sys.subscribe("NEW_MSG", function(data)
|
||||
end
|
||||
local numbers = fskv.kv_get("numbers")
|
||||
-- log.info("air780_helper", "测试numbers", json.encode(numbers),type(numbers))
|
||||
local cs_index = air780_helper.cs_index - 1
|
||||
local this_cs_index = air780_helper.cs_index - 1
|
||||
if utils.is_empty(msg.sms) == false then
|
||||
air780_helper.reading = false
|
||||
msg.index = tostring(cs_index)
|
||||
msg.cs_index = tostring(this_cs_index)
|
||||
-- 是否屏蔽自检信息
|
||||
local disable_boot = fskv.kv_get("disable_boot")
|
||||
if disable_boot == 1 and msg.type == "boot" then
|
||||
return
|
||||
end
|
||||
-- 如果没有读到号码就是用设置的号码
|
||||
if utils.is_empty(msg.to) then
|
||||
if fskv.kv_get("numbers") then
|
||||
if numbers[cs_index] ~= nil then
|
||||
msg.to = numbers[cs_index]
|
||||
end
|
||||
if utils.is_empty(msg.to) and numbers[this_cs_index] ~= nil then
|
||||
if numbers[this_cs_index] ~= nil then
|
||||
msg.to = numbers[this_cs_index]
|
||||
end
|
||||
end
|
||||
if fskv.kv_get("hostname") then
|
||||
@ -104,6 +103,7 @@ sys.subscribe("NEW_MSG", function(data)
|
||||
msg.sms = "收到设备通知:" .. msg.sms
|
||||
msg.index = nil
|
||||
end
|
||||
log.info("air780_helper", "NEW_MSG", this_cs_index,air780_helper.cs_index)
|
||||
util_notify.add(msg)
|
||||
utils.clear_table(msg)
|
||||
msg = nil
|
||||
|
@ -39,8 +39,8 @@ local notify = {
|
||||
if utils.is_empty(msg.hostname) == false then
|
||||
text = text .. "- 设备名称:".. msg.hostname .."\n"
|
||||
end
|
||||
if utils.is_empty(msg.index) == false then
|
||||
text = text .. "- 子设备ID:".. msg.index .."\n"
|
||||
if utils.is_empty(msg.cs_index) == false then
|
||||
text = text .. "- 子设备ID:".. msg.cs_index .."\n"
|
||||
end
|
||||
if utils.is_empty(msg.from_time) == false then
|
||||
text = text .. "- 接收时间:".. msg.from_time .."\n"
|
||||
@ -90,8 +90,8 @@ local notify = {
|
||||
if utils.is_empty(msg.hostname) == false then
|
||||
text = text .. "设备名称:".. msg.hostname .."\n"
|
||||
end
|
||||
if utils.is_empty(msg.index) == false then
|
||||
text = text .. "设备ID:".. msg.index .."\n"
|
||||
if utils.is_empty(msg.cs_index) == false then
|
||||
text = text .. "设备ID:".. msg.cs_index .."\n"
|
||||
end
|
||||
if utils.is_empty(msg.from_time) == false then
|
||||
text = text .. "接收时间:".. msg.from_time .."\n"
|
||||
|
Loading…
Reference in New Issue
Block a user