再次整理/简化网络请求相关代码

This commit is contained in:
MrZ626
2021-01-31 00:36:07 +08:00
parent 7c4b69753a
commit e170c16d02
11 changed files with 71 additions and 90 deletions

View File

@@ -11,13 +11,11 @@ local function task_fetchRooms(task)
coroutine.yield()
local response,request_error=client.poll(task)
if response then
if response.code==200 then
local res=json.decode(response.body)
if res.message=="OK"then
rooms=res.room_list
else
LOG.print(text.netErrorCode..response.code..": "..res.message,"warn")
end
local res=json.decode(response.body)
if response.code==200 and res.message=="OK"then
rooms=res.room_list
else
LOG.print(text.httpCode..response.code..": "..res.message,"warn")
end
return
elseif request_error then