File tree 3 files changed +17
-27
lines changed
template/admin/resource/requests 3 files changed +17
-27
lines changed Original file line number Diff line number Diff line change @@ -23,7 +23,7 @@ const (
23
23
AppName = "QuarkGo"
24
24
25
25
// 版本号
26
- Version = "3.9.7 "
26
+ Version = "3.9.8 "
27
27
28
28
// 包名
29
29
PkgName = "github.com/quarkcloudio/quark-go/v3"
Original file line number Diff line number Diff line change @@ -46,42 +46,36 @@ func (p *ActionRequest) Handle(ctx *quark.Context) error {
46
46
for _ , dropdownAction := range dropdownActioner .GetActions () {
47
47
uriKey := dropdownActioner .GetUriKey (dropdownAction )
48
48
if ctx .Param ("uriKey" ) == uriKey {
49
- // 行为执行完之前回调
49
+ // 执行前回调
50
50
err := template .BeforeAction (ctx , uriKey , model )
51
51
if err != nil {
52
- return err
52
+ return ctx . CJSONError ( err . Error ())
53
53
}
54
54
55
55
result = dropdownAction .(interface {
56
56
Handle (* quark.Context , * gorm.DB ) error
57
57
}).Handle (ctx , model )
58
58
59
- // 执行完后回调
60
- err = template .AfterAction (ctx , uriKey , model )
61
- if err != nil {
62
- return err
63
- }
59
+ // 执行完回调
60
+ template .AfterAction (ctx , uriKey , model )
64
61
65
62
return result
66
63
}
67
64
}
68
65
} else {
69
66
if ctx .Param ("uriKey" ) == uriKey {
70
- // 行为执行完之前回调
67
+ // 执行前回调
71
68
err := template .BeforeAction (ctx , uriKey , model )
72
69
if err != nil {
73
- return err
70
+ return ctx . CJSONError ( err . Error ())
74
71
}
75
72
76
73
result = v .(interface {
77
74
Handle (* quark.Context , * gorm.DB ) error
78
75
}).Handle (ctx , model )
79
76
80
- // 执行完后回调
81
- err = template .AfterAction (ctx , uriKey , model )
82
- if err != nil {
83
- return err
84
- }
77
+ // 执行完回调
78
+ template .AfterAction (ctx , uriKey , model )
85
79
86
80
return result
87
81
}
Original file line number Diff line number Diff line change @@ -50,33 +50,29 @@ func (p *EditableRequest) Handle(ctx *quark.Context) error {
50
50
}
51
51
}
52
52
53
- if field == "" {
54
- return ctx .CJSONError ("参数错误" )
55
- }
56
-
57
- if value == nil {
53
+ if field == "" || value == nil {
58
54
return ctx .CJSONError ("参数错误" )
59
55
}
60
56
61
57
// 表格行内编辑执行完之前回调
62
- result := template .BeforeEditable (ctx , id , field , value )
63
- if result != nil {
64
- return result
58
+ err := template .BeforeEditable (ctx , id , field , value )
59
+ if err != nil {
60
+ return ctx . CJSONError ( err . Error ())
65
61
}
66
62
67
63
// 创建表格行内编辑查询
68
64
query := template .BuildEditableQuery (ctx , model )
69
65
70
66
// 更新数据
71
- err : = query .Update (field , value ).Error
67
+ err = query .Update (field , value ).Error
72
68
if err != nil {
73
69
return ctx .CJSONError (err .Error ())
74
70
}
75
71
76
72
// 行为执行后回调
77
- result = template .AfterEditable (ctx , id , field , value )
78
- if result != nil {
79
- return result
73
+ err = template .AfterEditable (ctx , id , field , value )
74
+ if err != nil {
75
+ return ctx . CJSONError ( err . Error ())
80
76
}
81
77
82
78
return ctx .CJSONOk ("操作成功" )
You can’t perform that action at this time.
0 commit comments