func (this *PointController) SavePoints() { result := make(map[string]interface{}) result["sucess"] = false result["message"] = "" //var post_data map[string]interface{} post_data := make(map[string]map[string]interface{}) if err := json.Unmarshal(this.Ctx.Input.RequestBody, &post_data); err != nil { result["message"] = err.Error() this.Data["json"] = result this.ServeJson() return } //beego.Info(post_data) for _, point := range post_data { model := models.Point{} model.Id = common.GetInt(point["Id"]) model.Name = common.GetString(point["Name"]) model.Type = common.GetInt16(point["Type"]) model.Hours = common.GetFloat64(point["Hours"]) model.Stars = common.GetFloat64(point["Stars"]) model.Points = common.GetFloat64(point["Points"]) model.StartTime = point["StartTime"].(string) model.EndTime = point["EndTime"].(string) beego.Info(model) err := model.InsertOrUpdate() if err != nil { result["message"] = err.Error() continue } } result["success"] = true result["datas"] = post_data this.Data["json"] = result this.ServeJson() }