message.py 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. from flask import request, jsonify
  2. from flask_restx import Resource, Namespace, reqparse
  3. from app.defines import StatesCode
  4. ns = Namespace('message', description='消息管理接口')
  5. class MessageApi(Resource):
  6. def get(self):
  7. """获取消息"""
  8. data = {
  9. 'name': '年度消息',
  10. 'superior': None,
  11. 'config': '钉钉',
  12. 'personnel': '全体',
  13. 'time': '2020-10-10',
  14. 'title': '标题',
  15. 'content': '内容',
  16. 'style': '样式'
  17. }
  18. return jsonify(code=StatesCode.SUCCESS, message='成功', data=data)
  19. def put(self):
  20. """修改消息"""
  21. data = {
  22. 'name': '年度消息',
  23. 'superior': None,
  24. 'config': '钉钉',
  25. 'personnel': '全体',
  26. 'time': '2020-10-10',
  27. 'title': '标题',
  28. 'content': '内容',
  29. 'style': '样式'
  30. }
  31. return jsonify(code=StatesCode.SUCCESS, message='成功', data=data)
  32. def delete(self):
  33. """删除消息"""
  34. return jsonify(code=StatesCode.SUCCESS, message='成功', data='')
  35. class InformationApi(Resource):
  36. def get(self):
  37. """获取信息"""
  38. data = {
  39. 'name': '年度消息',
  40. 'superior': None,
  41. 'config': '钉钉',
  42. 'personnel': '全体',
  43. 'time': '2020-10-10',
  44. 'title': '标题',
  45. 'content': '内容',
  46. 'style': '样式'
  47. }
  48. return jsonify(code=StatesCode.SUCCESS, message='成功', data=data)
  49. def put(self):
  50. """修改信息"""
  51. data = {
  52. 'name': '年度消息',
  53. 'superior': None,
  54. 'config': '钉钉',
  55. 'personnel': '全体',
  56. 'time': '2020-10-10',
  57. 'title': '标题',
  58. 'content': '内容',
  59. 'style': '样式'
  60. }
  61. return jsonify(code=StatesCode.SUCCESS, message='成功', data=data)
  62. def delete(self):
  63. """删除信息"""
  64. return jsonify(code=StatesCode.SUCCESS, message='成功', data='')