add: 提交

This commit is contained in:
lichang
2023-08-14 17:02:50 +08:00
parent 897d45d443
commit 5ac2e981ea
163 changed files with 29466 additions and 0 deletions

View File

@@ -0,0 +1,51 @@
package monitor
import (
"net/http"
websocket2 "ems.agt/lib/websocket"
"ems.agt/restagent/config"
"github.com/gorilla/websocket"
)
var (
// 進程
UriWs = config.UriPrefix + "/monitor/{apiVersion}/process/ws"
)
var wsUpgrade = websocket.Upgrader{
CheckOrigin: func(r *http.Request) bool {
return true
},
}
func ProcessWs(w http.ResponseWriter, r *http.Request) {
ws, err := wsUpgrade.Upgrade(w, r, nil)
if err != nil {
return
}
wsClient := websocket2.NewWsClient("processClient", ws)
go wsClient.Read()
go wsClient.Write()
}
// @Tags Process
// @Summary Stop Process
// @Description 停止进程
// @Param request body request.ProcessReq true "request"
// @Success 200
// @Security ApiKeyAuth
// @Router /process/stop [post]
// @x-panel-log {"bodyKeys":["PID"],"paramKeys":[],"BeforeFuntions":[],"formatZH":"结束进程 [PID]","formatEN":"结束进程 [PID]"}
func StopProcess(w http.ResponseWriter, r *http.Request) {
// var req request.ProcessReq
// if err := c.ShouldBindJSON(&req); err != nil {
// helper.ErrorWithDetail(c, constant.CodeErrBadRequest, constant.ErrTypeInvalidParams, err)
// return
// }
// if err := processService.StopProcess(req); err != nil {
// helper.ErrorWithDetail(c, constant.CodeErrBadRequest, constant.ErrTypeInvalidParams, err)
// return
// }
// helper.SuccessWithOutData(c)
}