houyaf 3 anni fa
parent
commit
8953f092e7
1 ha cambiato i file con 3 aggiunte e 3 eliminazioni
  1. 3 3
      web/controllers/group_cat_controller.go

+ 3 - 3
web/controllers/group_cat_controller.go

@@ -54,14 +54,14 @@ func (c *GroupCatController) Create() *JsonResult {
     ocId     := c.GetCurOcId()
     userId   := c.GetCurUserId()
     groupCat := datamodels.GroupCat{}
-    err := c.Ctx.ReadJSON(&groupCat)
-    if err != nil {
+    
+    if err := c.Ctx.ReadJSON(&groupCat); err != nil {
         return ResultErr("读取数据失败", nil)
     }
     
     groupCat.OcId = ocId
     groupCat.CreatedBy = userId
-    err = c.Service.Create(&groupCat)
+    err := c.Service.Create(&groupCat)
     if err != nil {
         return ResultErr(err.Error(), nil)
     } else {