feat: 添加租户ID字段并重构文件上传逻辑

This commit is contained in:
2026-03-24 16:17:22 +08:00
parent bb88eb1e47
commit 3cf301275f
5 changed files with 67 additions and 43 deletions

View File

@@ -385,3 +385,23 @@ func intPow10(n int) int {
}
return result
}
// GetFileAddressPrefix 拼接图片前缀地址
func GetFileAddressPrefix(ctx context.Context) (imageUrl string, err error) {
// 拼接图片前缀地址
bucketName, err := GetBucketName(ctx)
if err != nil {
return
}
imageUrl = fmt.Sprintf("%s/%s", g.Cfg().MustGet(ctx, "filePrefix").String(), bucketName)
return
}
func GetBucketName(ctx context.Context) (bucketName string, err error) {
user, err := GetUserInfo(ctx)
if err != nil {
return
}
bucketName = fmt.Sprintf("tenantid-%d", user.TenantId)
return
}