fix validator

This commit is contained in:
2025-08-18 18:18:04 +08:00
parent 59b3d76f57
commit ecfe7a6fd6
3 changed files with 4 additions and 4 deletions

View File

@@ -137,9 +137,9 @@ func (bv *BusinessValidator) ValidateProductCode(code string) error {
if code == "" {
return fmt.Errorf("产品代码不能为空")
}
matched, _ := regexp.MatchString(`^[a-zA-Z0-9_-]{3,50}$`, code)
matched, _ := regexp.MatchString(`^[a-zA-Z0-9_\-\(\)]{3,50}$`, code)
if !matched {
return fmt.Errorf("产品代码格式不正确只能包含字母、数字、下划线、连字符长度3-50位")
return fmt.Errorf("产品代码格式不正确,只能包含字母、数字、下划线、连字符、中英文括号长度3-50位")
}
return nil
}