Bladeren bron

睿姿得数据保存

gmy 1 maand geleden
bovenliggende
commit
914bc5dfb0
3 gewijzigde bestanden met toevoegingen van 50 en 0 verwijderingen
  1. 34 0
      controllers/base_from_rzd.go
  2. 7 0
      models/base_from_rzd_data.go
  3. 9 0
      routers/commentsRouter.go

+ 34 - 0
controllers/base_from_rzd.go

@@ -632,3 +632,37 @@ func (this *BaseFromRzdController) AddBatchRzdEdbData() {
 	br.Success = true
 	br.Msg = "处理成功"
 }
+
+// UpdateRzdEdbData
+// @Title 修改指标数据
+// @Description 修改指标数据
+// @Success 200 string "处理成功"
+// @router /update/rzd/edb/data [post]
+func (this *BaseFromRzdController) UpdateRzdEdbData() {
+	br := new(models.BaseResponse).Init()
+	var cacheKey string
+	defer func() {
+		if br.ErrMsg == "" {
+			br.IsSendEmail = false
+		}
+		_ = utils.Rc.Delete(cacheKey)
+		this.Data["json"] = br
+		this.ServeJSON()
+	}()
+	var req models.BaseFromRzdData
+	err := json.Unmarshal(this.Ctx.Input.RequestBody, &req)
+	if err != nil {
+		br.Msg = "参数解析异常!"
+		br.ErrMsg = "参数解析失败,Err:" + err.Error()
+		return
+	}
+
+	err = models.UpdateRzdData(&req)
+	if err != nil {
+		return
+	}
+
+	br.Ret = 200
+	br.Success = true
+	br.Msg = "处理成功"
+}

+ 7 - 0
models/base_from_rzd_data.go

@@ -62,3 +62,10 @@ func GetBaseFromRzdDataByCondition(condition string, pars []interface{}) (items
 	}
 	return
 }
+
+// UpdateRzdData 修改睿姿得数据
+func UpdateRzdData(item *BaseFromRzdData) (err error) {
+	o := orm.NewOrm()
+	_, err = o.Update(item)
+	return
+}

+ 9 - 0
routers/commentsRouter.go

@@ -349,6 +349,15 @@ func init() {
             Filters: nil,
             Params: nil})
 
+    beego.GlobalControllerRouter["eta/eta_index_lib/controllers:BaseFromRzdController"] = append(beego.GlobalControllerRouter["eta/eta_index_lib/controllers:BaseFromRzdController"],
+        beego.ControllerComments{
+            Method: "UpdateRzdEdbData",
+            Router: `/update/rzd/edb/data`,
+            AllowHTTPMethods: []string{"post"},
+            MethodParams: param.Make(),
+            Filters: nil,
+            Params: nil})
+
     beego.GlobalControllerRouter["eta/eta_index_lib/controllers:BaseFromRzdController"] = append(beego.GlobalControllerRouter["eta/eta_index_lib/controllers:BaseFromRzdController"],
         beego.ControllerComments{
             Method: "UpdateRzdEdbDataById",