This commit is contained in:
2020-07-04 14:41:25 +08:00
parent 70c346d2c1
commit a8f02e4da5
3748 changed files with 587372 additions and 0 deletions

View 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