You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
52 lines
1.1 KiB
52 lines
1.1 KiB
package http |
|
|
|
import ( |
|
"go-common/app/admin/ep/melloi/model" |
|
"go-common/library/ecode" |
|
bm "go-common/library/net/http/blademaster" |
|
"go-common/library/net/http/blademaster/binding" |
|
) |
|
|
|
func queryApply(c *bm.Context) { |
|
qar := model.QueryApplyRequest{} |
|
if err := c.BindWith(&qar, binding.Form); err != nil { |
|
c.JSON(nil, err) |
|
return |
|
} |
|
if err := qar.Verify(); err != nil { |
|
c.JSON(nil, err) |
|
return |
|
} |
|
c.JSON(srv.QueryApply(&qar)) |
|
} |
|
|
|
func addApply(c *bm.Context) { |
|
apply := model.Apply{} |
|
if err := c.BindWith(&apply, binding.JSON); err != nil { |
|
c.JSON(nil, err) |
|
return |
|
} |
|
cookie := c.Request.Header.Get("Cookie") |
|
c.JSON(nil, srv.AddApply(c, cookie, &apply)) |
|
} |
|
|
|
func updateApply(c *bm.Context) { |
|
apply := model.Apply{} |
|
if err := c.BindWith(&apply, binding.JSON); err != nil { |
|
c.JSON(nil, err) |
|
return |
|
} |
|
cookie := c.Request.Header.Get("Cookie") |
|
c.JSON(nil, srv.UpdateApply(cookie, &apply)) |
|
} |
|
|
|
func delApply(c *bm.Context) { |
|
v := new(struct { |
|
ID int64 `form:"id"` |
|
}) |
|
if err := c.Bind(v); err != nil { |
|
c.JSON(nil, ecode.RequestErr) |
|
return |
|
} |
|
c.JSON(nil, srv.DeleteApply(v.ID)) |
|
}
|
|
|