def get_commander_rank_key(self): """ 统帅能力排行 :return: """ if self.commander_rank_key is None: server_name = settings.get_father_server(self._server_name) self.commander_rank_key = self.make_key_cls( self.COMMANDER_RANK_KEY_PREFIX, server_name) return self.commander_rank_key
def get_father_redis(self, key=''): """如果合服,获取合服后的redis """ if not key: key = self.uid if not getattr(self, "_server_name", None): self._server_name = self.get_server_name(self.uid) father_server_name = settings.get_father_server(self._server_name) return self.get_redis_client(key, father_server_name)
def get_like_rank_key(self): """ 点赞排行 :return: """ if self.like_rank_key is None: server_name = settings.get_father_server(self._server_name) self.like_rank_key = self.make_key_cls(self.LIKE_RANK_KEY_PREFIX, server_name) return self.like_rank_key
def get_world_regain_rank_key(self): """ 世界收复排行 :return: """ if self.world_regain_rank_key is None: server_name = settings.get_father_server(self._server_name) self.world_regain_rank_key = self.make_key_cls( self.WORLD_REGAIN_RANK_KEY_PREFIX, server_name) return self.world_regain_rank_key
def get_equipment_rank_key(self): """ 装备强度排行 :return: """ if self.equipment_rank_key is None: server_name = settings.get_father_server(self._server_name) self.equipment_rank_key = self.make_key_cls( self.EQUIPMENT_RANK_KEY_PREFIX, server_name) return self.equipment_rank_key
def get_combat_rank_key(self): """ 获取战力排行榜的key :return: """ if self.combat_rank_key is None: server_name = settings.get_father_server(self._server_name) self.combat_rank_key = self.make_key_cls( self.COMBAT_RANK_KEY_PREFIX, server_name) return self.combat_rank_key
def get_level_rank_key(self): ''' 获取等级排行的key :return: ''' if self.level_rank_key is None: server_name = settings.get_father_server(self._server_name) self.level_rank_key = self.make_key_cls(self.LEVEL_RANK_KEY_PREFIX, server_name) return self.level_rank_key
def get(cls, uid="", server_name=""): """ 重载父类get """ if not server_name: raise TypeError('ERROR, NEED SERVER_NAME') father_server_name = settings.get_father_server(server_name) if settings.is_combined(server_name): # 该服有合服 # if is_combined_server_changed(father_server_name): pass return cls.get_obj(server_name=father_server_name)
def init_info(self, uid, guild_id, game_id, vip, domain, team_id, ip, sid, device_mark, device_mem): """ 初始化数据 :param uid: 用户uid :param guild_id: 联盟id :param game_id: 工会战聊天id :return: """ self.uid = uid self.guild_id = guild_id self.game_id = game_id self.server_name = settings.get_father_server(uid[:-7]) # uid[:-7] self.buffer = '' self.domain = domain self.vip = int(vip) self.team_id = team_id self.ip = ip self.device_mem = device_mem self.sid = sid self.device_mark = device_mark
def get(cls, uid, server_name='', **kwargs): o = super(User, cls).get(uid, server_name=server_name, **kwargs) o.father_server_name = settings.get_father_server(o._server_name) o.config_type = game_config.get_config_type(o.father_server_name) return o
def which_queue(server): server = settings.get_father_server(server) return 'celery_' + server