def _moveHall51DataBack(self, userId, gameId, clientId): try: flag = DaoGameDataHall.HGET(userId, 'userChipMoveGame') ftlog.info('_moveHall51DataBack', userId, gameId, flag) if flag > 0: # 当前用户登录过HALL51 chip, exp, charm, coupon = DaoGameDataHall.HMGET( userId, ['chip', 'exp', 'charm', 'coupon']) chip, exp, charm, coupon = ftstr.parseInts( chip, exp, charm, coupon) ftlog.info('_moveHall51DataBack data->', userId, gameId, chip, exp, charm, coupon) if charm > 0: self.incrCharm(userId, charm) if exp > 0: self.incrExp(userId, exp) if coupon > 0: trueDelta, finalCount = self.incrCoupon( userId, gameId, coupon, ChipNotEnoughOpMode.NOOP, 'SYSTEM_REPAIR', 0) ftlog.info('_moveHall51DataBack data coupon->', userId, gameId, coupon, trueDelta, finalCount) if chip > 0: trueDelta, finalCount = self.incrChip( userId, gameId, chip, ChipNotEnoughOpMode.NOOP, 'SYSTEM_REPAIR', 0) ftlog.info('_moveHall51DataBack data chip->', userId, gameId, chip, trueDelta, finalCount) DaoGameDataHall.HDEL( userId, ['chip', 'exp', 'charm', 'coupon', 'userChipMoveGame']) pluginCross.halldatanotify.sendDataChangeNotify( userId, gameId, 'chip') except: ftlog.error()
def getHallDataList(self, userId, keys): """ 取得用户的大厅数据内容(即游戏gamedata:9999:<userId>存储的数据内容) @param userId: 用户ID @param keys: 数据字段列表,如果为空,则获取所有信息, 请使用HallKeys中定义的KEY值 """ if isinstance(keys, (str, unicode)): ret = DaoGameDataHall.HGET(userId, keys) else: ret = DaoGameDataHall.HMGET(userId, keys) return ret
def incrPlayTime(self, userId, detalTime, gameId, roomId, tableId): """ 各个游戏向大厅汇报玩家的游戏时长 """ DaoGameDataHall.HINCRBY(userId, HallKeys.ATT_TOTAL_TIME, detalTime) datas = DaoGameDataHall.HGET(userId, HallKeys.ATT_TODAY_TIME) today = datetime.now().strftime('%Y%m%d')[-6:] if today in datas: datas[today] += detalTime else: datas[today] = detalTime oldday = (datetime.now() - timedelta(days=7)).strftime('%Y%m%d')[-6:] for k in datas.keys()[:]: if k < oldday: del datas[k] DaoGameDataHall.HSET(userId, HallKeys.ATT_TODAY_TIME, datas) return 1
def getSetNameSum(self, userId): return DaoGameDataHall.HGET(userId, HallKeys.ATT_SET_NAME_SUM)
def getBiggestHallVersion(self, userId): """ 取得用户登录过的最高客户端版本 """ return DaoGameDataHall.HGET(userId, HallKeys.ATT_BIGGEST_HALL5_VERSION)
def getLoginBeforeVersion511flag(self, userId): """ 判定该用户是否在5.11版本之前登录过 """ return DaoGameDataHall.HGET(userId, HallKeys.ATT_LOGIN_BEFORE_VERSION_TO_511)
def getUpdateToVersion511flag(self, userId): """ 判定该用户是否升级到5.11 """ return DaoGameDataHall.HGET(userId, HallKeys.ATT_UPDATE_CLIENT_VERSION_TO_511)
def isFirstGamelist5(self, userId): """ 判定该用户是否第一次使用gamelist5 """ return DaoGameDataHall.HGET(userId, HallKeys.ATT_FIRST_GAME_LIST5)
def getReliefShareDate(self, userId): ''' ''' return DaoGameDataHall.HGET(userId, HallKeys.ATT_RELIEF_SHARE_DATE)
def getBeneFitsInfo(self, userId): ''' ''' return DaoGameDataHall.HGET(userId, HallKeys.ATT_BENEFITS)
def getNewUserFlg(self, userId): ''' 删除新用户的标记(新用户标记,主要用与发放启动资金) ''' return DaoGameDataHall.HGET(userId, HallKeys.ATT_NEW_USER)
def isGetFirstRechargeReward(self, userId): """ 判定该用户是否首次充值奖励 """ return DaoGameDataHall.HGET(userId, HallKeys.ATT_FIRST_RECHARGE_REWARD)
def isFirstRecharged(self, userId): """ 判定该用户是否首次充值 """ return DaoGameDataHall.HGET(userId, HallKeys.ATT_FIRST_RECHARGE)