mirror of
https://github.com/astaxie/beego.git
synced 2024-11-22 12:50:55 +00:00
update example
This commit is contained in:
parent
83e26fdc9b
commit
44f5c208b6
@ -12,7 +12,7 @@ type ObjectController struct {
|
|||||||
|
|
||||||
func (this *ObjectController) Post() {
|
func (this *ObjectController) Post() {
|
||||||
var ob models.Object
|
var ob models.Object
|
||||||
json.Unmarshal(this.Ctx.RequestBody, &ob)
|
json.Unmarshal(this.Ctx.Input.RequestBody, &ob)
|
||||||
objectid := models.AddOne(ob)
|
objectid := models.AddOne(ob)
|
||||||
this.Data["json"] = map[string]string{"ObjectId": objectid}
|
this.Data["json"] = map[string]string{"ObjectId": objectid}
|
||||||
this.ServeJson()
|
this.ServeJson()
|
||||||
@ -37,7 +37,7 @@ func (this *ObjectController) Get() {
|
|||||||
func (this *ObjectController) Put() {
|
func (this *ObjectController) Put() {
|
||||||
objectId := this.Ctx.Params[":objectId"]
|
objectId := this.Ctx.Params[":objectId"]
|
||||||
var ob models.Object
|
var ob models.Object
|
||||||
json.Unmarshal(this.Ctx.RequestBody, &ob)
|
json.Unmarshal(this.Ctx.Input.RequestBody, &ob)
|
||||||
|
|
||||||
err := models.Update(objectId, ob.Score)
|
err := models.Update(objectId, ob.Score)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
Loading…
Reference in New Issue
Block a user