|
@@ -16,20 +16,16 @@ func ParseParamFail(ctx *gin.Context, r interface{}, fs ...func() error) bool {
|
16
|
16
|
err := ctx.ShouldBind(r)
|
17
|
17
|
if err != nil {
|
18
|
18
|
err = HTTPError{Status: http.StatusBadRequest, Msg: err.Error()}
|
19
|
|
- }
|
20
|
19
|
|
21
|
|
- if Fail(ctx, err) {
|
22
|
|
- return true
|
|
20
|
+ return Fail(ctx, err)
|
23
|
21
|
}
|
24
|
22
|
|
25
|
23
|
if checker, ok := r.(Checker); ok {
|
26
|
24
|
err := checker.Check()
|
27
|
25
|
if err != nil {
|
28
|
26
|
err = HTTPError{Status: http.StatusBadRequest, Msg: err.Error()}
|
29
|
|
- }
|
30
|
27
|
|
31
|
|
- if Fail(ctx, err) {
|
32
|
|
- return true
|
|
28
|
+ return Fail(ctx, err)
|
33
|
29
|
}
|
34
|
30
|
}
|
35
|
31
|
}
|
|
@@ -38,10 +34,8 @@ func ParseParamFail(ctx *gin.Context, r interface{}, fs ...func() error) bool {
|
38
|
34
|
err := f()
|
39
|
35
|
if err != nil {
|
40
|
36
|
err = HTTPError{Status: http.StatusBadRequest, Msg: err.Error()}
|
41
|
|
- }
|
42
|
37
|
|
43
|
|
- if Fail(ctx, err) {
|
44
|
|
- return true
|
|
38
|
+ return Fail(ctx, err)
|
45
|
39
|
}
|
46
|
40
|
}
|
47
|
41
|
|