1
0
mirror of https://shylinux.com/x/icebergs synced 2025-04-26 01:24:05 +08:00
This commit is contained in:
shaoying 2020-12-04 22:08:46 +08:00
parent 377b107212
commit abbdc8c29c
7 changed files with 89 additions and 10 deletions

View File

@ -31,18 +31,33 @@ func _user_create(m *ice.Message, name, word string) {
m.Event(USER_CREATE, name) m.Event(USER_CREATE, name)
} }
func _user_search(m *ice.Message, kind, name, text string, arg ...string) { 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{}) { m.Richs(USER, nil, kit.MDB_FOREACH, func(key string, val map[string]interface{}) {
if name != "" && name != val[USERNAME] { if name != "" && name != val[USERNAME] {
return return
} }
m.Push("pod", m.Option("pod")) for _, k := range fields {
m.Push("ctx", "aaa") switch k {
m.Push("cmd", USER) case kit.SSH_POD:
m.Push(key, val, []string{kit.MDB_TIME}) m.Push(k, m.Option(ice.MSG_USERPOD))
m.Push(kit.MDB_SIZE, kit.Format("")) case kit.SSH_CTX:
m.Push(kit.MDB_TYPE, kit.Format(UserRole(m, val[USERNAME]))) m.Push(k, m.Prefix())
m.Push(kit.MDB_NAME, kit.Format(val[USERNICK])) case kit.SSH_CMD:
m.Push(kit.MDB_TEXT, kit.Format(val[USERNAME])) 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, "")
}
}
}) })
} }

View File

@ -42,7 +42,7 @@ var Index = &ice.Context{Name: "ctx", Help: "配置模块",
case kit.MDB_NAME: case kit.MDB_NAME:
m.Push(k, key) m.Push(k, key)
case kit.MDB_TEXT: case kit.MDB_TEXT:
m.Push(k, m.Prefix()) m.Push(k, s.Cap(ice.CTX_FOLLOW))
default: default:
m.Push(k, "") m.Push(k, "")
} }

View File

@ -115,6 +115,28 @@ func init() {
} }
m.Render(ice.RENDER_QRCODE, kit.MergeURL2(m.Option(ice.MSG_USERWEB), "/", SHARE, arg[0], list)) 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))
}
} }
}}, }},

View File

@ -172,6 +172,34 @@ func _space_handle(m *ice.Message, safe bool, send map[string]*ice.Message, c *w
} }
return false 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 ( const (
MASTER = "master" MASTER = "master"
@ -201,6 +229,9 @@ func init() {
"connect": {Name: "connect dev name", Help: "连接", Hand: func(m *ice.Message, arg ...string) { "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))) _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) { }, Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) {
if len(arg) < 2 { if len(arg) < 2 {
_space_list(m, kit.Select("", arg, 0)) _space_list(m, kit.Select("", arg, 0))

View File

@ -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_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_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(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) { ice.CTX_EXIT: {Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) {
m.Save() m.Save()

View File

@ -309,7 +309,7 @@ func init() {
m.Cmdy(mdb.INPUTS, RIVER, "", mdb.HASH, arg) 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) m.Cmdy(web.SHARE, mdb.CREATE, kit.MDB_TYPE, "login", arg)
}}, }},
}, Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) { }, Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) {

View File

@ -8,6 +8,8 @@ import (
"path" "path"
"strings" "strings"
"github.com/tealeg/xlsx"
) )
func _wiki_path(m *ice.Message, cmd string, arg ...string) string { 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 WIKI = "wiki"
const XLSX = "xlsx"
var Index = &ice.Context{Name: WIKI, Help: "文档中心", var Index = &ice.Context{Name: WIKI, Help: "文档中心",
Commands: map[string]*ice.Command{ Commands: map[string]*ice.Command{
ice.CTX_INIT: {Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) { m.Load() }}, 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() }}, 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)
}},
}, },
} }