完成项目管理模块的接口测试
This commit is contained in:
@ -12,7 +12,7 @@ from . import schemas, models
|
||||
from utils.random_utils import random_str
|
||||
from utils import os_utils as os
|
||||
from application.settings import detect_url
|
||||
from utils.huawei_obs import ObsClient
|
||||
from utils.huawei_obs import MyObs
|
||||
from utils import status
|
||||
from core.exception import CustomException
|
||||
|
||||
@ -76,6 +76,7 @@ class ProjectDetectFileDal(DalBase):
|
||||
|
||||
async def add_file(self, detect: models.ProjectDetect, files: list[UploadFile]):
|
||||
images = []
|
||||
obs = MyObs()
|
||||
for file in files:
|
||||
image = models.ProjectDetectFile()
|
||||
image.detect_id = detect.id
|
||||
@ -85,7 +86,7 @@ class ProjectDetectFileDal(DalBase):
|
||||
image.image_url = path
|
||||
# 上传到obs
|
||||
object_key = detect.detect_no + '/' + file.filename
|
||||
success, key, url = ObsClient.put_file(object_key=object_key, file_path=path)
|
||||
success, key, url = obs.put_file(object_key=object_key, file_path=path)
|
||||
if success:
|
||||
image.object_key = object_key
|
||||
image.thumb_image_url = url
|
||||
@ -103,7 +104,7 @@ class ProjectDetectFileDal(DalBase):
|
||||
file_urls.append(file.file_url)
|
||||
object_keys.append(file.object_key)
|
||||
os.delete_paths(file_urls)
|
||||
ObsClient.del_objects(object_keys)
|
||||
MyObs().del_objects(object_keys)
|
||||
await self.delete_datas(ids, v_soft=False)
|
||||
|
||||
class ProjectDetectLogDal(DalBase):
|
||||
|
Reference in New Issue
Block a user