run_log.go 780 B

1234567891011121314151617181920212223242526272829303132333435
  1. package controllers
  2. import (
  3. "encoding/json"
  4. "hongze/hongze_api/models"
  5. "hongze/hongze_api/utils"
  6. )
  7. type RunLogController struct {
  8. BaseCommonController
  9. }
  10. // @Title 保存运行日志
  11. // @Description 保存运行日志
  12. // @Param request body models.RunLogReq true "type json string"
  13. // @Success Ret=200
  14. // @router /save [post]
  15. func (this *RunLogController) Edit() {
  16. br := new(models.BaseResponse).Init()
  17. defer func() {
  18. this.Data["json"] = br
  19. this.ServeJSON()
  20. }()
  21. var req models.RunLogReq
  22. err := json.Unmarshal(this.Ctx.Input.RequestBody, &req)
  23. if err != nil {
  24. br.Msg = "参数解析异常!"
  25. br.ErrMsg = "参数解析失败,Err:" + err.Error()
  26. return
  27. }
  28. utils.FileRunLog.Info("%s", req.RunMsg)
  29. br.Ret = 200
  30. br.Success = true
  31. br.Msg = "保存成功"
  32. }