2
0
mirror of https://github.com/acepanel/panel.git synced 2026-02-04 05:31:44 +08:00
Files
panel/internal/http/rule/rule.go
2024-12-29 01:41:19 +08:00

22 lines
568 B
Go
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
package rule
import (
"github.com/gookit/validate"
"gorm.io/gorm"
)
func GlobalRules(db *gorm.DB) {
validate.AddValidators(validate.M{
"exists": NewExists(db).Passes,
"notExists": NewNotExists(db).Passes,
"password": NewPassword().Passes,
"cron": NewCron().Passes,
})
validate.AddGlobalMessages(map[string]string{
"exists": "{field} 不存在",
"notExists": "{field} 已存在",
"password": "密码不满足要求8-20位至少包含字母、数字、特殊字符中的两种",
"cron": "Cron 表达式不合法",
})
}