整理代码

新增没做完的公告页面
因为一些神秘token问题连接失败后会要求重新登录
This commit is contained in:
MrZ_26
2023-01-23 02:14:10 +08:00
parent ee4fd51e0f
commit f212076604
4 changed files with 64 additions and 7 deletions

View File

@@ -134,7 +134,7 @@ function NET.login(auto)
if USER.aToken then
local res=getMsg({
pool='login',
url='cafuuchino1.3322.org:8081',
url=AUTHHOST,
path='/studio26f/api/v1/auth/check',
headers={["x-access-token"]=USER.aToken},
},6.26)
@@ -163,7 +163,7 @@ function NET.getUserInfo(uid)
TASK.new(function()
local res=getMsg({
pool='getInfo',
url='cafuuchino1.3322.org:8081',
url=AUTHHOST,
path='/studio26f/api/v1/player/info?playerId='..uid,
},6.26)
@@ -176,7 +176,7 @@ function NET.getAvatar(uid)
TASK.new(function()
local res=getMsg({
pool='getInfo',
url='cafuuchino1.3322.org:8081',
url=AUTHHOST,
path='/studio26f/api/v1/player/avatar?playerId='..uid,
},6.26)
@@ -185,6 +185,20 @@ function NET.getAvatar(uid)
end
end)
end
function NET.getNotice(lang,count)
WAIT{timeout=6.26}
TASK.new(function()
local res=getMsg({
pool='getNotice',
path='/techmino/api/v1/notice?language='..(lang or 'zh_cn')..'&lastCount='..(count or 5),
},6.26)
if res and res.code==200 and type(res.data)=='string' then
local dataStr=""
SCN.go('notice',nil,dataStr)
end
end)
end
--------------------------<NEW WS API>
local actMap={
global_getOnlineCount= 1000,
@@ -560,6 +574,8 @@ function NET.ws_update()
while true do
TEST.yieldT(1/26)
if WS.status('game')=='dead' then
USER.aToken=false
USER.oToken=false
TEST.yieldUntilNextScene()
GAME.playing=false
SCN.backTo('main')