|
@@ -56,15 +56,14 @@ async def upload_file(files: list[UploadFile] = File(...)):
|
|
|
if file.filename == '':
|
|
if file.filename == '':
|
|
|
return JSONResponse(content={"error": "没有选择文件"}, status_code=400)
|
|
return JSONResponse(content={"error": "没有选择文件"}, status_code=400)
|
|
|
if file and allowed_file(file.filename):
|
|
if file and allowed_file(file.filename):
|
|
|
- filename = file.filename
|
|
|
|
|
- save_path = os.path.join(SOURCE_FILES_PATH, filename)
|
|
|
|
|
|
|
+ save_path = os.path.join(SOURCE_FILES_PATH, file.filename)
|
|
|
with open(save_path, 'wb') as buffer:
|
|
with open(save_path, 'wb') as buffer:
|
|
|
shutil.copyfileobj(file.file, buffer)
|
|
shutil.copyfileobj(file.file, buffer)
|
|
|
save_path_list.append(save_path)
|
|
save_path_list.append(save_path)
|
|
|
else:
|
|
else:
|
|
|
return JSONResponse(content={"error": "不允许的文件类型"}, status_code=400)
|
|
return JSONResponse(content={"error": "不允许的文件类型"}, status_code=400)
|
|
|
- return JSONResponse(content={"code": 200, "msg": "文件上传成功", "data": {"file_paths": save_path_list}},
|
|
|
|
|
- status_code=200)
|
|
|
|
|
|
|
+ return JSONResponse(content={"code": 200, "msg": "", "data": {}}, status_code=200)
|
|
|
|
|
+
|
|
|
|
|
|
|
|
# ws://localhost:9201/api/document/ws/excel
|
|
# ws://localhost:9201/api/document/ws/excel
|
|
|
@router.websocket("/ws/excel")
|
|
@router.websocket("/ws/excel")
|