update 更改pdf存储位置

This commit is contained in:
彭森 2021-12-24 16:44:18 +08:00
parent 984d990cd5
commit cc74fe7271
1 changed files with 4 additions and 4 deletions

View File

@ -21,8 +21,8 @@ def upload_pdf(name):
根据名称保存该企业报告 根据名称保存该企业报告
""" """
path = get_gen_report_path(name=name) path = get_gen_report_path(name=name)
database = '企业' database = '评价'
collection = 'PDF' collection = '综合信用报告'
fs = GridFS(client[database], collection) fs = GridFS(client[database], collection)
content = open(path, 'rb').read() content = open(path, 'rb').read()
pdf_id = fs.put(content, content_type='application/pdf', filename=name) pdf_id = fs.put(content, content_type='application/pdf', filename=name)
@ -34,8 +34,8 @@ def download_pdf(pdf_id):
""" """
根据pdf_id查询pdf文件 根据pdf_id查询pdf文件
""" """
database = '企业' database = '评价'
collection = 'PDF' collection = '综合信用报告'
fs = GridFS(client[database], collection) fs = GridFS(client[database], collection)
data = fs.get(ObjectId(pdf_id)).read() data = fs.get(ObjectId(pdf_id)).read()