def hasDailyData(userId, gameId, key): ''' 每日数据是否存在 :param userId: :param gameId: :param key: ''' dailyData = weakdata.getWeakData(userId, gameId, weakdata.CYCLE_TYPE_DAY, DAILY_DATA_KEY) return dailyData.has_key(key)
def getDailyData(userId, gameId, key, default=None): ''' 获取每日数据 :param userId: :param gameId: :param key: ''' dailyData = weakdata.getWeakData(userId, gameId, weakdata.CYCLE_TYPE_DAY, DAILY_DATA_KEY) return dailyData.get(key, default)
def _getTbData(userId): datas = weakdata.getWeakData(userId, DIZHU_GAMEID, weakdata.CYCLE_TYPE_DAY, 'treasurebox') if not 'tbroomid' in datas: datas['tbroomid'] = 0 if not 'tbplaytimes' in datas: datas['tbplaytimes'] = 0 if not 'tblasttime' in datas: datas['tblasttime'] = 0 ftlog.debug('_getTbData->userIds=', userId, datas) return datas
def setDailyData(userId, gameId, key, value): ''' 设置每日数据 :param userId: :param gameId: :param key: :param value: ''' dailyData = weakdata.getWeakData(userId, gameId, weakdata.CYCLE_TYPE_DAY, DAILY_DATA_KEY) dailyData[key] = value weakdata.setWeakData(userId, gameId, weakdata.CYCLE_TYPE_DAY, DAILY_DATA_KEY, dailyData)
def _getTbData(gameId, userId): data = weakdata.getWeakData(userId, gameId, weakdata.CYCLE_TYPE_DAY, 'treasurebox') if 'tbroomid' not in data: data['tbroomid'] = 0 if 'tbplaytimes' not in data: data['tbplaytimes'] = 0 if 'tblasttime' not in data: data['tblasttime'] = 0 if ftlog.is_debug(): ftlog.debug('treasurebox._getTbData', 'gameId=', gameId, 'userId=', userId, 'data=', data) return data
def getDay1stDatas(userId, gameId): return weakdata.getWeakData(userId, gameId, weakdata.CYCLE_TYPE_DAY, '1st')
def getDayFishDataAll(userId, gameId): """ 获取每日数据(每个自然日的0点数据会被清除) """ return weakdata.getWeakData(userId, gameId, weakdata.CYCLE_TYPE_DAY, "fish")
def getDayPoseidonDataAll(userId, gameId): """ 获取每日数据(海皇来袭专用) """ return weakdata.getWeakData(userId, gameId, weakdata.CYCLE_TYPE_DAY, "poseidon")
def getDayRobberyDataAll(userId, gameId): """ 获取每日数据(招财模式专用) """ return weakdata.getWeakData(userId, gameId, weakdata.CYCLE_TYPE_DAY, "robbery")
def getMonthFishDataAll(userId, gameId): """ 获取每月数据(每个自然月的首日0点数据会被清除) """ return weakdata.getWeakData(userId, gameId, weakdata.CYCLE_TYPE_MONTH, "fish")
def getWeekFishDataAll(userId, gameId): """ 获取每周数据(每个自然周的周一0点数据会被清除) """ return weakdata.getWeakData(userId, gameId, weakdata.CYCLE_TYPE_WEEK, "fish")