fix(file): 优化文件插入逻辑
- 修改文件数据插入流程,先插入再查询 - 优化代码结构,提高可读性和维护性
This commit is contained in:
parent
182c7a3873
commit
2cb3429dcd
@ -35,7 +35,8 @@ class FileService:
|
|||||||
os.remove(filepath)
|
os.remove(filepath)
|
||||||
return v_file
|
return v_file
|
||||||
else:
|
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)
|
print("insert v_file:", v_file)
|
||||||
return v_file
|
return v_file
|
||||||
return None
|
return None
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user