20260515173434
This commit is contained in:
1 parent
5816c5daa6
commit
2e704bbbb0
1 file changed
+1
-7
+1
-7
@@ -193,14 +193,10 @@ public class FileController {
|
|||||||
// 4. 雪花 ID(唯一)
|
// 4. 雪花 ID(唯一)
|
||||||
long nextId = UniqueId.nextId();
|
long nextId = UniqueId.nextId();
|
||||||
|
|
||||||
// 5. 分桶(0-ff)
|
|
||||||
String bucket = String.format("%02x", nextId & 0xff);
|
|
||||||
|
|
||||||
// 6. 构建目录:日期 + 分桶
|
// 6. 构建目录:日期 + 分桶
|
||||||
String fullDirPath = PathUtils.joinFilePath(
|
String fullDirPath = PathUtils.joinFilePath(
|
||||||
basePath,
|
basePath,
|
||||||
datePath,
|
datePath
|
||||||
bucket
|
|
||||||
);
|
);
|
||||||
|
|
||||||
// 7. 创建目录(幂等)
|
// 7. 创建目录(幂等)
|
||||||
@@ -221,7 +217,6 @@ public class FileController {
|
|||||||
String relativePath = PathUtils.joinFilePath(
|
String relativePath = PathUtils.joinFilePath(
|
||||||
fileConfig.getContainerDir(),
|
fileConfig.getContainerDir(),
|
||||||
datePath,
|
datePath,
|
||||||
bucket,
|
|
||||||
newFileName
|
newFileName
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -238,7 +233,6 @@ public class FileController {
|
|||||||
result.put("path", relativePath);
|
result.put("path", relativePath);
|
||||||
result.put("uid", nextId);
|
result.put("uid", nextId);
|
||||||
result.put("fileName", fileName);
|
result.put("fileName", fileName);
|
||||||
result.put("bucket", bucket);
|
|
||||||
|
|
||||||
return Result.ok(result);
|
return Result.ok(result);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user