|
|
@@ -12,12 +12,12 @@ type EntCatController struct {
|
|
|
}
|
|
|
|
|
|
func (c *EntCatController) BeforeActivation(b mvc.BeforeActivation) {
|
|
|
- b.Handle("GET", "/", "GetList" )
|
|
|
- b.Handle("GET", "/page", "GetPage" )
|
|
|
- b.Handle("GET", "/{entCatId:int64}", "GetById" )
|
|
|
- b.Handle("POST", "/add", "Create" )
|
|
|
- b.Handle("PUT", "/update", "Update" )
|
|
|
- b.Handle("DELETE", "/{entCatId:int64}", "DeleteByID")
|
|
|
+ b.Handle("GET", "/", "GetList" )
|
|
|
+ b.Handle("GET", "/page", "GetPage" )
|
|
|
+ b.Handle("GET", "/{entCatId:int64}", "GetById" )
|
|
|
+ b.Handle("POST", "/add", "Create" )
|
|
|
+ b.Handle("PUT", "/update", "Update" )
|
|
|
+ b.Handle("DELETE", "/{entCatId:int64}", "DeleteByID")
|
|
|
}
|
|
|
|
|
|
func (c *EntCatController) GetList() *JsonResult {
|
|
|
@@ -53,12 +53,12 @@ func (c *EntCatController) Create() *JsonResult {
|
|
|
userId := c.GetCurUserId()
|
|
|
entCat := datamodels.EntCat{}
|
|
|
entCat.CreatedBy = userId
|
|
|
- err := c.Ctx.ReadJSON(&entCat)
|
|
|
- if err != nil {
|
|
|
+
|
|
|
+ if err := c.Ctx.ReadJSON(&entCat); err != nil {
|
|
|
return ResultErr("读取数据失败", nil)
|
|
|
}
|
|
|
|
|
|
- err = c.Service.Create(&entCat)
|
|
|
+ err := c.Service.Create(&entCat)
|
|
|
if err != nil {
|
|
|
return ResultErr(err.Error(), nil)
|
|
|
} else {
|