refactor: 分页组件统一替换&其他优化

This commit is contained in:
meilin.huang
2023-07-05 22:06:32 +08:00
parent f4ac6d8360
commit dc9a2985f3
23 changed files with 193 additions and 192 deletions

View File

@@ -12,6 +12,7 @@ import (
"mayfly-go/pkg/req"
"mayfly-go/pkg/utils"
"strconv"
"strings"
"github.com/gin-gonic/gin"
)
@@ -42,12 +43,15 @@ func (m *MachineScript) SaveMachineScript(rc *req.Ctx) {
}
func (m *MachineScript) DeleteMachineScript(rc *req.Ctx) {
msa := m.MachineScriptApp
sid := GetMachineScriptId(rc.GinCtx)
ms := msa.GetById(sid)
biz.NotNil(ms, "该脚本不存在")
rc.ReqParam = fmt.Sprintf("[scriptId: %d, name: %s, desc: %s, script: %s]", sid, ms.Name, ms.Description, ms.Script)
msa.Delete(sid)
idsStr := ginx.PathParam(rc.GinCtx, "scriptId")
rc.ReqParam = idsStr
ids := strings.Split(idsStr, ",")
for _, v := range ids {
value, err := strconv.Atoi(v)
biz.ErrIsNilAppendErr(err, "string类型转换为int异常: %s")
m.MachineScriptApp.Delete(uint64(value))
}
}
func (m *MachineScript) RunMachineScript(rc *req.Ctx) {