✨ 通知内容中增加流量统计, 默认不开启
This commit is contained in:
parent
8faac3a374
commit
6f913a2d0f
@ -275,6 +275,23 @@ local function append()
|
|||||||
msg = msg .. "\n频段: B" .. band
|
msg = msg .. "\n频段: B" .. band
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- 流量统计
|
||||||
|
local uplinkGB, uplinkB, downlinkGB, downlinkB = mobile.dataTraffic()
|
||||||
|
uplinkB = uplinkGB * 1024 * 1024 * 1024 + uplinkB
|
||||||
|
downlinkB = downlinkGB * 1024 * 1024 * 1024 + downlinkB
|
||||||
|
local function formatBytes(bytes)
|
||||||
|
if bytes < 1024 then
|
||||||
|
return bytes .. "B"
|
||||||
|
elseif bytes < 1024 * 1024 then
|
||||||
|
return string.format("%.2fKB", bytes / 1024)
|
||||||
|
elseif bytes < 1024 * 1024 * 1024 then
|
||||||
|
return string.format("%.2fMB", bytes / 1024 / 1024)
|
||||||
|
else
|
||||||
|
return string.format("%.2fGB", bytes / 1024 / 1024 / 1024)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
-- msg = msg .. "\n流量: ↑" .. formatBytes(uplinkB) .. " ↓" .. formatBytes(downlinkB)
|
||||||
|
|
||||||
-- 位置
|
-- 位置
|
||||||
local _, _, map_link = util_location.get()
|
local _, _, map_link = util_location.get()
|
||||||
if map_link ~= "" then
|
if map_link ~= "" then
|
||||||
|
Loading…
Reference in New Issue
Block a user