From 48926b8a5a40090907a7a56ee17fa915f0dd44f4 Mon Sep 17 00:00:00 2001 From: "1808837298@qq.com" <1808837298@qq.com> Date: Sat, 22 Feb 2025 15:19:55 +0800 Subject: [PATCH] fix: Ensure correct quota warning threshold type conversion --- controller/user.go | 10 +++++----- web/src/components/PersonalSetting.js | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/controller/user.go b/controller/user.go index 3002a613..51e6f955 100644 --- a/controller/user.go +++ b/controller/user.go @@ -913,11 +913,11 @@ func TopUp(c *gin.Context) { } type UpdateUserSettingRequest struct { - QuotaWarningType string `json:"notify_type"` - QuotaWarningThreshold int `json:"quota_warning_threshold"` - WebhookUrl string `json:"webhook_url,omitempty"` - WebhookSecret string `json:"webhook_secret,omitempty"` - NotificationEmail string `json:"notification_email,omitempty"` + QuotaWarningType string `json:"notify_type"` + QuotaWarningThreshold float64 `json:"quota_warning_threshold"` + WebhookUrl string `json:"webhook_url,omitempty"` + WebhookSecret string `json:"webhook_secret,omitempty"` + NotificationEmail string `json:"notification_email,omitempty"` } func UpdateUserSetting(c *gin.Context) { diff --git a/web/src/components/PersonalSetting.js b/web/src/components/PersonalSetting.js index 777cf042..49a0784c 100644 --- a/web/src/components/PersonalSetting.js +++ b/web/src/components/PersonalSetting.js @@ -330,7 +330,7 @@ const PersonalSetting = () => { try { const res = await API.put('/api/user/setting', { notify_type: notificationSettings.warningType, - quota_warning_threshold: notificationSettings.warningThreshold, + quota_warning_threshold: parseFloat(notificationSettings.warningThreshold), webhook_url: notificationSettings.webhookUrl, webhook_secret: notificationSettings.webhookSecret, notification_email: notificationSettings.notificationEmail