1
0
mirror of https://github.com/beego/bee.git synced 2024-11-22 15:10:54 +00:00

Merge pull request #135 from fugr/develop

update to match beego develop
This commit is contained in:
astaxie 2015-10-23 01:54:05 +08:00
commit 25eedc9a1a
3 changed files with 24 additions and 24 deletions

View File

@ -309,7 +309,7 @@ func (o *ObjectController) Post() {
json.Unmarshal(o.Ctx.Input.RequestBody, &ob) json.Unmarshal(o.Ctx.Input.RequestBody, &ob)
objectid := models.AddOne(ob) objectid := models.AddOne(ob)
o.Data["json"] = map[string]string{"ObjectId": objectid} o.Data["json"] = map[string]string{"ObjectId": objectid}
o.ServeJson() o.ServeJSON()
} }
// @Title Get // @Title Get
@ -328,7 +328,7 @@ func (o *ObjectController) Get() {
o.Data["json"] = ob o.Data["json"] = ob
} }
} }
o.ServeJson() o.ServeJSON()
} }
// @Title GetAll // @Title GetAll
@ -339,7 +339,7 @@ func (o *ObjectController) Get() {
func (o *ObjectController) GetAll() { func (o *ObjectController) GetAll() {
obs := models.GetAll() obs := models.GetAll()
o.Data["json"] = obs o.Data["json"] = obs
o.ServeJson() o.ServeJSON()
} }
// @Title update // @Title update
@ -360,7 +360,7 @@ func (o *ObjectController) Put() {
} else { } else {
o.Data["json"] = "update success!" o.Data["json"] = "update success!"
} }
o.ServeJson() o.ServeJSON()
} }
// @Title delete // @Title delete
@ -373,7 +373,7 @@ func (o *ObjectController) Delete() {
objectId := o.Ctx.Input.Params[":objectId"] objectId := o.Ctx.Input.Params[":objectId"]
models.Delete(objectId) models.Delete(objectId)
o.Data["json"] = "delete success!" o.Data["json"] = "delete success!"
o.ServeJson() o.ServeJSON()
} }
` `
@ -402,7 +402,7 @@ func (u *UserController) Post() {
json.Unmarshal(u.Ctx.Input.RequestBody, &user) json.Unmarshal(u.Ctx.Input.RequestBody, &user)
uid := models.AddUser(user) uid := models.AddUser(user)
u.Data["json"] = map[string]string{"uid": uid} u.Data["json"] = map[string]string{"uid": uid}
u.ServeJson() u.ServeJSON()
} }
// @Title Get // @Title Get
@ -412,7 +412,7 @@ func (u *UserController) Post() {
func (u *UserController) GetAll() { func (u *UserController) GetAll() {
users := models.GetAllUsers() users := models.GetAllUsers()
u.Data["json"] = users u.Data["json"] = users
u.ServeJson() u.ServeJSON()
} }
// @Title Get // @Title Get
@ -431,7 +431,7 @@ func (u *UserController) Get() {
u.Data["json"] = user u.Data["json"] = user
} }
} }
u.ServeJson() u.ServeJSON()
} }
// @Title update // @Title update
@ -453,7 +453,7 @@ func (u *UserController) Put() {
u.Data["json"] = uu u.Data["json"] = uu
} }
} }
u.ServeJson() u.ServeJSON()
} }
// @Title delete // @Title delete
@ -466,7 +466,7 @@ func (u *UserController) Delete() {
uid := u.GetString(":uid") uid := u.GetString(":uid")
models.DeleteUser(uid) models.DeleteUser(uid)
u.Data["json"] = "delete success!" u.Data["json"] = "delete success!"
u.ServeJson() u.ServeJSON()
} }
// @Title login // @Title login
@ -484,7 +484,7 @@ func (u *UserController) Login() {
} else { } else {
u.Data["json"] = "user not exist" u.Data["json"] = "user not exist"
} }
u.ServeJson() u.ServeJSON()
} }
// @Title logout // @Title logout
@ -493,7 +493,7 @@ func (u *UserController) Login() {
// @router /logout [get] // @router /logout [get]
func (u *UserController) Logout() { func (u *UserController) Logout() {
u.Data["json"] = "logout success" u.Data["json"] = "logout success"
u.ServeJson() u.ServeJSON()
} }
` `

View File

@ -1178,7 +1178,7 @@ func (c *{{ctrlName}}Controller) Post() {
} else { } else {
c.Data["json"] = err.Error() c.Data["json"] = err.Error()
} }
c.ServeJson() c.ServeJSON()
} }
// @Title Get // @Title Get
@ -1196,7 +1196,7 @@ func (c *{{ctrlName}}Controller) GetOne() {
} else { } else {
c.Data["json"] = v c.Data["json"] = v
} }
c.ServeJson() c.ServeJSON()
} }
// @Title Get All // @Title Get All
@ -1244,7 +1244,7 @@ func (c *{{ctrlName}}Controller) GetAll() {
kv := strings.Split(cond, ":") kv := strings.Split(cond, ":")
if len(kv) != 2 { if len(kv) != 2 {
c.Data["json"] = errors.New("Error: invalid query key/value pair") c.Data["json"] = errors.New("Error: invalid query key/value pair")
c.ServeJson() c.ServeJSON()
return return
} }
k, v := kv[0], kv[1] k, v := kv[0], kv[1]
@ -1258,7 +1258,7 @@ func (c *{{ctrlName}}Controller) GetAll() {
} else { } else {
c.Data["json"] = l c.Data["json"] = l
} }
c.ServeJson() c.ServeJSON()
} }
// @Title Update // @Title Update
@ -1278,7 +1278,7 @@ func (c *{{ctrlName}}Controller) Put() {
} else { } else {
c.Data["json"] = err.Error() c.Data["json"] = err.Error()
} }
c.ServeJson() c.ServeJSON()
} }
// @Title Delete // @Title Delete
@ -1295,7 +1295,7 @@ func (c *{{ctrlName}}Controller) Delete() {
} else { } else {
c.Data["json"] = err.Error() c.Data["json"] = err.Error()
} }
c.ServeJson() c.ServeJSON()
} }
` `
ROUTER_TPL = `// @APIVersion 1.0.0 ROUTER_TPL = `// @APIVersion 1.0.0

