up
This commit is contained in:
@@ -6,15 +6,55 @@
|
||||
|
||||
DBUser = {}
|
||||
local db = {}
|
||||
local icons = {}
|
||||
local poplist = {}
|
||||
|
||||
|
||||
function DBUser.onGetUsers(list)
|
||||
poplist.options = ArrayList()
|
||||
poplist.values = ArrayList()
|
||||
for i, v in ipairs(list) do
|
||||
db[v.loginNo] = v
|
||||
poplist.options:Add(v.loginName)
|
||||
poplist.values:Add(v.loginNo)
|
||||
end
|
||||
end
|
||||
|
||||
function DBUser.getPopList()
|
||||
return poplist
|
||||
end
|
||||
|
||||
function DBUser.getUserById(loginNo)
|
||||
return db[loginNo]
|
||||
end
|
||||
|
||||
function DBUser.getIcon(loginNo, callback)
|
||||
---@type _DBUser
|
||||
local user = DBUser.getUserById(loginNo)
|
||||
if user == nil or isNilOrEmpty(user.imageUrl) then
|
||||
Utl.doCallback(callback, nil)
|
||||
return
|
||||
end
|
||||
if icons[user.imageUrl] then
|
||||
Utl.doCallback(callback, icons[user.imageUrl])
|
||||
return
|
||||
end
|
||||
WWWEx.get(
|
||||
user.imageUrl,
|
||||
nil,
|
||||
CLAssetType.texture,
|
||||
function(content, orgs)
|
||||
content.name = user.imageUrl
|
||||
icons[user.imageUrl] = content
|
||||
Utl.doCallback(callback, content)
|
||||
end,
|
||||
function()
|
||||
printe("取得头像失败")
|
||||
end,
|
||||
nil,
|
||||
true,
|
||||
2
|
||||
)
|
||||
end
|
||||
|
||||
return DBUser
|
||||
|
||||
Reference in New Issue
Block a user