fix: get alarms from NFs

This commit is contained in:
2023-10-24 18:52:38 +08:00
parent bcec4e13ae
commit 22e53ea20f
2 changed files with 16 additions and 7 deletions

View File

@@ -491,15 +491,24 @@ func GetAlarmFromNF(w http.ResponseWriter, r *http.Request) {
//services.ResponseInternalServerError500ProcessError(w, err)
continue
}
body := response.Body()
log.Debug("Request body:", string(body))
alarmArray := new([]Alarm)
err = json.Unmarshal(body, &alarmArray)
if err != nil {
log.Error("Failed to Unmarshal:", err)
//services.ResponseInternalServerError500ProcessError(w, err)
switch response.StatusCode() {
case http.StatusOK, http.StatusCreated, http.StatusNoContent, http.StatusAccepted:
body := response.Body()
log.Debug("Request body:", string(body))
err = json.Unmarshal(body, &alarmArray)
if err != nil {
log.Error("Failed to Unmarshal:", err)
//services.ResponseInternalServerError500ProcessError(w, err)
continue
}
default:
log.Error("Failed to get alarms:", response.Status)
continue
}
valueJson, err := dborm.XormGetAAConfig()
if err != nil {
log.Error("Failed to XormGetAAConfig:", err)