🐞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 utils = require("utils")
|
||||||
local config = require("config")
|
local config = require("config")
|
||||||
local util_notify = require("util_notify")
|
local util_notify = require("util_notify")
|
||||||
|
local led_helper = require("led_helper")
|
||||||
|
|
||||||
local uart_timeout = 100
|
local uart_timeout = 100
|
||||||
|
|
||||||
@ -77,21 +78,19 @@ sys.subscribe("NEW_MSG", function(data)
|
|||||||
end
|
end
|
||||||
local numbers = fskv.kv_get("numbers")
|
local numbers = fskv.kv_get("numbers")
|
||||||
-- log.info("air780_helper", "测试numbers", json.encode(numbers),type(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
|
if utils.is_empty(msg.sms) == false then
|
||||||
air780_helper.reading = false
|
air780_helper.reading = false
|
||||||
msg.index = tostring(cs_index)
|
msg.cs_index = tostring(this_cs_index)
|
||||||
-- 是否屏蔽自检信息
|
-- 是否屏蔽自检信息
|
||||||
local disable_boot = fskv.kv_get("disable_boot")
|
local disable_boot = fskv.kv_get("disable_boot")
|
||||||
if disable_boot == 1 and msg.type == "boot" then
|
if disable_boot == 1 and msg.type == "boot" then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
-- 如果没有读到号码就是用设置的号码
|
-- 如果没有读到号码就是用设置的号码
|
||||||
if utils.is_empty(msg.to) then
|
if utils.is_empty(msg.to) and numbers[this_cs_index] ~= nil then
|
||||||
if fskv.kv_get("numbers") then
|
if numbers[this_cs_index] ~= nil then
|
||||||
if numbers[cs_index] ~= nil then
|
msg.to = numbers[this_cs_index]
|
||||||
msg.to = numbers[cs_index]
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
if fskv.kv_get("hostname") then
|
if fskv.kv_get("hostname") then
|
||||||
@ -104,6 +103,7 @@ sys.subscribe("NEW_MSG", function(data)
|
|||||||
msg.sms = "收到设备通知:" .. msg.sms
|
msg.sms = "收到设备通知:" .. msg.sms
|
||||||
msg.index = nil
|
msg.index = nil
|
||||||
end
|
end
|
||||||
|
log.info("air780_helper", "NEW_MSG", this_cs_index,air780_helper.cs_index)
|
||||||
util_notify.add(msg)
|
util_notify.add(msg)
|
||||||
utils.clear_table(msg)
|
utils.clear_table(msg)
|
||||||
msg = nil
|
msg = nil
|
||||||
|
@ -39,8 +39,8 @@ local notify = {
|
|||||||
if utils.is_empty(msg.hostname) == false then
|
if utils.is_empty(msg.hostname) == false then
|
||||||
text = text .. "- 设备名称:".. msg.hostname .."\n"
|
text = text .. "- 设备名称:".. msg.hostname .."\n"
|
||||||
end
|
end
|
||||||
if utils.is_empty(msg.index) == false then
|
if utils.is_empty(msg.cs_index) == false then
|
||||||
text = text .. "- 子设备ID:".. msg.index .."\n"
|
text = text .. "- 子设备ID:".. msg.cs_index .."\n"
|
||||||
end
|
end
|
||||||
if utils.is_empty(msg.from_time) == false then
|
if utils.is_empty(msg.from_time) == false then
|
||||||
text = text .. "- 接收时间:".. msg.from_time .."\n"
|
text = text .. "- 接收时间:".. msg.from_time .."\n"
|
||||||
@ -90,8 +90,8 @@ local notify = {
|
|||||||
if utils.is_empty(msg.hostname) == false then
|
if utils.is_empty(msg.hostname) == false then
|
||||||
text = text .. "设备名称:".. msg.hostname .."\n"
|
text = text .. "设备名称:".. msg.hostname .."\n"
|
||||||
end
|
end
|
||||||
if utils.is_empty(msg.index) == false then
|
if utils.is_empty(msg.cs_index) == false then
|
||||||
text = text .. "设备ID:".. msg.index .."\n"
|
text = text .. "设备ID:".. msg.cs_index .."\n"
|
||||||
end
|
end
|
||||||
if utils.is_empty(msg.from_time) == false then
|
if utils.is_empty(msg.from_time) == false then
|
||||||
text = text .. "接收时间:".. msg.from_time .."\n"
|
text = text .. "接收时间:".. msg.from_time .."\n"
|
||||||
|
Loading…
Reference in New Issue
Block a user