mirror of
https://github.com/Buriburizaem0n/nezha_domains.git
synced 2026-05-06 13:48:52 +00:00
fix: automatic theme switching and extended expiry notifications
This commit is contained in:
@@ -163,14 +163,12 @@ func CronJobForDomainStatus() {
|
|||||||
// 只有在到期前一定天数通知,且避开重复通知 (简单逻辑:每天通知一次)
|
// 只有在到期前一定天数通知,且避开重复通知 (简单逻辑:每天通知一次)
|
||||||
if Conf.ExpiryNotificationGroupID != 0 {
|
if Conf.ExpiryNotificationGroupID != 0 {
|
||||||
msg := ""
|
msg := ""
|
||||||
switch daysLeft {
|
switch daysLeft + 1 {
|
||||||
case 7, 3, 1:
|
case 60, 30, 15, 7, 3, 1:
|
||||||
msg = fmt.Sprintf("域名 [%s] 即将到期,剩余 %d 天。到期时间: %s", d.Domain, daysLeft, endDate.Format("2006-01-02"))
|
msg = fmt.Sprintf("域名 [%s] 即将到期,剩余 %d 天。到期时间: %s", d.Domain, daysLeft+1, endDate.Format("2006-01-02"))
|
||||||
case 0:
|
case 0:
|
||||||
if now.After(endDate) {
|
|
||||||
msg = fmt.Sprintf("域名 [%s] 已到期!到期时间: %s", d.Domain, endDate.Format("2006-01-02"))
|
msg = fmt.Sprintf("域名 [%s] 已到期!到期时间: %s", d.Domain, endDate.Format("2006-01-02"))
|
||||||
}
|
}
|
||||||
}
|
|
||||||
if msg != "" {
|
if msg != "" {
|
||||||
NotificationShared.SendNotification(Conf.ExpiryNotificationGroupID, msg, fmt.Sprintf("expiry-domain-%d-%d", d.ID, daysLeft))
|
NotificationShared.SendNotification(Conf.ExpiryNotificationGroupID, msg, fmt.Sprintf("expiry-domain-%d-%d", d.ID, daysLeft))
|
||||||
}
|
}
|
||||||
@@ -246,14 +244,12 @@ func CronJobForServerStatus() {
|
|||||||
|
|
||||||
if Conf.ExpiryNotificationGroupID != 0 {
|
if Conf.ExpiryNotificationGroupID != 0 {
|
||||||
msg := ""
|
msg := ""
|
||||||
switch daysLeft {
|
switch daysLeft + 1 {
|
||||||
case 15, 7, 3, 1:
|
case 30, 15, 7, 3, 1:
|
||||||
msg = fmt.Sprintf("VPS [%s] 即将到期,剩余 %d 天。到期时间: %s", s.Name, daysLeft, endDate.Format("2006-01-02"))
|
msg = fmt.Sprintf("VPS [%s] 即将到期,剩余 %d 天。到期时间: %s", s.Name, daysLeft+1, endDate.Format("2006-01-02"))
|
||||||
case 0:
|
case 0:
|
||||||
if now.After(endDate) {
|
|
||||||
msg = fmt.Sprintf("VPS [%s] 已到期!到期时间: %s", s.Name, endDate.Format("2006-01-02"))
|
msg = fmt.Sprintf("VPS [%s] 已到期!到期时间: %s", s.Name, endDate.Format("2006-01-02"))
|
||||||
}
|
}
|
||||||
}
|
|
||||||
if msg != "" {
|
if msg != "" {
|
||||||
NotificationShared.SendNotification(Conf.ExpiryNotificationGroupID, msg, fmt.Sprintf("expiry-server-%d-%d", s.ID, daysLeft))
|
NotificationShared.SendNotification(Conf.ExpiryNotificationGroupID, msg, fmt.Sprintf("expiry-server-%d-%d", s.ID, daysLeft))
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user