fix(file): 优化文件插入逻辑

- 修改文件数据插入流程,先插入再查询
- 优化代码结构,提高可读性和维护性
This commit is contained in:
liuxiaoqing 2025-08-20 10:37:26 +08:00
parent 182c7a3873
commit 2cb3429dcd

View File

@ -35,7 +35,8 @@ class FileService:
os.remove(filepath)
return v_file
else:
v_file = dataservice.insert_file_data(file.filename, filepath, file_size, filetype, time.strftime("%Y-%m-%d %H:%M:%S", time.localtime()),file_hash)
dataservice.insert_file_data(file.filename, filepath, file_size, filetype, time.strftime("%Y-%m-%d %H:%M:%S", time.localtime()),file_hash)
v_file = dataservice.get_file(file_hash, file_size)
print("insert v_file:", v_file)
return v_file
return None