正在显示
1 个修改的文件
包含
8 行增加
和
7 行删除
1 | package utils | 1 | package utils |
2 | 2 | ||
3 | import ( | 3 | import ( |
4 | - "fmt" | ||
5 | - timeconv "github.com/Andrew-M-C/go.timeconv" | ||
6 | - "github.com/beego/beego/v2/core/validation" | ||
7 | - "gitlab.fjmaimaimai.com/allied-creation/performance/pkg/domain" | 4 | + "errors" |
8 | "math" | 5 | "math" |
9 | "reflect" | 6 | "reflect" |
10 | "strconv" | 7 | "strconv" |
11 | "strings" | 8 | "strings" |
12 | "time" | 9 | "time" |
10 | + | ||
11 | + timeconv "github.com/Andrew-M-C/go.timeconv" | ||
12 | + "github.com/beego/beego/v2/core/validation" | ||
13 | + "gitlab.fjmaimaimai.com/allied-creation/performance/pkg/domain" | ||
13 | ) | 14 | ) |
14 | 15 | ||
15 | // ValidateCommand 验证输入参数 | 16 | // ValidateCommand 验证输入参数 |
@@ -25,12 +26,12 @@ func ValidateCommand(commandType interface{}) error { | @@ -25,12 +26,12 @@ func ValidateCommand(commandType interface{}) error { | ||
25 | field, isExist := elem.FieldByName(validErr.Field) | 26 | field, isExist := elem.FieldByName(validErr.Field) |
26 | if isExist { | 27 | if isExist { |
27 | if tag := field.Tag.Get("cname"); len(tag) > 0 { | 28 | if tag := field.Tag.Get("cname"); len(tag) > 0 { |
28 | - return fmt.Errorf(strings.Replace(validErr.Message, validErr.Field, tag, -1)) | 29 | + return errors.New(strings.Replace(validErr.Message, validErr.Field, tag, -1)) |
29 | } else { | 30 | } else { |
30 | - return fmt.Errorf(validErr.Message) | 31 | + return errors.New(validErr.Message) |
31 | } | 32 | } |
32 | } else { | 33 | } else { |
33 | - return fmt.Errorf(validErr.Message) | 34 | + return errors.New(validErr.Message) |
34 | } | 35 | } |
35 | } | 36 | } |
36 | } | 37 | } |
-
请 注册 或 登录 后发表评论