add
This commit is contained in:
60
Assets/trCRM/upgradeRes4Dev/priority/lua/db/DBStatistics.lua
Normal file
60
Assets/trCRM/upgradeRes4Dev/priority/lua/db/DBStatistics.lua
Normal file
@@ -0,0 +1,60 @@
|
||||
DBStatistics = {}
|
||||
local db = {}
|
||||
local lastGetTime = {}
|
||||
local timeOut = 60 * 1000
|
||||
|
||||
DBStatistics.clean = function()
|
||||
end
|
||||
|
||||
DBStatistics.custtype_report = function(callback)
|
||||
if db.custtype_report == nil or lastGetTime.custtype_report == nil or DateEx.nowMS - lastGetTime.custtype_report > 0 then
|
||||
lastGetTime.custtype_report = DateEx.nowMS + timeOut
|
||||
NetProto.send.custtype_report(
|
||||
nil,
|
||||
function(content)
|
||||
if content.success then
|
||||
db.custtype_report = content
|
||||
end
|
||||
callback(content)
|
||||
end
|
||||
)
|
||||
else
|
||||
Utl.doCallback(callback, db.custtype_report)
|
||||
end
|
||||
end
|
||||
|
||||
DBStatistics.order_report = function(callback)
|
||||
if db.order_report == nil or lastGetTime.order_report == nil or DateEx.nowMS - lastGetTime.order_report > 0 then
|
||||
lastGetTime.order_report = DateEx.nowMS + timeOut
|
||||
NetProto.send.order_report(
|
||||
nil,
|
||||
function(content)
|
||||
if content.success then
|
||||
db.order_report = content
|
||||
end
|
||||
callback(content)
|
||||
end
|
||||
)
|
||||
else
|
||||
Utl.doCallback(callback, db.order_report)
|
||||
end
|
||||
end
|
||||
|
||||
DBStatistics.target_report = function(callback)
|
||||
if db.target_report == nil or lastGetTime.target_report == nil or DateEx.nowMS - lastGetTime.target_report > 0 then
|
||||
lastGetTime.target_report = DateEx.nowMS + timeOut
|
||||
NetProto.send.target_report(
|
||||
nil,
|
||||
function(content)
|
||||
if content.success then
|
||||
db.target_report = content
|
||||
end
|
||||
callback(content)
|
||||
end
|
||||
)
|
||||
else
|
||||
Utl.doCallback(callback, db.target_report)
|
||||
end
|
||||
end
|
||||
|
||||
return DBStatistics
|
||||
Reference in New Issue
Block a user