联网推进(修复尝试保存用户信息时错误)

This commit is contained in:
MrZ626
2021-04-10 21:07:26 +08:00
parent 9f56948f47
commit 1fe9d2598b

View File

@@ -138,21 +138,20 @@ function NET.getUserInfo(id,ifDetail)
}, },
}) })
end end
function NET.storeUserInfo(res) function NET.storeUserInfo(d)
local user=USERS[res.uid] local user=USERS[d.uid]
if not user then if not user then
user={} user={}
USERS[res.uid]=user USERS[d.uid]=user
end end
user.uid=res.uid user.uid=d.uid
user.email=res.email user.username=d.username
user.username=res.username user.motto=d.motto
user.motto=res.motto user.avatar=d.avatar
user.avatar=res.avatar
--Get own name --Get own name
if res.uid==USER.uid then if d.uid==USER.uid then
USER.username=res.username USER.username=d.username
FILE.save(USER,"conf/user","q") FILE.save(USER,"conf/user","q")
end end
@@ -301,7 +300,7 @@ function NET.updateWS_user()
NET.wsconn_play() NET.wsconn_play()
NET.unlock("accessToken") NET.unlock("accessToken")
elseif res.action==1 then--Get userInfo elseif res.action==1 then--Get userInfo
NET.storeUserInfo(res) NET.storeUserInfo(res.data)
end end
else else
WS.alert("user") WS.alert("user")