forked from x/icebergs
add some
This commit is contained in:
parent
ff0590852d
commit
bcdce97856
@ -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:
|
||||
|
@ -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
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user