From 0ea4c5de6a87f8e0328e195868e5048f41a6400d Mon Sep 17 00:00:00 2001 From: shylinux Date: Mon, 6 Apr 2020 15:32:50 +0800 Subject: [PATCH 1/3] fix route --- base/web/web.go | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/base/web/web.go b/base/web/web.go index 95ab145b..33e187cd 100644 --- a/base/web/web.go +++ b/base/web/web.go @@ -1775,11 +1775,22 @@ var Index = &ice.Context{Name: "web", Help: "网络模块", return } - m.Richs(ice.WEB_SPACE, nil, kit.Select("*", arg, 0), func(key string, value map[string]interface{}) { + target, rest := "*", "" + if len(arg) > 0 { + ls := strings.SplitN(arg[0], ".", 2) + if target = ls[0]; len(ls) > 1 { + rest = ls[1] + } + } + m.Richs(ice.WEB_SPACE, nil, target, func(key string, value map[string]interface{}) { if len(arg) > 1 { + ls := []interface{}{ice.WEB_SPACE, value[kit.MDB_NAME]} m.Call(false, func(res *ice.Message) *ice.Message { return res }) // 发送命令 - m.Cmdy(ice.WEB_SPACE, value[kit.MDB_NAME], arg[1:]) + if rest != "" { + ls = append(ls, ice.WEB_SPACE, rest) + } + m.Cmdy(ls, arg[1:]) return } From 1bd6af5738c85aeed8b6782eab52368a59073d48 Mon Sep 17 00:00:00 2001 From: shylinux Date: Mon, 6 Apr 2020 15:42:25 +0800 Subject: [PATCH 2/3] fix send --- base/web/web.go | 1 + 1 file changed, 1 insertion(+) diff --git a/base/web/web.go b/base/web/web.go index 33e187cd..0c8d49e8 100644 --- a/base/web/web.go +++ b/base/web/web.go @@ -876,6 +876,7 @@ var Index = &ice.Context{Name: "web", Help: "网络模块", m.Optionv(k, m.Optionv(k)) } } + m.Option("_option", m.Optionv("_option")) // 构造路由 id := kit.Format(c.ID()) From cb79a8068bca9d1230d2018c14d4a9bfeacc5900 Mon Sep 17 00:00:00 2001 From: shaoying Date: Wed, 8 Apr 2020 18:24:04 +0800 Subject: [PATCH 3/3] opt alpha --- base/web/web.go | 4 +--- misc/alpha/alpha.go | 2 +- misc/zsh/zsh.go | 5 +++++ 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/base/web/web.go b/base/web/web.go index 0c8d49e8..0674c5e0 100644 --- a/base/web/web.go +++ b/base/web/web.go @@ -876,7 +876,6 @@ var Index = &ice.Context{Name: "web", Help: "网络模块", m.Optionv(k, m.Optionv(k)) } } - m.Option("_option", m.Optionv("_option")) // 构造路由 id := kit.Format(c.ID()) @@ -1133,8 +1132,7 @@ var Index = &ice.Context{Name: "web", Help: "网络模块", m.Info("routine %v", favor) m.Gos(m, func(m *ice.Message) { m.Grows(ice.WEB_FAVOR, kit.Keys(kit.MDB_HASH, key), "", "", func(index int, value map[string]interface{}) { - - if strings.Contains(kit.Format(value["name"]), arg[1]) || strings.Contains(kit.Format(value["text"]), arg[1]) { + if strings.Contains(favor, arg[1]) || strings.Contains(kit.Format(value["name"]), arg[1]) || strings.Contains(kit.Format(value["text"]), arg[1]) { m.Push("pod", strings.Join(kit.Simple(m.Optionv("user.pod")), ".")) m.Push("favor", favor) m.Push("", value, []string{"id", "type", "name", "text"}) diff --git a/misc/alpha/alpha.go b/misc/alpha/alpha.go index 7c1e629a..b9faa2f2 100644 --- a/misc/alpha/alpha.go +++ b/misc/alpha/alpha.go @@ -92,7 +92,7 @@ var Index = &ice.Context{Name: "alpha", Help: "英汉词典", m.Cmdy("list", "ecdict", count-rand.Intn(count), 1) } }}, - "search": {Name: "search [word [method]]", Help: "查找词汇", Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) { + "trans": {Name: "trans [word [method]]", Help: "查找词汇", Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) { if len(arg) == 0 { // 收藏列表 m.Cmdy(ice.WEB_FAVOR, "alpha.word") diff --git a/misc/zsh/zsh.go b/misc/zsh/zsh.go index 7a55a96f..410377f7 100644 --- a/misc/zsh/zsh.go +++ b/misc/zsh/zsh.go @@ -50,6 +50,11 @@ var Index = &ice.Context{Name: "zsh", Help: "命令行", switch arg[0] { case "history": vs := strings.SplitN(strings.TrimSpace(m.Option("arg")), " ", 4) + if strings.Contains(m.Option("SHELL"), "zsh") { + vs = []string{vs[0], "", "", strings.Join(vs[1:], " ")} + + } + cmds := []string{ice.WEB_FAVOR, m.Conf("zsh", "meta.history"), ice.TYPE_SHELL, vs[0], kit.Select("", vs, 3), "sid", m.Option("sid"), "pwd", m.Option("pwd"), "time", vs[1] + " " + vs[2]}