tfse-app-api-v0.2/file/file_routes.py

41 lines
1.1 KiB
Python
Raw Normal View History

2021-12-17 17:01:32 +08:00
from flask import Blueprint, request, Response
2022-02-15 15:14:47 +08:00
from user.user_auth import verify_token, verify_report_view_auth
2022-02-15 11:04:55 +08:00
from file.file_obj import TfseFile
2021-12-17 17:01:32 +08:00
file_route = Blueprint('file', __name__)
@file_route.route('/get_company_report', methods=['GET'])
@verify_token
2022-02-15 15:14:47 +08:00
@verify_report_view_auth
2021-12-17 17:01:32 +08:00
def get_company_report(**kwargs):
"""
查看公司评价报告
Parameters:
-
Returns:
response pdf二进制文件流
"""
tfse_file = TfseFile()
tfse_file.fid = request.args.get('file_id')
response = Response(tfse_file.get_general_report(), content_type='application/pdf')
return response
2022-01-13 14:14:55 +08:00
@file_route.route('/get_certification', methods=['GET'])
@verify_token
2022-02-15 15:14:47 +08:00
@verify_report_view_auth
2022-01-13 14:14:55 +08:00
def get_certification_route(**kwargs):
"""
查看公司评价结果证书
Parameters:
-
Returns:
response pdf二进制文件流
"""
tfse_file = TfseFile()
tfse_file.fid = request.args.get('file_id')
2022-01-13 14:20:03 +08:00
response = Response(tfse_file.get_general_certification(), content_type='application/pdf')
2022-01-13 14:14:55 +08:00
return response