This commit is contained in:
2020-07-10 13:22:24 +08:00
parent 8c154e38ba
commit 9549990b66
108 changed files with 5668 additions and 888 deletions

View File

@@ -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