battlerecordSrv.lua 865 B

1234567891011121314151617181920212223242526272829303132333435
  1. --[[
  2. Descripttion:战斗记录
  3. version:
  4. Author: Neo,Huang
  5. Date: 2023-11-18 13:56:05
  6. LastEditors: Neo,Huang
  7. LastEditTime: 2023-11-18 13:57:08
  8. --]]
  9. local timer = require("timer")
  10. local baseService = require("baseService")
  11. local lib_game_mysql = require("lib_game_mysql")
  12. local timerDelExpire = nil
  13. local CMD = {}
  14. -- 清理过期追梦记录
  15. local function l_del_expire_record()
  16. local currTime = skynet_time()
  17. local sql = string.format("delete from mdl_battlerecord where expireTime >0 and expireTime < %s;", tostring(currTime))
  18. local ret = lib_game_mysql:query(sql)
  19. log.info("l_del_expire_record sql[%s] ret[%s]", tostring(sql), tostring(ret))
  20. end
  21. function CMD.onStart()
  22. timerDelExpire = timer.timeOut(60, l_del_expire_record)
  23. end
  24. function CMD.onStop()
  25. -- 取消定时器
  26. timerDelExpire.func = nil
  27. end
  28. baseService.start(CMD, ".battlerecordCenter", true)