View File

@ -181,7 +181,7 @@ func (c *{{controllerName}}Controller) Post() {
} else { } else {
c.Data["json"] = err.Error() c.Data["json"] = err.Error()
} }
c.ServeJson() c.ServeJSON()
} }
// @Title Get // @Title Get
@ -199,7 +199,7 @@ func (c *{{controllerName}}Controller) GetOne() {
} else { } else {
c.Data["json"] = v c.Data["json"] = v
} }
c.ServeJson() c.ServeJSON()
} }
// @Title Get All // @Title Get All
@ -247,7 +247,7 @@ func (c *{{controllerName}}Controller) GetAll() {
kv := strings.Split(cond, ":") kv := strings.Split(cond, ":")
if len(kv) != 2 { if len(kv) != 2 {
c.Data["json"] = errors.New("Error: invalid query key/value pair") c.Data["json"] = errors.New("Error: invalid query key/value pair")
c.ServeJson() c.ServeJSON()
return return
} }
k, v := kv[0], kv[1] k, v := kv[0], kv[1]
@ -261,7 +261,7 @@ func (c *{{controllerName}}Controller) GetAll() {
} else { } else {
c.Data["json"] = l c.Data["json"] = l
} }
c.ServeJson() c.ServeJSON()
} }
// @Title Update // @Title Update
@ -281,7 +281,7 @@ func (c *{{controllerName}}Controller) Put() {
} else { } else {
c.Data["json"] = err.Error() c.Data["json"] = err.Error()
} }
c.ServeJson() c.ServeJSON()
} }
// @Title Delete // @Title Delete
@ -298,6 +298,6 @@ func (c *{{controllerName}}Controller) Delete() {
} else { } else {
c.Data["json"] = err.Error() c.Data["json"] = err.Error()
} }
c.ServeJson() c.ServeJSON()
} }
` `