feat: 新增pdf 删除
This commit is contained in:
parent
bbca1a5114
commit
619c2ea989
|
@ -372,11 +372,12 @@ class ParsePdfViewSet(RbacFilterSet, CreateUpdateCustomMixin, ModelViewSet):
|
||||||
if self.get_object().status == "执行中":
|
if self.get_object().status == "执行中":
|
||||||
return Response({'message': '执行中的数据不能删除'}, status=status.HTTP_400_BAD_REQUEST)
|
return Response({'message': '执行中的数据不能删除'}, status=status.HTTP_400_BAD_REQUEST)
|
||||||
# 删除文件
|
# 删除文件
|
||||||
file_path = os.path.join(settings.BASE_DIR, self.get_object().parse_excel)
|
path = "/home/testsearchadmin/cma_search/server"
|
||||||
if os.path.exists(file_path):
|
file_path = path + self.get_object().excel_path
|
||||||
|
if os.path.isfile(file_path):
|
||||||
os.remove(file_path)
|
os.remove(file_path)
|
||||||
pdf_path = os.path.join(settings.BASE_DIR, self.get_object().pdf_path)
|
pdf_path = path + self.get_object().pdf_path
|
||||||
if os.path.exists(pdf_path):
|
if os.path.isfile(pdf_path):
|
||||||
os.remove(pdf_path)
|
os.remove(pdf_path)
|
||||||
|
|
||||||
# 删除数据库记录
|
# 删除数据库记录
|
||||||
|
|
Loading…
Reference in New Issue