diff --git a/resources/login_resources.py b/resources/login_resources.py index 035d26c..3a70e4a 100644 --- a/resources/login_resources.py +++ b/resources/login_resources.py @@ -69,7 +69,15 @@ class GetLoginWxQRCodeResource(Resource): app_id=loginfo.get('appId','') qr_code = gewe_chat.wxchat.get_login_qr_code(token_id, app_id,region_id) - base64_string = qr_code.get('qrImgBase64',None) + + if not qr_code: + msg=f"获取二维码失败,qr_code: {qr_code}" + gewe_chat.wxchat.release_login_lock(token_id) + logger.info(msg) + response=jsonify({'code': 501, 'message': msg}) + response.status_code = 501 + return response + uuid = qr_code.get('uuid',None) if not uuid: msg=f"uuid获取二维码失败,uuid: {uuid}" @@ -80,8 +88,10 @@ class GetLoginWxQRCodeResource(Resource): return response + app_id = app_id or qr_code.get('appId') - + + base64_string = qr_code.get('qrImgBase64',None) gewe_chat.wxchat.qrCallback(uuid,base64_string) hash_key = f"__AI_OPS_WX__:LOGININFO:{tel}" thread = threading.Thread(target=waitting_login_result, args=(gewe_chat.wxchat,token_id, app_id,region_id, agent_token_id,hash_key, uuid,now))