Exemple #1
0
 def onHallUserEventLogin(self, event):
     # 记录上线时间
     ct = fttime.formatTimeMs()
     DaoGameDataHall.HMSET(event.userId, {
         HallKeys.ATT_ALIVE_TIME: ct,
         HallKeys.ATT_AUTHOR_TIME: ct
     })
     # 登录天数加1
     if event.isDayfirst:
         DaoGameDataHall.HINCRBY(event.userId, HallKeys.ATT_LOGIN_DAYS, 1)
     # 登录次数加1
     DaoGameDataHall.HINCRBY(event.userId, HallKeys.ATT_LOGIN_SUM, 1)
Exemple #2
0
 def incrVipExp(self, userId, count):
     '''
     给用户增加count个经验值,count可以为负数
     @param userId: 哪个用户
     @param count: 数量
     @return: 变化后的值
     '''
     return DaoGameDataHall.HINCRBY(userId, HallKeys.ATT_VIP_EXP, count)
Exemple #3
0
 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
Exemple #4
0
 def getNewMsgId(self, userId):
     return DaoGameDataHall.HINCRBY(userId, HallKeys.ATT_MESSAGE_ID_MAX, 1)
Exemple #5
0
 def roulette_soldier_reward(self, userId):
     return DaoGameDataHall.HINCRBY(userId, HallKeys.ATT_GET_REWARD_NUM, 1)
Exemple #6
0
 def roulette_attend_soldier_lottery(self, userId):
     return DaoGameDataHall.HINCRBY(userId, HallKeys.ATT_CHECKIN_SOLDIERS,
                                    1)
Exemple #7
0
 def incrLoginSum(self, userId, deltaCount):
     return DaoGameDataHall.HINCRBY(userId, HallKeys.ATT_LOGIN_SUM,
                                    deltaCount)
Exemple #8
0
 def incrLoginDays(self, userId, deltaCount):
     return DaoGameDataHall.HINCRBY(userId, HallKeys.ATT_LOGIN_DAYS,
                                    deltaCount)
Exemple #9
0
 def incrSetNameSum(self, userId, detal):
     return DaoGameDataHall.HINCRBY(userId, HallKeys.ATT_SET_NAME_SUM,
                                    detal)
Exemple #10
0
 def add_share_count(self, userId, delta):
     return DaoGameDataHall.HINCRBY(userId, HallKeys.ATT_SHARE_COUNT, delta)