mirror of
https://gitee.com/dromara/mayfly-go
synced 2025-11-29 04:20:25 +08:00
feat: 新增机器状态查看&机器状态等
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
package api
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"fmt"
|
||||
"mayfly-go/base/biz"
|
||||
"mayfly-go/base/ctx"
|
||||
@@ -46,10 +45,8 @@ func (m *Machine) Machines(rc *ctx.ReqCtx) {
|
||||
}
|
||||
|
||||
func (m *Machine) MachineStats(rc *ctx.ReqCtx) {
|
||||
writer := bytes.NewBufferString("")
|
||||
stats := m.MachineApp.GetCli(GetMachineId(rc.GinCtx)).GetAllStats()
|
||||
machine.ShowStats(writer, stats)
|
||||
rc.ResData = writer.String()
|
||||
rc.ResData = stats
|
||||
}
|
||||
|
||||
func (m *Machine) SaveMachine(rc *ctx.ReqCtx) {
|
||||
@@ -64,6 +61,14 @@ func (m *Machine) SaveMachine(rc *ctx.ReqCtx) {
|
||||
m.MachineApp.Save(entity)
|
||||
}
|
||||
|
||||
func (m *Machine) ChangeStatus(rc *ctx.ReqCtx) {
|
||||
g := rc.GinCtx
|
||||
id := uint64(ginx.PathParamInt(g, "machineId"))
|
||||
status := int8(ginx.PathParamInt(g, "status"))
|
||||
rc.ReqParam = fmt.Sprintf("id: %d -- status: %d", id, status)
|
||||
m.MachineApp.ChangeStatus(id, status)
|
||||
}
|
||||
|
||||
func (m *Machine) DeleteMachine(rc *ctx.ReqCtx) {
|
||||
id := uint64(ginx.PathParamInt(rc.GinCtx, "machineId"))
|
||||
rc.ReqParam = id
|
||||
|
||||
Reference in New Issue
Block a user