__init__.py 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. """
  2. @author: luojunhui
  3. """
  4. from quart import Blueprint, jsonify, request
  5. from .AccountArticleRank import AccountArticleRank
  6. blueprint = Blueprint("LongArticlesAlgServer", __name__)
  7. def AlgRoutes(mysql_client):
  8. """
  9. ALG ROUTES
  10. :return:
  11. """
  12. @blueprint.route("/healthCheck")
  13. def helloFuture():
  14. """
  15. 测试服务连通性
  16. :return:
  17. """
  18. response = {"msg": "Hello, World! Hello, Future"}
  19. return jsonify(response)
  20. @blueprint.route("/articleRank", methods=["POST"])
  21. async def articleRankRoute():
  22. """
  23. 文章排序接口
  24. :return:
  25. """
  26. params = await request.get_json()
  27. AAR = AccountArticleRank(params, mysql_client=mysql_client)
  28. response = await AAR.deal()
  29. # print(response)
  30. return jsonify(response)
  31. @blueprint.route("/nlp", methods=["POST"])
  32. async def nlper():
  33. """
  34. nlper ma
  35. :return:
  36. """
  37. response = {
  38. "msg": "this function is developing"
  39. }
  40. return jsonify(response)
  41. return blueprint