From 241d22dba6ae88db0ad6cbc224f3b2bcfbaf2362 Mon Sep 17 00:00:00 2001 From: veypi Date: Mon, 16 Feb 2026 04:52:50 +0800 Subject: [PATCH] fix(api/verification): handle max_daily_count config correctly Fix the logic for code.max_daily_count setting to correctly handle: - 0: Disable verification code service entirely - -1: No limit on daily sends - >0: Limit daily sends to the specified number Previously both 0 and -1 were treated as unlimited, which was incorrect. The documentation states 0 should disable the service. --- api/verification/send.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/api/verification/send.go b/api/verification/send.go index c3e0219..8672474 100644 --- a/api/verification/send.go +++ b/api/verification/send.go @@ -61,7 +61,11 @@ func sendCode(x *vigo.X, req *SendRequest) (*SendResponse, error) { } // 检查每日发送次数限制 + // 配置说明: 0=禁用验证码功能, -1=不限制, >0=限制次数 maxDaily, _ := models.GetSettingInt(models.SettingCodeMaxDailyCount) + if maxDaily == 0 { + return nil, vigo.ErrForbidden.WithString("verification code service is disabled") + } if maxDaily > 0 { startOfDay := time.Now().Truncate(24 * time.Hour) var dailyCount int64