feat: 增加机器位置手动编辑功能及公开查看界面

This commit is contained in:
2026-07-11 15:43:17 +08:00
parent becd8f0e20
commit 84dbdf58c4
13 changed files with 316 additions and 51 deletions
+20 -19
View File
@@ -1520,26 +1520,27 @@ local function backgroundSyncTask()
end
local function backgroundLocationSyncTask()
while true do
if gps and type(gps.locate) == "function" then
local x, y, z = gps.locate(2)
if x and y and z then
local label = os.getComputerLabel()
if not label or label == "" then label = "#" .. tostring(os.getComputerID()) end
local payload = {
device_id = label,
type = "Gate",
gate_mode = modeBySide and "bidirectional" or mode,
station_code = stationCodeForSide(nil) or "",
x = x,
y = y,
z = z
}
local serverBase = guessBaseFromStatusURL(serverURL)
pcall(postCheck, serverBase .. '/api/machine-location', payload)
end
sleep(5)
if gps and type(gps.locate) == "function" then
local x, y, z = gps.locate(2)
if x and y and z then
local label = os.getComputerLabel()
if not label or label == "" then label = "#" .. tostring(os.getComputerID()) end
local payload = {
device_id = label,
type = "Gate",
gate_mode = modeBySide and "bidirectional" or mode,
station_code = stationCodeForSide(nil) or "",
x = x,
y = y,
z = z
}
local serverBase = guessBaseFromStatusURL(serverURL)
pcall(postCheck, serverBase .. '/api/machine-location', payload)
end
sleep(60)
end
while true do
sleep(86400)
end
end