add:fronted
This commit is contained in:
+3
-1
@@ -56,9 +56,11 @@ class S3FileStorage:
|
||||
await s3.delete_object(Bucket=self.bucket_name, Key=await file_code.get_file_path())
|
||||
|
||||
async def get_file_url(self, file_code: FileCodes):
|
||||
if file_code.prefix == '文本分享':
|
||||
return file_code.text
|
||||
async with self.session.client("s3", endpoint_url=self.endpoint_url) as s3:
|
||||
result = await s3.generate_presigned_url('get_object', Params={'Bucket': self.bucket_name, 'Key': await file_code.get_file_path()}, ExpiresIn=3600)
|
||||
return result
|
||||
|
||||
|
||||
file_storage = SystemFileStorage()
|
||||
file_storage = S3FileStorage()
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
# @Author : Lan
|
||||
# @File : utils.py
|
||||
# @Software: PyCharm
|
||||
import datetime
|
||||
import random
|
||||
import string
|
||||
|
||||
@@ -23,3 +24,13 @@ async def get_random_string():
|
||||
:return:
|
||||
"""
|
||||
return ''.join(random.choice(r_s) for _ in range(5))
|
||||
|
||||
|
||||
async def get_now():
|
||||
"""
|
||||
获取当前时间
|
||||
:return:
|
||||
"""
|
||||
return datetime.datetime.now(
|
||||
datetime.timezone(datetime.timedelta(hours=8))
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user