3
This commit is contained in:
+9
-1
@@ -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",
|
||||
|
||||
Reference in New Issue
Block a user