From bcdce978567706637745fd503dc82731dcfe29c0 Mon Sep 17 00:00:00 2001 From: shy Date: Tue, 26 Nov 2024 23:12:53 +0800 Subject: [PATCH] add some --- base/web/spide.go | 3 ++- core/code/go.go | 25 ++++++++++++++++++------- 2 files changed, 20 insertions(+), 8 deletions(-) diff --git a/base/web/spide.go b/base/web/spide.go index dc65d929..4cad358d 100644 --- a/base/web/spide.go +++ b/base/web/spide.go @@ -114,8 +114,9 @@ func _spide_body(m *ice.Message, method string, arg ...string) (io.Reader, ice.M head := ice.Maps{} switch kit.If(len(arg) == 1, func() { arg = []string{SPIDE_DATA, arg[0]} }); arg[0] { case SPIDE_FORM: - arg = kit.Simple(arg, func(v string) string { return url.QueryEscape(v) }) + // arg = kit.Simple(arg, func(v string) string { return url.QueryEscape(v) }) head[html.ContentType], body = html.ApplicationForm, bytes.NewBufferString(kit.JoinQuery(arg[1:]...)) + m.Info("debug what %v", kit.JoinQuery(arg[1:]...)) case SPIDE_PART: head[html.ContentType], body = _spide_part(m, arg...) case SPIDE_FILE: diff --git a/core/code/go.go b/core/code/go.go index 3751f3d1..eedf4efa 100644 --- a/core/code/go.go +++ b/core/code/go.go @@ -85,13 +85,7 @@ func _go_show(m *ice.Message, arg ...string) { ctx.ProcessField(m, cmd, kit.Simple()) } else { ls := kit.Split(strings.TrimSuffix(arg[1], ".go"), "/") - table := kit.Select("", ls, -1) - if kit.HasSuffix(table, "y") { - table = table[:len(table)-1] + "ies" - } else { - table = table + "s" - } - ctx.ProcessField(m, "web.code.mysql.query", kit.Simple("mysql", ls[0], table)) + ctx.ProcessField(m, "web.code.mysql.query", kit.Simple("mysql", ls[0], TableName(kit.Select("", ls, -1)))) } return } @@ -225,3 +219,20 @@ func GoVersion(m *ice.Message) string { return m.Cmdx(cli.SYSTEM, GO, VERSION func GoBuild(m *ice.Message, target string, arg ...string) *ice.Message { return m.Cmdy(cli.SYSTEM, GO, cli.BUILD, "-ldflags", "-w -s", "-o", target, arg) } +func TableName(model string) string { + if strings.Contains("0123456789", model[len(model)-1:]) { + return model + } + if kit.IsIn(model, "sms", "equipment") { + + } else if kit.HasSuffix(model, "y") { + model = model[:len(model)-1] + "ies" + } else if kit.HasSuffix(model, "s") { + if !kit.HasSuffix(model, "os") { + model = model + "es" + } + } else { + model = model + "s" + } + return model +}