20260719215738

This commit is contained in:
oneao committed 2026-07-19 21:57:40 +08:00
1 parent 35aa108a34
commit cda7f16d3a
116 files changed
+11826 -3669

No files matched your search

+11 -6
View File
@@ -29,7 +29,7 @@ func S3UploadFile(c fiber.Ctx) error {
}
now := time.Now()
folderPath, err := uploadFolderPath(c.FormValue("upload_type"), c.FormValue("family_id"), now)
folderPath, err := uploadFolderPath(c.FormValue("upload_type"), c.FormValue("family_id"), c.FormValue("upload_module"), now)
if err != nil {
return httpx.Fail(c, err.Error())
}
@@ -79,7 +79,7 @@ func S3CopyFile(c fiber.Ctx) error {
return httpx.OK(c, []string{})
}
folderPath := familyDateFolder(req.FamilyID, time.Now())
folderPath := familyDateFolder(req.Module, req.FamilyID, time.Now())
result := make([]string, 0, len(req.Keys))
for _, sourceKey := range req.Keys {
@@ -128,9 +128,10 @@ func parseFamilyID(value string) (int64, error) {
return familyID, nil
}
func familyDateFolder(familyID int64, now time.Time) string {
return fmt.Sprintf("%d/%d/%02d/%02d",
func familyDateFolder(module string, familyID int64, now time.Time) string {
return fmt.Sprintf("business/%d/%s/%d/%02d/%02d",
familyID,
module,
now.Year(),
now.Month(),
now.Day(),
@@ -145,7 +146,7 @@ func avatarDateFolder(now time.Time) string {
)
}
func uploadFolderPath(uploadType string, familyIDValue string, now time.Time) (string, error) {
func uploadFolderPath(uploadType string, familyIDValue string, module string, now time.Time) (string, error) {
if uploadType == "avatar" {
return avatarDateFolder(now), nil
}
@@ -155,5 +156,9 @@ func uploadFolderPath(uploadType string, familyIDValue string, now time.Time) (s
return "", fmt.Errorf("family_id不能为空")
}
return familyDateFolder(familyID, now), nil
if module == "" {
return "", fmt.Errorf("module不能为空")
}
return familyDateFolder(module, familyID, now), nil
}