From 1214326cbf8111b5819c0473e57b0ecb293fd6eb Mon Sep 17 00:00:00 2001
From: liuxiaolong <736321739@qq.com>
Date: 星期三, 03 七月 2019 20:22:19 +0800
Subject: [PATCH] fix bug
---
controllers/area.go | 26 ++++++++++++++++++--------
1 files changed, 18 insertions(+), 8 deletions(-)
diff --git a/controllers/area.go b/controllers/area.go
index 6dbf8e8..c4ba15d 100644
--- a/controllers/area.go
+++ b/controllers/area.go
@@ -83,21 +83,31 @@
// @Accept json
// @Produce json
// @Tags menu
-// @Param id path int true "鍖哄煙id"
-// @Param area body controllers.AreaVo true "鍖哄煙缁撴瀯"
+// @Param id query int true "鍖哄煙id"
+// @Param name query string true "鍖哄煙鍚嶅瓧"
+// @Param parentId query int true "涓婁竴绾х埗id"
// @Success 200 {string} json "{"code":200, data:"",msg:"璇锋眰鎴愬姛", success:true}"
// @Failure 200 {string} json "{"code":"閿欒鐮�", data:"鍑洪敊淇℃伅",msg:"璇锋眰澶辫触", success:false}"
// @Router /data/api-v/area/update [post]
func (ac AreaController) AreaUpdate(c *gin.Context) {
- var api dbapi.AreaApi
- var model AreaVo
-
- if err := c.BindJSON(&model);err !=nil {
- util.ResponseFormat(c, code.ComError, "鍙傛暟鏈夎")
+ id,err := strconv.Atoi(c.PostForm("id"))
+ if err !=nil{
+ util.ResponseFormat(c, code.RequestParamError, "鍙傛暟閿欒")
return
}
-
+ name := c.PostForm("name")
+ parentId, err := strconv.Atoi(c.PostForm("parentId"))
+ if err !=nil {
+ util.ResponseFormat(c, code.RequestParamError, "parentId鍙傛暟閿欒")
+ return
+ }
+ var model = AreaVo{
+ Id:id,
+ ParentId:parentId,
+ Name:name,
+ }
paramBody := util.Struct2Map(model)
+ var api dbapi.AreaApi
if api.AreaUpdate(paramBody) {
util.ResponseFormat(c,code.Success,"鏇存柊鎴愬姛")
}else {
--
Gitblit v1.8.0