from flask_restful import Resource, reqparse from flask import jsonify,request,json from common import redis_helper,utils from wechat import gewe_chat class GetLoginInfoResource(Resource): def __init__(self): self.parser = reqparse.RequestParser() self.wxchat = gewe_chat.wxchat def post(self): req = request.get_json() tel = req.get("tel") config=self.wxchat.get_login_info_from_cache(tel) return jsonify(config) class LoginWxCaptchCodeResource(Resource): def __init__(self): self.parser = reqparse.RequestParser() self.wxchat = gewe_chat.wxchat def post(self): req = request.get_json() token_id = req.get("token_id") captch_code= req.get("captch_code") res=self.wxchat.save_login_wx_captch_code_to_cache(token_id,captch_code) return jsonify(res) class GetLoginWxQRCodeResource(Resource): def __init__(self): self.parser = reqparse.RequestParser() self.wxchat = gewe_chat.wxchat def post(self): req = request.get_json() token_id = req.get("tokenId") tel= req.get("tel") region_id= req.get("regionId") agent_token_id= req.get("agentTokenId") data={ "tokenId": token_id, "tel": tel, "base64Img": "data:image/png;base64,"+"aaaaaa", "expiredTime": "12345678901", } return jsonify(data)