Пример #1
0
    def get(self):
        r = self.get_argument('r', '')
        if not r:
            self.write('参数错误')
            return

        openid = utils.decrypt(r)

        user_agent = self.request.headers.get('User-Agent', '')
        platform = utils.get_platform(user_agent)
        # 判断用户系统是否已知
        user_info = users.get_info(openid)
        if not user_info['platform']:
            ip = self.request.remote_ip
            ip_address = IP.find(ip)
            users.set_ip(openid, ip, ip_address, platform)

        if user_info['status'] == -2:
            self.write("非法用户")
            return

        if platform == 2:
            url = urlparse.urljoin(constants.SITE_BASEURL, 'v1/applist/goandroid')
            self.redirect(url, False, 302)
            return

        aes = AESCipher()
        r = aes.encode(openid)
        url = 'http://w.ymapp.com/wx/ios/lists.html?r=%s' % r
        #url = 'http://au.youmi.net/wx/ios/lists.html?r=%s' % r
        self.redirect(url, False, 302)
Пример #2
0
 def text_handler(self, msg):
     """ 文本回调 """
     content = msg.get('Content', '')
     if 'iloveumlife' == content:
         aes = AESCipher(2)
         r = aes.encode(self.openid)
         url = 'http://w.ymapp.com/wx/aos/lists.html?r=%s' % r
         tt = '<a href="%s">传送门</a>' % url
         resp_content = self.parse_to_xml(msg, tt)
     else:
         resp_content = self.show_faq(msg)
     return resp_content