This commit is contained in:
2023-08-31 16:27:32 +08:00
parent a15d5568ef
commit b0ad4f0a19

View File

@@ -399,23 +399,25 @@ func ParseRawMsg2Html(w http.ResponseWriter, r *http.Request) {
return
}
log.Trace("traceData:", traceData)
htmlFile := fmt.Sprintf("traceDecMessage-%d-%d.html", traceData.TaskID, traceData.ID)
pathFile := config.GetYamlConfig().OMC.FrontTraceDir + "/" + htmlFile
command := fmt.Sprintf("ipdata2html -f %s -t %d -i N%d -d %x", pathFile, traceData.Timestamp, traceData.IfType, traceData.RawMsg)
out, err := run.ExecCmd(command, "/")
log.Tracef("Exec output: %v", string(out))
if err != nil {
log.Errorf("Faile to ipdate2html:", err)
services.ResponseInternalServerError500ProcessError(w, err)
return
pathFile := traceData.DecMsg
if traceData.DecMsg == "" {
htmlFile := fmt.Sprintf("traceDecMessage-%d-%d.html", traceData.TaskID, traceData.ID)
pathFile = config.GetYamlConfig().OMC.FrontTraceDir + "/" + htmlFile
command := fmt.Sprintf("ipdata2html -f %s -t %d -i N%d -d %x", pathFile, traceData.Timestamp, traceData.IfType, traceData.RawMsg)
out, err := run.ExecCmd(command, "/")
log.Tracef("Exec output: %v", string(out))
if err != nil {
log.Errorf("Faile to ipdate2html:", err)
services.ResponseInternalServerError500ProcessError(w, err)
return
}
traceData.DecMsg = pathFile
_, err = dborm.XormUpdateTraceData(id, traceData)
if err != nil {
log.Errorf("Faile to XormUpdateTraceData:", err)
services.ResponseInternalServerError500ProcessError(w, err)
return
}
}
traceData.DecMsg = pathFile
_, err = dborm.XormUpdateTraceData(id, traceData)
if err != nil {
log.Errorf("Faile to XormUpdateTraceData:", err)
services.ResponseInternalServerError500ProcessError(w, err)
return
}
services.ResponseHtmlContent(w, http.StatusOK, pathFile)
}