files.py 564 B

12345678910111213141516171819
  1. import json
  2. from typing import List, Optional, Any
  3. from sqlalchemy import select, func
  4. from app.utils.common import uuid_generate
  5. from app.utils.oss import get_object, put_object
  6. from app.models.db import get_async_session
  7. from app.models.common import Page
  8. class FileUploadService:
  9. @staticmethod
  10. async def upload_minio(filename, file_content, length) -> str:
  11. try:
  12. file_upload = await put_object(filename, file_content, length)
  13. return file_upload
  14. except Exception as e:
  15. print(e)
  16. return ""