Files
tianrunCRM/Assets/trCRM/upgradeRes4Dev/priority/lua/db/DBStatistics.lua

67 lines
1.9 KiB
Lua
Raw Normal View History

2020-07-04 14:41:25 +08:00
DBStatistics = {}
local db = {}
local lastGetTime = {}
local timeOut = 60 * 1000
DBStatistics.clean = function()
end
2020-08-04 21:58:27 +08:00
DBStatistics.custtype_report = function(callback, force)
if
force or db.custtype_report == nil or lastGetTime.custtype_report == nil or
DateEx.nowMS - lastGetTime.custtype_report > 0
then
2020-07-04 14:41:25 +08:00
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
2020-08-04 21:58:27 +08:00
DBStatistics.order_report = function(callback, force)
if force or db.order_report == nil or lastGetTime.order_report == nil or DateEx.nowMS - lastGetTime.order_report > 0 then
2020-07-04 14:41:25 +08:00
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
2020-08-04 21:58:27 +08:00
DBStatistics.target_report = function(callback, force)
if
force or db.target_report == nil or lastGetTime.target_report == nil or
DateEx.nowMS - lastGetTime.target_report > 0
then
2020-07-04 14:41:25 +08:00
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