fix: 注册 user-rules 和 shensheshou 路由,修复规则配置保存失败

- 将 /api/db/user-rules 的 GET/POST/PUT/DELETE 路由注册到 db 组
- 将 /api/admin/shensheshou/* 的 4 个路由注册到 admin 组
- 包含上次对话的头像 URL 修复(normalizeImageUrl 全栈)

Made-with: Cursor
This commit is contained in:
卡若
2026-03-15 19:31:07 +08:00
parent 708547d0dd
commit 64db4927ea
116 changed files with 1969 additions and 435 deletions

View File

@@ -84,7 +84,18 @@ func ossUploadFile(file multipart.File, folder, filename string) (string, error)
}
return host + "/" + objectKey, nil
}
return signedURL, nil
return normalizeOSSUrl(signedURL), nil
}
// normalizeOSSUrl 修复 OSS SDK 可能返回的缺少冒号的 URL如 "https//..." → "https://..."
func normalizeOSSUrl(u string) string {
if strings.HasPrefix(u, "https//") {
return "https://" + u[7:]
}
if strings.HasPrefix(u, "http//") {
return "http://" + u[6:]
}
return u
}
func ossUploadBytes(data []byte, folder, filename, contentType string) (string, error) {
@@ -133,5 +144,5 @@ func ossUploadBytes(data []byte, folder, filename, contentType string) (string,
}
return host + "/" + objectKey, nil
}
return signedURL, nil
return normalizeOSSUrl(signedURL), nil
}