mirror of
https://github.com/cuigh/swirl
synced 2025-06-26 18:16:50 +00:00
Add creator and modifier fields
This commit is contained in:
10
api/chart.go
10
api/chart.go
@@ -36,21 +36,15 @@ func NewChart(b biz.ChartBiz) *ChartHandler {
|
||||
}
|
||||
|
||||
func chartSearch(b biz.ChartBiz) web.HandlerFunc {
|
||||
type Args struct {
|
||||
Name string `json:"name" bind:"name"`
|
||||
Dashboard string `json:"dashboard" bind:"dashboard"`
|
||||
PageIndex int `json:"pageIndex" bind:"pageIndex"`
|
||||
PageSize int `json:"pageSize" bind:"pageSize"`
|
||||
}
|
||||
return func(ctx web.Context) (err error) {
|
||||
var (
|
||||
args = &Args{}
|
||||
args = &model.ChartSearchArgs{}
|
||||
charts []*biz.Chart
|
||||
total int
|
||||
)
|
||||
|
||||
if err = ctx.Bind(args); err == nil {
|
||||
charts, total, err = b.Search(args.Name, args.Dashboard, args.PageIndex, args.PageSize)
|
||||
charts, total, err = b.Search(args)
|
||||
}
|
||||
|
||||
if err != nil {
|
||||
|
||||
@@ -25,7 +25,7 @@ func NewEvent(b biz.EventBiz) *EventHandler {
|
||||
func eventSearch(b biz.EventBiz) web.HandlerFunc {
|
||||
return func(ctx web.Context) (err error) {
|
||||
var (
|
||||
args = &model.EventListArgs{}
|
||||
args = &model.EventSearchArgs{}
|
||||
events []*biz.Event
|
||||
total int
|
||||
)
|
||||
|
||||
@@ -147,7 +147,7 @@ func userSetStatus(b biz.UserBiz) web.HandlerFunc {
|
||||
args := &Args{}
|
||||
err := ctx.Bind(args)
|
||||
if err == nil {
|
||||
err = b.SetStatus(args.ID, args.Status)
|
||||
err = b.SetStatus(args.ID, args.Status, ctx.User())
|
||||
}
|
||||
return ajax(ctx, err)
|
||||
}
|
||||
@@ -163,7 +163,7 @@ func userModifyPassword(b biz.UserBiz) web.HandlerFunc {
|
||||
args := &Args{}
|
||||
err := ctx.Bind(args)
|
||||
if err == nil {
|
||||
err = b.ModifyPassword(ctx.User().ID(), args.OldPassword, args.NewPassword)
|
||||
err = b.ModifyPassword(args.OldPassword, args.NewPassword, ctx.User())
|
||||
}
|
||||
return ajax(ctx, err)
|
||||
}
|
||||
@@ -174,8 +174,7 @@ func userModifyProfile(b biz.UserBiz) web.HandlerFunc {
|
||||
u := &biz.User{}
|
||||
err := ctx.Bind(u, true)
|
||||
if err == nil {
|
||||
u.ID = ctx.User().ID()
|
||||
err = b.ModifyProfile(u)
|
||||
err = b.ModifyProfile(u, ctx.User())
|
||||
}
|
||||
return ajax(ctx, err)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user