onlineSrv.lua 591 B

1234567891011121314151617181920212223242526272829303132
  1. --[[
  2. Descripttion:追梦
  3. version:
  4. Author: Neo,Huang
  5. Date: 2023-11-16 21:45:09
  6. LastEditors: Neo,Huang
  7. LastEditTime: 2023-11-16 23:20:12
  8. --]]
  9. local timer = require("timer")
  10. local baseService = require("baseService")
  11. local serverLogUtil = require "utils.serverLogUtil"
  12. local timerOnlineLog = nil
  13. local root = {}
  14. -- 在线人数
  15. local function _online_log()
  16. serverLogUtil.logOnlineCount()
  17. end
  18. function root.onStart()
  19. timerOnlineLog = timer.timeOut(60, _online_log)
  20. end
  21. function root.onStop()
  22. -- 取消定时器
  23. timerOnlineLog.func = nil
  24. end
  25. baseService.start(root, ".onlineSrv", true)