def token_time_out(self): ''' 获取post请求内容 :return: ''' token = self.get_argument('token') Relay.token_time_out(token) return
def get(self): remote_ip = self.request.remote_ip if remote_ip != '127.0.0.1': return # join_time = int(time.time()) Relay.add_admin(self.random_string()) admin_dict = Relay.get_admin_dict() print('admin_dict', admin_dict, 'from gen_test', id(admin_dict)) # print('admin_dict',,'from gen_test') res = {'result': self.cal(), 'gevent_id': get_event_id()} self.send_ok(res) return
def logout(self, character): ''' 获取post请求内容 :return: ''' token = self.get_token() if token == '' or token is None: print('没有携带token') return user_id = Relay.get_user_id_by_token(token, character) if user_id == None: return res = Relay.logout(user_id, character) return res
def create_token(self, user_id, table_name): ''' 创建token :param user_id: :param table_name: :return: ''' nonce_string = common.create_rand_string(12) + str(time.time()) token = get_md5(nonce_string) params = {'token': token} Data.update(table_name, [('id', '=', user_id)], params) if table_name == 'admin': Relay.admin_login(user_id, token) if table_name == 'player': Relay.player_login(user_id, token) return token
def admin_logout(self): ''' 获取post请求内容 :return: ''' token = self.get_argument('token') res = Relay.admin_logout(token) return res
def is_god(self): ''' 获取用户基本信息 :return: ''' token = self.get_argument('token') res = Relay.is_god(token) return res
def get_player_base(self): ''' 获取用户基本信息 :return: ''' # self.token_time_out() token = self.get_argument('token') res = Relay.get_player_base(token) return res
def is_god(self): ''' 获取用户基本信息 :return: ''' token = self.get_token() if token == '' or token is None: print('没有携带token') return res = Relay.is_god(token) return res
def get_user_base(self, character): ''' 获取用户基本信息 :return: ''' token = self.get_token() if token is None: print('没有携带token') return res = Relay.get_user_base(token, character) return res
def player_logout(self): ''' 获取post请求内容 :return: ''' token = self.get_argument('token') if token == '' or token is None: print('没有携带token') return res = Relay.player_logout(token) return res
def get_admin_base(self): ''' 获取用户基本信息 :return: ''' # self.token_time_out() token = self.get_argument('token') if token == '' or token is None: print('没有携带token') return res = Relay.get_admin_base(token) return res
def get(self): res = Relay.get_token_dict('admin') print(res) self.send_ok(res) return
def __init__(self, host, port): self._host = host self._port = port self._apps = self.register_handles() Relay.server_init(self)
def login(self, user_id, character): res = Relay.login(user_id, character) return res
def __init__(self, host, port): ServerBase.__init__(self, host, port) Relay.init(self)