1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556 |
- --[[
- Descripttion:活跃玩家
- version:
- Author: Neo,Huang
- Date: 2021-08-31 17:38:42
- LastEditors: Neo,Huang
- LastEditTime: 2021-08-31 17:38:43
- --]]
- local timeUtil = require "utils.timeUtil"
- local lib_game_redis = require("lib_game_redis")
- local root = {}
- ----------------------------------------
- -- 活跃
- ----------------------------------------
- local function get_active_key(date)
- local time = date or timeUtil.currentTime()
- return "active:uid:" .. timeUtil.toDate(time)
- end
- -- 增加当天活跃玩家ID
- function root.add_active_player(uid)
- local key = get_active_key()
- lib_game_redis:sadd(key, uid)
- end
- -- 获取活跃玩家ID列表
- function root.get_active_uid_list(date)
- local key = get_active_key(date)
- return lib_game_redis:smembers(key)
- end
- ----------------------------------------
- -- 被动活跃
- ----------------------------------------
- local function get_inactive_key(date)
- local time = date or timeUtil.currentTime()
- return "inactive:" .. timeUtil.toDate(time)
- end
- -- 增加当天被活跃玩家ID
- function root.add_inactive_player(uid)
- local key = get_inactive_key()
- lib_game_redis:sadd(key, uid)
- end
- -- 获取活跃玩家ID列表
- function root.get_inactive_uid_list(date)
- local key = get_inactive_key(date)
- return lib_game_redis:smembers(key)
- end
- -- 删除被活跃玩家列表
- function root.del_inactive_uid_list(date)
- local key = get_inactive_key(date)
- lib_game_redis:del(key)
- end
- return root
|