routes.py 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. """
  2. @author: luojunhui
  3. """
  4. from quart import Blueprint, jsonify, request
  5. from server.api import Response, Record, Minigram, GetOffVideos
  6. my_blueprint = Blueprint('LongArticlesMatchServer', __name__)
  7. def Routes(mysql_client, config):
  8. """
  9. 路由代码
  10. """
  11. @my_blueprint.route('/healthcheck')
  12. def healthcheck():
  13. """
  14. Hello World Test
  15. :return:
  16. """
  17. return jsonify({'message': 'Hello, World!'})
  18. @my_blueprint.route('/search_videos', methods=['POST'])
  19. async def search_videos_from_the_web():
  20. """
  21. record Data
  22. :return:
  23. """
  24. params = await request.get_json()
  25. record = Record(params=params, mysql_client=mysql_client, config=config)
  26. result = await record.deal()
  27. return jsonify(result)
  28. @my_blueprint.route('/recall_videos', methods=['POST'])
  29. async def recall_results():
  30. """
  31. 获取视频分享卡片
  32. :return:
  33. """
  34. data = await request.get_json()
  35. response = Response(
  36. params=data,
  37. mysql_client=mysql_client,
  38. config=config
  39. )
  40. result = await response.deal()
  41. return jsonify(result)
  42. @my_blueprint.route("/choose_minigram", methods=['POST'])
  43. async def match_minigram():
  44. """
  45. 获取小程序信息
  46. :return:
  47. """
  48. data = await request.get_json()
  49. mini_program = Minigram(params=data)
  50. result = await mini_program.deal()
  51. return jsonify(result)
  52. @my_blueprint.route("/get_off_videos", methods=['POST'])
  53. async def get_off_videos():
  54. """
  55. 自动下架视频记录
  56. :return:
  57. """
  58. data = await request.get_json()
  59. get_off_video = GetOffVideos(params=data, mysql_client=mysql_client, config=config)
  60. result = await get_off_video.deal()
  61. return jsonify(result)
  62. return my_blueprint