Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

33 lines
1023B

  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 GetWxchatConfigResource(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. wxid = req.get("wxid")
  12. config=self.wxchat.get_wxchat_config_from_cache(wxid)
  13. return jsonify(config)
  14. class SaveWxchatConfigResource(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. wxid = req.get("wxid")
  21. data = req.get("data")
  22. # hash_key="__AI_OPS_WX__:WXCHAT_CONFIG"
  23. # redis_helper.redis_helper.update_hash_field(hash_key, wxid, json.dumps(data,ensure_ascii=False))
  24. self.wxchat.save_wxchat_config(wxid, data)
  25. return jsonify({'wxid': wxid, 'config': data})