upgrade
This commit is contained in:
@@ -48,7 +48,7 @@ _FieldMode = {
|
||||
inputOnly = 0, -- 纯输入
|
||||
showOnly = 1, -- 纯展示模式
|
||||
modifyOnly = 2, -- 修改模式
|
||||
showAndModify = 3, -- 展示械式,同时也可以modify
|
||||
showAndModify = 3, -- 展示模式,同时也可以modify
|
||||
button = 4 -- 类似按钮的功能
|
||||
}
|
||||
|
||||
|
||||
@@ -96,6 +96,10 @@ DBOrder.onGetFilter = function(data)
|
||||
}
|
||||
end
|
||||
|
||||
DBOrder.getUploadPath = function()
|
||||
return db.filters.uploadPath
|
||||
end
|
||||
|
||||
DBOrder.getFilter = function(popGroup)
|
||||
if popGroup then
|
||||
return db.filters[popGroup]
|
||||
|
||||
@@ -45,6 +45,9 @@ DBRoot.funcs = {
|
||||
[NetProto.cmds.selectProductInfo] = function(data)
|
||||
DBOrder.onGetProducts(data.result)
|
||||
end,
|
||||
[NetProto.cmds.personal_data_query] = function(data)
|
||||
DBUser.onPersonalData(data.result[1])
|
||||
end
|
||||
}
|
||||
|
||||
DBRoot.onReceiveData = function(cmd, data)
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
DBTextures = {}
|
||||
local db = {}
|
||||
|
||||
local dbUploadStatus = {}
|
||||
local isUploading = {}
|
||||
|
||||
function DBTextures.init()
|
||||
InvokeEx.cancelInvoke(DBTextures.releaseTimeout)
|
||||
InvokeEx.invoke(DBTextures.releaseTimeout, 60)
|
||||
@@ -12,6 +15,15 @@ function DBTextures.clean()
|
||||
GameObject.DestroyImmediate(v)
|
||||
end
|
||||
db = {}
|
||||
|
||||
---@param v UnityEngine.UnityWebRequest
|
||||
for k, www in pairs(dbUploadStatus) do
|
||||
if www then
|
||||
www.Dispose()
|
||||
www = nil
|
||||
end
|
||||
end
|
||||
dbUploadStatus = {}
|
||||
end
|
||||
|
||||
function DBTextures.releaseTimeout()
|
||||
@@ -50,4 +62,41 @@ function DBTextures.getByUrl(url, callback, orgs)
|
||||
return request
|
||||
end
|
||||
|
||||
function DBTextures.upload(path, uploadPath, finishCallback)
|
||||
local key = joinStr(path, "_", uploadPath)
|
||||
if (not dbUploadStatus[key]) and (not isUploading[key]) then
|
||||
local www =
|
||||
NetProto.uploadFile(
|
||||
path,
|
||||
uploadPath,
|
||||
function(result, orgs)
|
||||
isUploading[key] = nil
|
||||
if result then
|
||||
dbUploadStatus[key] = result
|
||||
end
|
||||
Utl.doCallback(finishCallback, result)
|
||||
end
|
||||
)
|
||||
isUploading[key] = www
|
||||
return www
|
||||
else
|
||||
if dbUploadStatus[key] then
|
||||
Utl.doCallback(finishCallback, dbUploadStatus[key])
|
||||
else
|
||||
printe("进到这里来了,有问题!!!!!!!")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function DBTextures.cancelUpload(path, uploadPath)
|
||||
local key = joinStr(path, "_", uploadPath)
|
||||
local www = isUploading[key]
|
||||
if www then
|
||||
www.Dispose()
|
||||
www = nil
|
||||
dbUploadStatus[key] = nil
|
||||
isUploading[key] = nil
|
||||
end
|
||||
end
|
||||
|
||||
return DBTextures
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
---@field loginName
|
||||
---@field groupId
|
||||
---@field imageUrl string 头像
|
||||
|
||||
DBUser = {}
|
||||
local db = {}
|
||||
local icons = {}
|
||||
@@ -65,6 +64,24 @@ function DBUser.getPopList(group)
|
||||
return poplist[group]
|
||||
end
|
||||
|
||||
function DBUser.refreshUserInfor(loginNo, loginName)
|
||||
local infor = DBUser.getPopList(DBUser.FilterGroup.user)
|
||||
for i, v in ipairs(infor.values) do
|
||||
if v == loginNo then
|
||||
infor.options[i] = loginName
|
||||
break
|
||||
end
|
||||
end
|
||||
|
||||
local list = DBUser.getFilters(DBUser.FilterGroup.user)
|
||||
for i, v in ipairs(list) do
|
||||
if v.value == loginNo then
|
||||
v.name = loginNo
|
||||
break
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
---@return _DBUser
|
||||
function DBUser.getUserById(loginNo)
|
||||
local user = db[loginNo]
|
||||
@@ -108,6 +125,7 @@ function DBUser.hadPermission(key)
|
||||
return rolePermission[key] or false
|
||||
end
|
||||
|
||||
---public 是否白名单
|
||||
function DBUser.isWhiteUser(userName, callback)
|
||||
if isNilOrEmpty(userName) then
|
||||
Utl.doCallback(callback, false)
|
||||
@@ -135,5 +153,43 @@ function DBUser.isWhiteUser(userName, callback)
|
||||
return DBUser.whiteNames[userName]
|
||||
end
|
||||
end
|
||||
---public 包装我的个人信息
|
||||
function DBUser.wrapMyinforData(myinfor)
|
||||
local currGroup = Prefs.getCurrGroup(Prefs.getUserName())
|
||||
local companyInfro = json.decode(currGroup)
|
||||
local user = DBUser.getUserById(companyInfro.login_no)
|
||||
myinfor.company_id = companyInfro.company_id
|
||||
myinfor.company_name = companyInfro.company_name
|
||||
myinfor.phoneNo = Prefs.getUserName()
|
||||
if user then
|
||||
myinfor.loginNo = user.loginNo
|
||||
myinfor.imageUrl = user.imageUrl
|
||||
end
|
||||
return myinfor
|
||||
end
|
||||
|
||||
function DBUser.onPersonalData(result)
|
||||
db.myinfor = result
|
||||
local currGroup = Prefs.getCurrGroup(Prefs.getUserName())
|
||||
local companyInfro = json.decode(currGroup)
|
||||
DBUser.refreshUserInfor(companyInfro.login_no, db.myinfor.loginName)
|
||||
local user = DBUser.getUserById(companyInfro.login_no)
|
||||
if user then
|
||||
-- 刷新数据
|
||||
user.loginName = db.myinfor.loginName
|
||||
user.imageUrl = db.myinfor.imageUrl
|
||||
Prefs.setUserName(db.myinfor.phoneNo)
|
||||
end
|
||||
db.myinfor = DBUser.wrapMyinforData(db.myinfor)
|
||||
end
|
||||
|
||||
---public 取得我的个人信息
|
||||
function DBUser.getMyInfor()
|
||||
if db.myinfor == nil then
|
||||
db.myinfor = DBUser.wrapMyinforData({})
|
||||
NetProto.send.personal_data_query()
|
||||
end
|
||||
return db.myinfor
|
||||
end
|
||||
|
||||
return DBUser
|
||||
|
||||
Reference in New Issue
Block a user