json库使用方式调整
This commit is contained in:
@@ -118,19 +118,17 @@ function Tmr.load()
|
||||
VOC.play("welcome_voc")
|
||||
httpRequest(TICK.httpREQ_launch,"/tech/api/v1/app/info")
|
||||
if ACCOUNT.auth_token then
|
||||
local success,data=json.encode({
|
||||
local res=json.encode{
|
||||
email=ACCOUNT.email,
|
||||
auth_token=ACCOUNT.auth_token,
|
||||
})
|
||||
if not success then
|
||||
LOG.print(text.jsonError,"warn")
|
||||
else
|
||||
}
|
||||
if res then
|
||||
httpRequest(
|
||||
TICK.httpREQ_autoLogin,
|
||||
"/tech/api/v1/users",
|
||||
"GET",
|
||||
{["Content-Type"]="application/json"},
|
||||
data
|
||||
res
|
||||
)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -7,21 +7,19 @@ function keyDown.login(key)
|
||||
elseif #password==0 then
|
||||
LOG.print(text.noPassword)return
|
||||
end
|
||||
local success,data=json.encode({
|
||||
local res=json.encode{
|
||||
email=email,
|
||||
password=password,
|
||||
})
|
||||
if not success then
|
||||
LOG.print(text.jsonError,"warn")
|
||||
return
|
||||
}
|
||||
if res then
|
||||
httpRequest(
|
||||
TICK.httpREQ_newLogin,
|
||||
"/tech/api/v1/users",
|
||||
"GET",
|
||||
{["Content-Type"]="application/json"},
|
||||
res
|
||||
)
|
||||
end
|
||||
httpRequest(
|
||||
TICK.httpREQ_newLogin,
|
||||
"/tech/api/v1/users",
|
||||
"GET",
|
||||
{["Content-Type"]="application/json"},
|
||||
data
|
||||
)
|
||||
elseif key=="escape"then
|
||||
SCN.back()
|
||||
else
|
||||
|
||||
@@ -13,22 +13,20 @@ function keyDown.register(key)
|
||||
elseif password~=password2 then
|
||||
LOG.print(text.diffPassword)return
|
||||
end
|
||||
local success,data=json.encode({
|
||||
local res=json.encode{
|
||||
username=username,
|
||||
email=email,
|
||||
password=password,
|
||||
})
|
||||
if not success then
|
||||
LOG.print(text.jsonError,"warn")
|
||||
return
|
||||
}
|
||||
if res then
|
||||
httpRequest(
|
||||
TICK.httpREQ_register,
|
||||
"/tech/api/v1/users",
|
||||
"POST",
|
||||
{["Content-Type"]="application/json"},
|
||||
res
|
||||
)
|
||||
end
|
||||
httpRequest(
|
||||
TICK.httpREQ_register,
|
||||
"/tech/api/v1/users",
|
||||
"POST",
|
||||
{["Content-Type"]="application/json"},
|
||||
data
|
||||
)
|
||||
elseif key=="escape"then
|
||||
SCN.back()
|
||||
else
|
||||
|
||||
Reference in New Issue
Block a user