Maison  >  Questions et réponses  >  le corps du texte

python - 已关注粉丝再次扫描微信带参数二维码报错

已关注粉丝再次扫描微信带参数二维码报错。
未关注粉丝扫描二维码时,正常。
第二次扫描时,提示“无法服务”

查后台nginx日志 两种场景均返回的为空,CODE 为200

@app.route("/",methods=["POST","GET","PUT"])
def index():
    if(request.method=="GET"): #验证微信
        signature=request.args.get('signature', None)
        timestamp=request.args.get('timestamp',None)
        nonce=request.args.get('nonce',None)
        echostr=request.args.get('echostr',"hello")
        # logging.info(echostr)
        return    echostr
    if(request.method=="POST"):
        soup=BeautifulSoup(request.data,"xml")
        logging.info("POST请求\n"+str(soup))
        MsgType=soup.MsgType.string
        if(MsgType=='event'):
            if(soup.Event.string=="SCAN" or soup.Event.string=="subscribe" ):
                key=soup.EventKey.string
                openid=soup.FromUserName.string
                logging.info("EventKey"+str(key))
                # 商店管理员扫描
                if(key.startswith("ownerid")):
                    key=key.split("ownerid")[1]
                    data={"openid":str(openid)}
                    res=requests.put("http://www.example.com/owner/"+key+"/",json=data)
                    return ''
                # 商店顾客扫描
                if(key.startswith("qrscene_")):
                    key=key.split("qrscene_")[1]
                data={"shopid":key}
                res=requests.put("http://www.example.com/customer/"+openid+"/",json=data)
                logging.info(str(res.json()))
                return ""
                    # WX.notify(soup.FromUserName.string)
        return ""
    return ""
迷茫迷茫2740 Il y a quelques jours571

répondre à tous(1)je répondrai

  • 阿神

    阿神2017-04-18 10:24:11

    Bonjour, avez-vous résolu ce problème ? Comment a-t-il été résolu ? Je rencontre également ce problème maintenant et je ne sais pas quoi faire. S'il vous plaît, aidez

    .

    répondre
    0
  • Annulerrépondre