fix validator
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user