This commit is contained in:
2026-07-10 14:55:42 +08:00
parent f65e043130
commit 230418079c
9 changed files with 46 additions and 12 deletions
+9 -1
View File
@@ -115,13 +115,21 @@ local function postJSON(url, payload)
end
end
local function currentDeviceId()
local label = os.getComputerLabel()
if label and label ~= "" then
return label
end
return "充值机#" .. tostring(os.getComputerID())
end
local function syncRefillResult(cardInfo, amount, balance)
local cardId = trim(cardInfo and cardInfo.cardId or "")
if #cardId == 0 then return false, "missing_card_id" end
local url = API_BASE .. "/ic-cards/" .. urlEncodeComponent(cardId) .. "/sync"
return postJSON(url, {
type = "topup",
device = "refill_machine",
device = currentDeviceId(),
amount = tonumber(amount) or 0,
balance = tonumber(balance) or 0,
result = "pass",