// @Title Get // @Description find object by objectid // @Param objectId path string true "the objectid you want to get" // @Success 200 {object} models.Object // @Failure 403 :objectId is empty // @router /:objectId [get] func (o *ObjectController) Get() { objectId := o.Ctx.Input.Params[":objectId"] if objectId != "" { ob, err := models.GetOne(objectId) if err != nil { o.Data["json"] = err } else { o.Data["json"] = ob } } o.ServeJson() }
// @Title Get // @Description find object by objectid // @Param objectId path string true "the objectid you want to get" // @Success 200 {object} models.Object // @Failure 403 :objectId is empty // @router /:objectId [get] func (o *PriceController) Get() { fmt.Println("test") for k, _ := range o.Ctx.Input.Params { fmt.Println("key:%s , value:%s", k, o.Ctx.Input.Params[k]) } objectId := o.Ctx.Input.Params[":objectId"] if objectId != "" { ob, err := models.GetOne(objectId) if err != nil { o.Data["json"] = err } else { o.Data["json"] = ob } } o.ServeJson() }