fix: Fix the issue of initializing SMS sending quantity as a string (#10936)

This commit is contained in:
2025-11-12 22:24:45 +08:00
committed by GitHub
parent a7342d6ef2
commit 4d85ae5fa6
2 changed files with 7 additions and 3 deletions

View File

@@ -317,7 +317,7 @@ type AlertCommonConfig struct {
type AlertSmsConfig struct {
Phone string `json:"phone"`
AlertDailyNum uint `json:"alertDailyNum"`
AlertDailyNum string `json:"alertDailyNum"`
}
type AlertEmailConfig struct {

View File

@@ -7,6 +7,7 @@ import (
"net/http"
"os"
"os/exec"
"strconv"
"strings"
"sync"
"time"
@@ -212,7 +213,10 @@ func CheckSMSSendLimit(method string) bool {
if err != nil {
return false
}
limitCount := cfg.AlertDailyNum
limitCount, err := strconv.ParseUint(cfg.AlertDailyNum, 10, 64)
if err != nil {
return false
}
checkTaskMutex.Lock()
defer checkTaskMutex.Unlock()
todayCount, err := alertRepo.GetLicensePushCount(method)
@@ -220,7 +224,7 @@ func CheckSMSSendLimit(method string) bool {
global.LOG.Errorf("error getting license push count info, err: %v", err)
return false
}
if todayCount >= limitCount {
if todayCount >= uint(limitCount) {
return false
}