diff --git a/base/aaa/user.go b/base/aaa/user.go index 6c0c47d7..c24f2883 100644 --- a/base/aaa/user.go +++ b/base/aaa/user.go @@ -31,18 +31,33 @@ func _user_create(m *ice.Message, name, word string) { m.Event(USER_CREATE, name) } func _user_search(m *ice.Message, kind, name, text string, arg ...string) { + fields := kit.Split(m.Option(mdb.FIELDS)) m.Richs(USER, nil, kit.MDB_FOREACH, func(key string, val map[string]interface{}) { if name != "" && name != val[USERNAME] { return } - m.Push("pod", m.Option("pod")) - m.Push("ctx", "aaa") - m.Push("cmd", USER) - m.Push(key, val, []string{kit.MDB_TIME}) - m.Push(kit.MDB_SIZE, kit.Format("")) - m.Push(kit.MDB_TYPE, kit.Format(UserRole(m, val[USERNAME]))) - m.Push(kit.MDB_NAME, kit.Format(val[USERNICK])) - m.Push(kit.MDB_TEXT, kit.Format(val[USERNAME])) + for _, k := range fields { + switch k { + case kit.SSH_POD: + m.Push(k, m.Option(ice.MSG_USERPOD)) + case kit.SSH_CTX: + m.Push(k, m.Prefix()) + case kit.SSH_CMD: + m.Push(k, USER) + case kit.MDB_TIME: + m.Push(k, m.Time()) + case kit.MDB_SIZE: + m.Push(k, "") + case kit.MDB_TYPE: + m.Push(k, kit.Format(UserRole(m, val[USERNAME]))) + case kit.MDB_NAME: + m.Push(k, kit.Format(val[USERNICK])) + case kit.MDB_TEXT: + m.Push(k, kit.Format(val[USERNAME])) + default: + m.Push(k, "") + } + } }) } diff --git a/base/ctx/ctx.go b/base/ctx/ctx.go index e16acd43..d6ae1312 100644 --- a/base/ctx/ctx.go +++ b/base/ctx/ctx.go @@ -42,7 +42,7 @@ var Index = &ice.Context{Name: "ctx", Help: "配置模块", case kit.MDB_NAME: m.Push(k, key) case kit.MDB_TEXT: - m.Push(k, m.Prefix()) + m.Push(k, s.Cap(ice.CTX_FOLLOW)) default: m.Push(k, "") } diff --git a/base/web/share.go b/base/web/share.go index 77418e0b..edec541e 100644 --- a/base/web/share.go +++ b/base/web/share.go @@ -115,6 +115,28 @@ func init() { } m.Render(ice.RENDER_QRCODE, kit.MergeURL2(m.Option(ice.MSG_USERWEB), "/", SHARE, arg[0], list)) } + case "river": + switch kit.Select("", arg, 1) { + case "share": + list := []string{} + for _, k := range []string{"river"} { + if msg.Append(k) != "" { + list = append(list, k, msg.Append(k)) + } + } + m.Render(ice.RENDER_QRCODE, kit.MergeURL2(m.Option(ice.MSG_USERWEB), "/", SHARE, arg[0], list)) + } + case "storm": + switch kit.Select("", arg, 1) { + case "share": + list := []string{} + for _, k := range []string{"river", "storm"} { + if msg.Append(k) != "" { + list = append(list, k, msg.Append(k)) + } + } + m.Render(ice.RENDER_QRCODE, kit.MergeURL2(m.Option(ice.MSG_USERWEB), "/", SHARE, arg[0], list)) + } } }}, diff --git a/base/web/space.go b/base/web/space.go index 5fe4533b..11d2db7c 100644 --- a/base/web/space.go +++ b/base/web/space.go @@ -172,6 +172,34 @@ func _space_handle(m *ice.Message, safe bool, send map[string]*ice.Message, c *w } return false } +func _space_search(m *ice.Message, kind, name, text string, arg ...string) { + fields := kit.Split(m.Option(mdb.FIELDS)) + m.Richs(SPACE, nil, kit.MDB_FOREACH, func(key string, val map[string]interface{}) { + val = kit.GetMeta(val) + for _, k := range fields { + switch k { + case kit.SSH_POD: + m.Push(k, m.Option(ice.MSG_USERPOD)) + case kit.SSH_CTX: + m.Push(k, m.Prefix()) + case kit.SSH_CMD: + m.Push(k, SPACE) + case kit.MDB_TIME: + m.Push(k, m.Time()) + case kit.MDB_SIZE: + m.Push(k, "") + case kit.MDB_TYPE: + m.Push(k, val[kit.MDB_TYPE]) + case kit.MDB_NAME: + m.Push(k, val[kit.MDB_NAME]) + case kit.MDB_TEXT: + m.Push(k, val[kit.MDB_TEXT]) + default: + m.Push(k, "") + } + } + }) +} const ( MASTER = "master" @@ -201,6 +229,9 @@ func init() { "connect": {Name: "connect dev name", Help: "连接", Hand: func(m *ice.Message, arg ...string) { _space_dial(m, m.Option("dev"), kit.Select(ice.Info.NodeName, m.Option(kit.MDB_NAME))) }}, + mdb.SEARCH: {Name: "search type name text arg...", Help: "搜索", Hand: func(m *ice.Message, arg ...string) { + _space_search(m, arg[0], arg[1], kit.Select("", arg, 2)) + }}, }, Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) { if len(arg) < 2 { _space_list(m, kit.Select("", arg, 0)) diff --git a/base/web/web.go b/base/web/web.go index 8f73c16c..80457e07 100644 --- a/base/web/web.go +++ b/base/web/web.go @@ -97,6 +97,7 @@ var Index = &ice.Context{Name: WEB, Help: "网络模块", m.Cmd(SPIDE, mdb.CREATE, SPIDE_DEV, kit.Select("http://:9020", m.Conf(cli.RUNTIME, "conf.ctx_dev"))) m.Cmd(SPIDE, mdb.CREATE, SPIDE_SELF, kit.Select("http://:9020", m.Conf(cli.RUNTIME, "conf.ctx_self"))) m.Cmd(SPIDE, mdb.CREATE, SPIDE_SHY, kit.Select("https://shylinux.com:443", m.Conf(cli.RUNTIME, "conf.ctx_shy"))) + m.Cmd(mdb.SEARCH, mdb.CREATE, SPACE, SPACE, WEB) }}, ice.CTX_EXIT: {Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) { m.Save() diff --git a/core/chat/river.go b/core/chat/river.go index 3667087e..6555b315 100644 --- a/core/chat/river.go +++ b/core/chat/river.go @@ -309,7 +309,7 @@ func init() { m.Cmdy(mdb.INPUTS, RIVER, "", mdb.HASH, arg) } }}, - web.SHARE: {Name: "share name", Help: "共享", Hand: func(m *ice.Message, arg ...string) { + web.SHARE: {Name: "share type name", Help: "共享", Hand: func(m *ice.Message, arg ...string) { m.Cmdy(web.SHARE, mdb.CREATE, kit.MDB_TYPE, "login", arg) }}, }, Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) { diff --git a/core/wiki/wiki.go b/core/wiki/wiki.go index b96d26b3..b1e3f241 100644 --- a/core/wiki/wiki.go +++ b/core/wiki/wiki.go @@ -8,6 +8,8 @@ import ( "path" "strings" + + "github.com/tealeg/xlsx" ) func _wiki_path(m *ice.Message, cmd string, arg ...string) string { @@ -50,11 +52,19 @@ func _wiki_upload(m *ice.Message, cmd string, dir string) { } const WIKI = "wiki" +const XLSX = "xlsx" var Index = &ice.Context{Name: WIKI, Help: "文档中心", Commands: map[string]*ice.Command{ ice.CTX_INIT: {Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) { m.Load() }}, ice.CTX_EXIT: {Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) { m.Save() }}, + + XLSX: {Name: "xlsx file=hi.xlsx 执行", Help: "影音媒体", Meta: kit.Dict( + "display", "/plugin/local/wiki/feel.js", + ), Action: map[string]*ice.Action{}, Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) { + file, err := xlsx.OpenFile(arg[0]) + m.Assert(err) + }}, }, }