http status code of api racs/getfaillist base on return result

This commit is contained in:
r0n1n7an 2024-11-22 15:29:30 +08:00
parent 7a3a282c71
commit 802d301cb5
2 changed files with 6 additions and 7 deletions

View File

@ -585,7 +585,6 @@ func handleRacsGetFailList(w http.ResponseWriter, r *http.Request) {
"[]{", "[",
"}},", "}],",
)
if rst["List"] != nil {
jsonData, err := json.MarshalIndent(rst, "", "\t")
if err != nil {
@ -600,7 +599,11 @@ func handleRacsGetFailList(w http.ResponseWriter, r *http.Request) {
fmt.Fprintf(w, "%v", rpl.Replace(string(jsonData)))
return
}
w.WriteHeader(http.StatusOK)
if rst["Result"] != "OK" {
w.WriteHeader(http.StatusInternalServerError)
} else {
w.WriteHeader(http.StatusOK)
}
fmt.Fprintf(w, "%v", rpl.Replace(fmt.Sprintf("%#v", rst)))
}

View File

@ -18,8 +18,4 @@ MySQL:
OfflineView: v_offline
StorageTable: racs
GetFailListSQL: SELECT * FROM v_racs
Remark:
Columns_UutInfo: [usn,mac,ipaddr,status,message,first_ack,last_ack,last_change]
Columns_LocInfo: [mac,line,col,row,num,last_found]
USER_RO: ewsv3:ewsv3
USER_RW: apisvc:wcqte