12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576 |
- """
- @author: luojunhui
- """
- from quart import Blueprint, jsonify, request
- from applications.deal import Response, Record, Minigram, GetOffVideos
- my_blueprint = Blueprint('LongArticles', __name__)
- def Routes(mysql_client):
- """
- 路由代码
- """
- @my_blueprint.route('/healthcheck')
- def healthcheck():
- """
- Hello World Test
- :return:
- """
- return jsonify({'message': 'Hello, World!'})
- @my_blueprint.route('/search_videos', methods=['POST'])
- async def search_videos_from_the_web():
- """
- 从web 搜索视频并且存储到票圈的视频库中
- :return:
- """
- params = await request.get_json()
- SD = Record(params=params, mysql_client=mysql_client)
- result = await SD.deal()
- return jsonify(result)
- @my_blueprint.route('/recall_videos', methods=['POST'])
- async def recall_results():
- """
- 获取视频分享卡片
- :return:
- """
- data = await request.get_json()
- trace_id = data['traceId']
- minigram_type = data['miniprogramUseType']
- flow_pool_level_tag = data.get('flowPoolLevelTag', 'default')
- RD = Response(
- trace_id=trace_id,
- mini_program_type=minigram_type,
- mysql_client=mysql_client,
- flow_pool_level_tag=flow_pool_level_tag
- )
- response = await RD.deal()
- return jsonify(response)
- @my_blueprint.route("/choose_minigram", methods=['POST'])
- async def match_minigram():
- """
- 获取小程序信息
- :return:
- """
- data = await request.get_json()
- M = Minigram(params=data)
- response = await M.deal()
- return jsonify(response)
- @my_blueprint.route("/get_off_videos", methods=['POST'])
- async def get_off_videos():
- """
- 自动下架视频记录
- :return:
- """
- data = await request.get_json()
- GOV = GetOffVideos(params=data, mysql_client=mysql_client)
- response = await GOV.deal()
- return jsonify(response)
- return my_blueprint
|