12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152 |
- """
- @author: luojunhui
- 投流--路由
- """
- import time
- import uuid
- from quart import Blueprint, jsonify, request
- from .insertVideoRoute import insert
- TL_blueprint = Blueprint("TouLiu", __name__)
- def Routes(db_client):
- """
- 路由代码
- :param db_client: 异步db连接池
- :return:
- """
- @TL_blueprint.route("/hello")
- def helloWorld():
- """
- :return: Hello World
- """
- return jsonify({"message": "Hello World!"})
- @TL_blueprint.route("/generateInfo", methods=['POST'])
- async def generateInfo():
- """
- 生成一些需要用到到信息
- :return:
- """
- return jsonify({"message": "this function is developing"})
- @TL_blueprint.route("/insertVideo", methods=['POST'])
- async def insertVideos():
- """
- 插入视频信息
- :return:
- """
- request_id = "insertVideos_{}_{}".format(uuid.uuid4(), int(time.time()))
- data = await request.get_json()
- response = await insert(
- db_client=db_client,
- params=data,
- request_id=request_id
- )
- return jsonify(response)
- return TL_blueprint
|