|
@@ -25,8 +25,9 @@ func (c *AppCatController) GetList() *JsonResult {
|
|
|
data, err := c.Service.GetList(params)
|
|
data, err := c.Service.GetList(params)
|
|
|
if err != nil {
|
|
if err != nil {
|
|
|
return ResultErr(err.Error(), nil)
|
|
return ResultErr(err.Error(), nil)
|
|
|
|
|
+ } else {
|
|
|
|
|
+ return ResultOk("获取成功", data)
|
|
|
}
|
|
}
|
|
|
- return ResultOk("获取成功", data)
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
func (c *AppCatController) GetPage() *JsonResult {
|
|
func (c *AppCatController) GetPage() *JsonResult {
|
|
@@ -50,13 +51,13 @@ func (c *AppCatController) GetById(appCatId int64) *JsonResult {
|
|
|
|
|
|
|
|
func (c *AppCatController) Create() *JsonResult {
|
|
func (c *AppCatController) Create() *JsonResult {
|
|
|
userId := c.GetCurUserId()
|
|
userId := c.GetCurUserId()
|
|
|
- appCat := datamodels.AppCat{}
|
|
|
|
|
- appCat.CreatedBy = userId
|
|
|
|
|
|
|
|
|
|
|
|
+ appCat := datamodels.AppCat{}
|
|
|
if err := c.Ctx.ReadJSON(&appCat); err != nil {
|
|
if err := c.Ctx.ReadJSON(&appCat); err != nil {
|
|
|
return ResultErr("读取数据失败", nil)
|
|
return ResultErr("读取数据失败", nil)
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ appCat.CreatedBy = userId
|
|
|
if err := c.Service.Create(&appCat); err != nil {
|
|
if err := c.Service.Create(&appCat); err != nil {
|
|
|
return ResultErr(err.Error(), nil)
|
|
return ResultErr(err.Error(), nil)
|
|
|
} else {
|
|
} else {
|
|
@@ -66,6 +67,7 @@ func (c *AppCatController) Create() *JsonResult {
|
|
|
|
|
|
|
|
func (c *AppCatController) Update() *JsonResult {
|
|
func (c *AppCatController) Update() *JsonResult {
|
|
|
userId := c.GetCurUserId()
|
|
userId := c.GetCurUserId()
|
|
|
|
|
+
|
|
|
appCat := datamodels.AppCat{}
|
|
appCat := datamodels.AppCat{}
|
|
|
if err := c.Ctx.ReadJSON(&appCat); err != nil {
|
|
if err := c.Ctx.ReadJSON(&appCat); err != nil {
|
|
|
return ResultErr("读取数据失败", nil)
|
|
return ResultErr("读取数据失败", nil)
|