You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

51 lines
1.4KB

  1. from flask_restful import Resource, reqparse
  2. from flask import jsonify,request,json
  3. from common import redis_helper,utils
  4. from wechat import gewe_chat
  5. class GetLoginInfoResource(Resource):
  6. def __init__(self):
  7. self.parser = reqparse.RequestParser()
  8. self.wxchat = gewe_chat.wxchat
  9. def post(self):
  10. req = request.get_json()
  11. tel = req.get("tel")
  12. config=self.wxchat.get_login_info_from_cache(tel)
  13. return jsonify(config)
  14. class LoginWxCaptchCodeResource(Resource):
  15. def __init__(self):
  16. self.parser = reqparse.RequestParser()
  17. self.wxchat = gewe_chat.wxchat
  18. def post(self):
  19. req = request.get_json()
  20. token_id = req.get("token_id")
  21. captch_code= req.get("captch_code")
  22. res=self.wxchat.save_login_wx_captch_code_to_cache(token_id,captch_code)
  23. return jsonify(res)
  24. class GetLoginWxQRCodeResource(Resource):
  25. def __init__(self):
  26. self.parser = reqparse.RequestParser()
  27. self.wxchat = gewe_chat.wxchat
  28. def post(self):
  29. req = request.get_json()
  30. token_id = req.get("tokenId")
  31. tel= req.get("tel")
  32. region_id= req.get("regionId")
  33. agent_token_id= req.get("agentTokenId")
  34. data={
  35. "tokenId": token_id,
  36. "tel": tel,
  37. "base64Img": "data:image/png;base64,"+"aaaaaa",
  38. "expiredTime": "12345678901",
  39. }
  40. return jsonify(data)