From dec41734bd1c39c6622c07e5f4a34aafddb46b50 Mon Sep 17 00:00:00 2001 From: fugr Date: Thu, 22 Oct 2015 11:32:21 +0800 Subject: [PATCH] ServeJson-->ServeJSON,update to match beego develop --- apiapp.go | 24 ++++++++++++------------ g_appcode.go | 12 ++++++------ g_controllers.go | 12 ++++++------ 3 files changed, 24 insertions(+), 24 deletions(-) diff --git a/apiapp.go b/apiapp.go index 8983cdf..ec6bb95 100644 --- a/apiapp.go +++ b/apiapp.go @@ -309,7 +309,7 @@ func (o *ObjectController) Post() { json.Unmarshal(o.Ctx.Input.RequestBody, &ob) objectid := models.AddOne(ob) o.Data["json"] = map[string]string{"ObjectId": objectid} - o.ServeJson() + o.ServeJSON() } // @Title Get @@ -328,7 +328,7 @@ func (o *ObjectController) Get() { o.Data["json"] = ob } } - o.ServeJson() + o.ServeJSON() } // @Title GetAll @@ -339,7 +339,7 @@ func (o *ObjectController) Get() { func (o *ObjectController) GetAll() { obs := models.GetAll() o.Data["json"] = obs - o.ServeJson() + o.ServeJSON() } // @Title update @@ -360,7 +360,7 @@ func (o *ObjectController) Put() { } else { o.Data["json"] = "update success!" } - o.ServeJson() + o.ServeJSON() } // @Title delete @@ -373,7 +373,7 @@ func (o *ObjectController) Delete() { objectId := o.Ctx.Input.Params[":objectId"] models.Delete(objectId) o.Data["json"] = "delete success!" - o.ServeJson() + o.ServeJSON() } ` @@ -402,7 +402,7 @@ func (u *UserController) Post() { json.Unmarshal(u.Ctx.Input.RequestBody, &user) uid := models.AddUser(user) u.Data["json"] = map[string]string{"uid": uid} - u.ServeJson() + u.ServeJSON() } // @Title Get @@ -412,7 +412,7 @@ func (u *UserController) Post() { func (u *UserController) GetAll() { users := models.GetAllUsers() u.Data["json"] = users - u.ServeJson() + u.ServeJSON() } // @Title Get @@ -431,7 +431,7 @@ func (u *UserController) Get() { u.Data["json"] = user } } - u.ServeJson() + u.ServeJSON() } // @Title update @@ -453,7 +453,7 @@ func (u *UserController) Put() { u.Data["json"] = uu } } - u.ServeJson() + u.ServeJSON() } // @Title delete @@ -466,7 +466,7 @@ func (u *UserController) Delete() { uid := u.GetString(":uid") models.DeleteUser(uid) u.Data["json"] = "delete success!" - u.ServeJson() + u.ServeJSON() } // @Title login @@ -484,7 +484,7 @@ func (u *UserController) Login() { } else { u.Data["json"] = "user not exist" } - u.ServeJson() + u.ServeJSON() } // @Title logout @@ -493,7 +493,7 @@ func (u *UserController) Login() { // @router /logout [get] func (u *UserController) Logout() { u.Data["json"] = "logout success" - u.ServeJson() + u.ServeJSON() } ` diff --git a/g_appcode.go b/g_appcode.go index 5607e77..0869359 100644 --- a/g_appcode.go +++ b/g_appcode.go @@ -1178,7 +1178,7 @@ func (c *{{ctrlName}}Controller) Post() { } else { c.Data["json"] = err.Error() } - c.ServeJson() + c.ServeJSON() } // @Title Get @@ -1196,7 +1196,7 @@ func (c *{{ctrlName}}Controller) GetOne() { } else { c.Data["json"] = v } - c.ServeJson() + c.ServeJSON() } // @Title Get All @@ -1244,7 +1244,7 @@ func (c *{{ctrlName}}Controller) GetAll() { kv := strings.Split(cond, ":") if len(kv) != 2 { c.Data["json"] = errors.New("Error: invalid query key/value pair") - c.ServeJson() + c.ServeJSON() return } k, v := kv[0], kv[1] @@ -1258,7 +1258,7 @@ func (c *{{ctrlName}}Controller) GetAll() { } else { c.Data["json"] = l } - c.ServeJson() + c.ServeJSON() } // @Title Update @@ -1278,7 +1278,7 @@ func (c *{{ctrlName}}Controller) Put() { } else { c.Data["json"] = err.Error() } - c.ServeJson() + c.ServeJSON() } // @Title Delete @@ -1295,7 +1295,7 @@ func (c *{{ctrlName}}Controller) Delete() { } else { c.Data["json"] = err.Error() } - c.ServeJson() + c.ServeJSON() } ` ROUTER_TPL = `// @APIVersion 1.0.0 diff --git a/g_controllers.go b/g_controllers.go index 30bc86c..92be420 100644 --- a/g_controllers.go +++ b/g_controllers.go @@ -181,7 +181,7 @@ func (c *{{controllerName}}Controller) Post() { } else { c.Data["json"] = err.Error() } - c.ServeJson() + c.ServeJSON() } // @Title Get @@ -199,7 +199,7 @@ func (c *{{controllerName}}Controller) GetOne() { } else { c.Data["json"] = v } - c.ServeJson() + c.ServeJSON() } // @Title Get All @@ -247,7 +247,7 @@ func (c *{{controllerName}}Controller) GetAll() { kv := strings.Split(cond, ":") if len(kv) != 2 { c.Data["json"] = errors.New("Error: invalid query key/value pair") - c.ServeJson() + c.ServeJSON() return } k, v := kv[0], kv[1] @@ -261,7 +261,7 @@ func (c *{{controllerName}}Controller) GetAll() { } else { c.Data["json"] = l } - c.ServeJson() + c.ServeJSON() } // @Title Update @@ -281,7 +281,7 @@ func (c *{{controllerName}}Controller) Put() { } else { c.Data["json"] = err.Error() } - c.ServeJson() + c.ServeJSON() } // @Title Delete @@ -298,6 +298,6 @@ func (c *{{controllerName}}Controller) Delete() { } else { c.Data["json"] = err.Error() } - c.ServeJson() + c.ServeJSON() } `