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)
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()
}
`

View File

@ -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

View File

@ -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()
}
`