feat: 增加机器位置手动编辑功能及公开查看界面
This commit is contained in:
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user