예제 #1
0
def weixin_msg():
    logging.error("1.weixin: in weixin_msg ")
    if weixin.verification(request):
        logging.error("2.weixin verify done")
        data = request.data
        msg = weixin.parse_msg(data)
        if weixin.user_subscribe_event(msg):
            return weixin.help_info(msg)
        elif weixin.is_text_msg(msg):
            content = msg['Content']
            if content == u'?' or content == u'?':
                return weixin.help_info(msg)
            elif (content == u'm' or content == u'M' 
                 or content == u'money' or content == u'MONEY'
                 or content == u'Money'):
                return weixin.currency_info_AUDCNY_Pic(msg)
            elif (content == u'p' or content == u'P' 
                 or content == u'petrol' or content == u'PETROL'
                 or content == u'Petrol'):
                return weixin.petrol(msg)
            else:
                return weixin.help_info(msg)
        elif weixin.is_location_msg(msg):
            Label = msg['Label'] 
            return weixin.help_info(msg)
    return 'message processing fail'
예제 #2
0
def weixin_msg():
    logging.error("1.weixin: in weixin_msg ")
    if weixin.verification(request):
        logging.error("2.weixin verify done")
        data = request.data
        msg = weixin.parse_msg(data)
        if weixin.user_subscribe_event(msg):
            return weixin.help_info(msg)
        elif weixin.is_text_msg(msg):
            content = msg['Content']
            if content == u'?' or content == u'?':
                return weixin.help_info(msg)
            elif (content == u'n' or content == u'N' 
                 or content == u'new' or content == u'NEW'
                 or content == u'New'):
                posts = operatorDB.get_weixin_articles()
                rmsg = weixin.response_news_msg(msg, posts)
                logging.error("3.weixin get rmsg: %s"%rmsg)
                return rmsg
            else:
                return weixin.help_info(msg)
        elif weixin.is_location_msg(msg):
            Label = msg['Label'] 
            return weixin.help_info(msg)
    return 'message processing fail'
예제 #3
0
파일: app01.py 프로젝트: mabotech/maboss.py
def weixin_msg():
    
    log.debug( "post" )   
 
    log.debug(request.form)
    if verification(request):       
        
        data = request.data         
       
        msg = parse_msg(data)       
     
        rmsg = process(msg)
        
        return rmsg

    return 'message processing fail'
예제 #4
0
def yixin_access_verify():
    echostr = request.args.get('echostr')
    if weixin.verification(request) and echostr is not None:
        return echostr
    return 'access verification fail'