|
|
|
@ -16,6 +16,13 @@ import ( |
|
|
|
"google.golang.org/protobuf/proto" |
|
|
|
) |
|
|
|
|
|
|
|
// 返回json数据
|
|
|
|
type SysResp struct { |
|
|
|
Status int `json:"status"` |
|
|
|
Message string `json:"message"` |
|
|
|
Data interface{} `json:"data"` |
|
|
|
} |
|
|
|
|
|
|
|
// 系统监控
|
|
|
|
func SysMonitor(w http.ResponseWriter, r *http.Request) { |
|
|
|
// 设置 CORS 头部
|
|
|
|
@ -107,5 +114,13 @@ func SysMonitor(w http.ResponseWriter, r *http.Request) { |
|
|
|
http.Error(w, err.Error(), http.StatusInternalServerError) |
|
|
|
} |
|
|
|
w.Header().Set("Content-Type", "application/json") |
|
|
|
|
|
|
|
// 生成json数据
|
|
|
|
jsondata, err = json.Marshal(SysResp{ |
|
|
|
Status: 0, |
|
|
|
Message: "success", |
|
|
|
Data: hdinfo, |
|
|
|
}) |
|
|
|
//
|
|
|
|
w.Write(jsondata) |
|
|
|
} |
|
|
|
|