def on_geo_response(self, companyid, appid, skillid, userid, account, name, grade, memo, geo_response): ip_parser = IpParserBaidu('') geo_info = ip_parser.doParse(geo_response.body) self.setGeoInfor(geo_info) ws_protocol = 'wss' if self.service_over_ssl() else 'ws' self.render("service/_chatbox.html", service_name='西山居游戏客服', companyid=companyid, appid=appid, skillid=skillid, userid='', welcome='欢迎来到西山居游戏客服中心!', hhost="%s://%s/customservice/ws" % (ws_protocol, self.request.host), comet_url="%s://%s/customservice/comet_cmd" % (self.get_protocol(), self.request.host))
def get(self, *args, **kwargs): cid = self.get_argument('cid', 'Xb') gid = self.get_argument('gid', 'default') cur_uuid = self.getHornerUUID() if cur_uuid is None or '' == cur_uuid: self.setHornerUUID() ip_parser = IpParserBaidu('182.139.133.135' if MODE_DEBUG else self.request.remote_ip) asynchronous_http_client = tornado.httpclient.AsyncHTTPClient() ip_infor_response = yield asynchronous_http_client.fetch(ip_parser.getRequestUrl()) self.on_query_ip_infor(cid, gid, ip_infor_response)
def on_query_ip_infor(self, cid, gid, response): ip_parser = IpParserBaidu('') geo_info = ip_parser.doParse(response.body) self.setGeoInfor(geo_info) ws_protocol = 'wss' if self.service_over_ssl() else 'ws' # 异步查看用户的信息 self.render("service/_demo_visitor.html", cid=cid, gid=gid, hhost="%s://%s/customservice/ws" % (ws_protocol, self.request.host), comet_url="%s://%s/customservice/comet" % (self.get_protocol(), self.request.host))
def get(self, *args, **kwargs): companyid, appid, skillid, userid, account, name, grade, memo = self.get_request_params( "companyid", "appid", "skillid", "userid", "account", "name", "grade", "memo" ) if skillid is None or '' == skillid: skillid = 'default' if self.check_request_params_valid(companyid, appid, userid): cur_uuid = self.getHornerUUID() if cur_uuid is None or '' == cur_uuid: self.setHornerUUID() ip_parser = IpParserBaidu('182.139.133.135' if MODE_DEBUG else self.request.remote_ip) asynchronous_http_client = tornado.httpclient.AsyncHTTPClient() ip_infor_response = yield asynchronous_http_client.fetch(ip_parser.getRequestUrl()) self.on_geo_response(companyid, appid, skillid, userid, account, name, grade, memo, ip_infor_response) else: self.write("params invalid") self.finish()