邓淳远、崔鹏宇、翁思扬组云计算期末项目
Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

76 lignes
2.1 KiB

il y a 4 ans
il y a 4 ans
il y a 4 ans
il y a 4 ans
il y a 4 ans
il y a 4 ans
il y a 4 ans
il y a 4 ans
  1. from flask import Flask, render_template, request, jsonify, session, Blueprint
  2. from bson import json_util
  3. bp_block = Blueprint("block", __name__,url_prefix="/block")
  4. @bp_block.route("/add", methods=["POST"])
  5. def add_block():
  6. type = request.form.get('type')
  7. content = request.form.get("content")
  8. ret = {'msg': 'succuss'}
  9. """
  10. ret['id'] =
  11. """
  12. return json_util.dumps()
  13. @bp_block.route("/select", methods=["POST"])
  14. def get_block():
  15. # 查询这个id的collection的block
  16. id = request.form.get('id')
  17. blocks = []
  18. """
  19. blocks.append({'id': '1', 'content': 'xuanz','type':'text'})
  20. blocks.append({'id': '2', 'content': 'mingg','type':'url'})
  21. blocks.append({'id': '3', 'content': 'wnqian','type':'picture'})
  22. """
  23. ans = {'blocks':blocks,'msg':'succuss'}
  24. return json_util.dumps(ans)
  25. @bp_block.route("/delete", methods=["POST"])
  26. def delete():
  27. collection_id = request.form.get('collection_id')
  28. block_id = request.form.get('block_id')
  29. """
  30. id的collection的block
  31. """
  32. ret = {'msg':'succuss'}
  33. return json_util.dumps(ret)
  34. @bp_block.route("/swap", methods=["POST"])
  35. def swap():
  36. id = request.form.get('id')
  37. collection_id = request.form.get('collection_id')
  38. order = request.form.get('new_order')
  39. """
  40. collection_id的collection的这个id的块和顺序是order的块交换
  41. """
  42. ret = {'msg':'succuss'}
  43. return json_util.dumps(ret)
  44. @bp_block.route("/edit", methods=["POST"])
  45. def edit():
  46. collection_id = request.form.get('collection_id')
  47. block_id = request.form.get('block_id')
  48. content = request.form.get('content',None)
  49. """
  50. content = none的情况请直接返回
  51. """
  52. ret = {'msg':'succuss'}
  53. return json_util.dumps(ret)
  54. @bp_block.route("/get_web_name", methods=["POST"])
  55. def get_web_name():
  56. url = request.form.get('url')
  57. ret = {'msg':'succuss'}
  58. """
  59. ret['name'] = url对应的网站的titleurl
  60. """
  61. return json_util.dumps(ret)