mirror of
https://shylinux.com/x/icebergs
synced 2025-04-26 01:24:05 +08:00
opt some
This commit is contained in:
parent
1f748b17b3
commit
0761a4b527
@ -14,15 +14,16 @@ func init() {
|
||||
},
|
||||
Commands: map[string]*ice.Command{
|
||||
ENGINE: {Name: "engine type name text arg...", Help: "引擎", Action: map[string]*ice.Action{
|
||||
CREATE: {Name: "create type name [text]", Help: "创建", Hand: func(m *ice.Message, arg ...string) {
|
||||
m.Rich(ENGINE, nil, kit.Dict(kit.MDB_TYPE, arg[0], kit.MDB_NAME, arg[1], kit.MDB_TEXT, kit.Select("", arg, 2)))
|
||||
CREATE: {Name: "create type [cmd [ctx]]", Help: "创建", Hand: func(m *ice.Message, arg ...string) {
|
||||
m.Rich(ENGINE, nil, kit.Dict(kit.MDB_TYPE, arg[0], kit.MDB_NAME, kit.Select(arg[0], arg, 1), kit.MDB_TEXT, kit.Select("", arg, 2)))
|
||||
}},
|
||||
}, Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) {
|
||||
if m.Richs(ENGINE, nil, arg[0], func(key string, value map[string]interface{}) {
|
||||
m.Cmdy(kit.Keys(value[kit.MDB_TEXT], value[kit.MDB_NAME]), arg)
|
||||
}) == nil {
|
||||
m.Cmdy(arg[0], ENGINE, arg)
|
||||
if len(arg) == 2 {
|
||||
arg = append(arg, "")
|
||||
}
|
||||
m.Richs(ENGINE, nil, arg[0], func(key string, value map[string]interface{}) {
|
||||
m.Cmdy(kit.Keys(value[kit.MDB_TEXT], value[kit.MDB_NAME]), ENGINE, arg[0], arg[1], arg[2], arg[3:])
|
||||
})
|
||||
}},
|
||||
}}, nil)
|
||||
}
|
||||
|
@ -13,13 +13,13 @@ func init() {
|
||||
PLUGIN: {Name: "plugin", Help: "插件", Value: kit.Data(kit.MDB_SHORT, kit.MDB_TYPE)},
|
||||
},
|
||||
Commands: map[string]*ice.Command{
|
||||
PLUGIN: {Name: "plugin type name text arg...", Help: "插件", Action: map[string]*ice.Action{
|
||||
CREATE: {Name: "create type name [text]", Help: "创建", Hand: func(m *ice.Message, arg ...string) {
|
||||
m.Rich(PLUGIN, nil, kit.Dict(kit.MDB_TYPE, arg[0], kit.MDB_NAME, arg[1], kit.MDB_TEXT, kit.Select("", arg, 2)))
|
||||
PLUGIN: {Name: "plugin type name text", Help: "插件", Action: map[string]*ice.Action{
|
||||
CREATE: {Name: "create type [cmd [ctx]]", Help: "创建", Hand: func(m *ice.Message, arg ...string) {
|
||||
m.Rich(PLUGIN, nil, kit.Dict(kit.MDB_TYPE, arg[0], kit.MDB_NAME, kit.Select(arg[0], arg, 1), kit.MDB_TEXT, kit.Select("", arg, 2)))
|
||||
}},
|
||||
}, Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) {
|
||||
m.Richs(PLUGIN, nil, arg[0], func(key string, value map[string]interface{}) {
|
||||
m.Cmdy(kit.Keys(value[kit.MDB_TEXT], value[kit.MDB_NAME]), arg)
|
||||
m.Cmdy(kit.Keys(value[kit.MDB_TEXT], value[kit.MDB_NAME]), PLUGIN, arg[0], arg[1], kit.Select("", arg, 2))
|
||||
})
|
||||
}},
|
||||
}}, nil)
|
||||
|
@ -10,10 +10,10 @@ const RENDER = "render"
|
||||
func init() {
|
||||
Index.Merge(&ice.Context{
|
||||
Configs: map[string]*ice.Config{
|
||||
RENDER: {Name: "render", Help: "渲染引擎", Value: kit.Data(kit.MDB_SHORT, kit.MDB_TYPE)},
|
||||
RENDER: {Name: "render", Help: "渲染", Value: kit.Data(kit.MDB_SHORT, kit.MDB_TYPE)},
|
||||
},
|
||||
Commands: map[string]*ice.Command{
|
||||
RENDER: {Name: "render type name text arg...", Help: "渲染引擎", Action: map[string]*ice.Action{
|
||||
RENDER: {Name: "render type name [text]", Help: "渲染", Action: map[string]*ice.Action{
|
||||
CREATE: {Name: "create type [cmd [ctx]]", Help: "创建", Hand: func(m *ice.Message, arg ...string) {
|
||||
m.Rich(RENDER, nil, kit.Dict(kit.MDB_TYPE, arg[0], kit.MDB_NAME, kit.Select(arg[0], arg, 1), kit.MDB_TEXT, kit.Select("", arg, 2)))
|
||||
}},
|
||||
|
@ -1,10 +1,10 @@
|
||||
package mdb
|
||||
|
||||
import (
|
||||
"github.com/shylinux/icebergs"
|
||||
"github.com/shylinux/toolkits"
|
||||
ice "github.com/shylinux/icebergs"
|
||||
kit "github.com/shylinux/toolkits"
|
||||
|
||||
"strings"
|
||||
"sync"
|
||||
)
|
||||
|
||||
const SEARCH = "search"
|
||||
@ -12,10 +12,10 @@ const SEARCH = "search"
|
||||
func init() {
|
||||
Index.Merge(&ice.Context{
|
||||
Configs: map[string]*ice.Config{
|
||||
SEARCH: {Name: "search", Help: "搜索引擎", Value: kit.Data(kit.MDB_SHORT, kit.MDB_TYPE)},
|
||||
SEARCH: {Name: "search", Help: "搜索", Value: kit.Data(kit.MDB_SHORT, kit.MDB_TYPE)},
|
||||
},
|
||||
Commands: map[string]*ice.Command{
|
||||
SEARCH: {Name: "search word text type...", Help: "搜索引擎", Action: map[string]*ice.Action{
|
||||
SEARCH: {Name: "search type word [text]", Help: "搜索", Action: map[string]*ice.Action{
|
||||
CREATE: {Name: "create type [cmd [ctx]]", Help: "创建", Hand: func(m *ice.Message, arg ...string) {
|
||||
m.Rich(SEARCH, nil, kit.Dict(kit.MDB_TYPE, arg[0], kit.MDB_NAME, kit.Select(arg[0], arg, 1), kit.MDB_TEXT, kit.Select("", arg, 2)))
|
||||
}},
|
||||
@ -26,98 +26,14 @@ func init() {
|
||||
})
|
||||
return
|
||||
}
|
||||
if strings.Contains(arg[0], ";") {
|
||||
arg = strings.Split(arg[0], ";")
|
||||
}
|
||||
if len(arg) > 2 {
|
||||
for _, k := range strings.Split(arg[2], ",") {
|
||||
m.Richs(SEARCH, nil, k, func(key string, value map[string]interface{}) {
|
||||
m.Cmdy(kit.Keys(value[kit.MDB_TEXT], value[kit.MDB_NAME]), SEARCH, value[kit.MDB_TYPE], arg[0], kit.Select("", arg, 1))
|
||||
})
|
||||
}
|
||||
} else {
|
||||
m.Richs(SEARCH, nil, kit.MDB_FOREACH, func(key string, value map[string]interface{}) {
|
||||
m.Cmdy(kit.Keys(value[kit.MDB_TEXT], value[kit.MDB_NAME]), SEARCH, value[kit.MDB_TYPE], arg[0], kit.Select("", arg, 1))
|
||||
})
|
||||
}
|
||||
}},
|
||||
"commend": {Name: "commend label pod engine work auto", Help: "推荐引擎", Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) {
|
||||
if len(arg) < 2 {
|
||||
m.Cmdy("web.label", arg)
|
||||
return
|
||||
}
|
||||
|
||||
switch arg[0] {
|
||||
case "add":
|
||||
if m.Richs(cmd, nil, arg[1], nil) == nil {
|
||||
m.Rich(cmd, nil, kit.Data(kit.MDB_NAME, arg[1]))
|
||||
}
|
||||
m.Richs(cmd, nil, arg[1], func(key string, value map[string]interface{}) {
|
||||
m.Grow(cmd, kit.Keys(kit.MDB_HASH, key), kit.Dict(
|
||||
kit.MDB_NAME, arg[2], kit.MDB_TEXT, arg[3:],
|
||||
))
|
||||
if strings.Contains(arg[1], ";") {
|
||||
arg = strings.Split(arg[1], ";")
|
||||
}
|
||||
for _, k := range strings.Split(arg[0], ",") {
|
||||
m.Richs(SEARCH, nil, k, func(key string, value map[string]interface{}) {
|
||||
m.Cmdy(kit.Keys(value[kit.MDB_TEXT], value[kit.MDB_NAME]), SEARCH, value[kit.MDB_TYPE], arg[1], kit.Select("", arg, 2))
|
||||
})
|
||||
case "get":
|
||||
wg := &sync.WaitGroup{}
|
||||
m.Richs(cmd, nil, arg[1], func(key string, value map[string]interface{}) {
|
||||
wg.Add(1)
|
||||
m.Gos(m, func(m *ice.Message) {
|
||||
m.Grows(cmd, kit.Keys(kit.MDB_HASH, key), "", "", func(index int, value map[string]interface{}) {
|
||||
m.Cmdy(value[kit.MDB_TEXT], arg[2:])
|
||||
})
|
||||
wg.Done()
|
||||
})
|
||||
})
|
||||
m.Sort("time", "time_r")
|
||||
wg.Wait()
|
||||
case "set":
|
||||
if arg[1] != "" {
|
||||
m.Cmdy("web.space", arg[1], "web.chat.commend", "set", "", arg[2:])
|
||||
break
|
||||
}
|
||||
|
||||
if m.Richs(cmd, "meta.user", m.Option(ice.MSG_USERNAME), nil) == nil {
|
||||
m.Rich(cmd, "meta.user", kit.Dict(
|
||||
kit.MDB_NAME, m.Option(ice.MSG_USERNAME),
|
||||
))
|
||||
}
|
||||
switch m.Option("_action") {
|
||||
case "喜欢":
|
||||
m.Richs(cmd, "meta.user", m.Option(ice.MSG_USERNAME), func(key string, value map[string]interface{}) {
|
||||
m.Grow(cmd, kit.Keys("meta.user", kit.MDB_HASH, key, "like"), kit.Dict(
|
||||
kit.MDB_EXTRA, kit.Dict("engine", arg[2], "favor", arg[3], "id", arg[4]),
|
||||
kit.MDB_TYPE, arg[5], kit.MDB_NAME, arg[6], kit.MDB_TEXT, arg[7],
|
||||
))
|
||||
})
|
||||
case "讨厌":
|
||||
m.Richs(cmd, "meta.user", m.Option(ice.MSG_USERNAME), func(key string, value map[string]interface{}) {
|
||||
m.Grow(cmd, kit.Keys("meta.user", kit.MDB_HASH, key, "hate"), kit.Dict(
|
||||
kit.MDB_EXTRA, kit.Dict("engine", arg[2], "favor", arg[3], "id", arg[4]),
|
||||
kit.MDB_TYPE, arg[5], kit.MDB_NAME, arg[6], kit.MDB_TEXT, arg[7],
|
||||
))
|
||||
})
|
||||
}
|
||||
|
||||
m.Richs(cmd, nil, arg[2], func(key string, value map[string]interface{}) {
|
||||
m.Grows(cmd, kit.Keys(kit.MDB_HASH, key), "", "", func(index int, value map[string]interface{}) {
|
||||
m.Cmdy(value[kit.MDB_TEXT], "set", arg[3:])
|
||||
})
|
||||
})
|
||||
default:
|
||||
if len(arg) == 2 {
|
||||
m.Richs(cmd, nil, "*", func(key string, value map[string]interface{}) {
|
||||
m.Push(key, value)
|
||||
})
|
||||
break
|
||||
}
|
||||
if len(arg) == 3 {
|
||||
m.Richs(cmd, nil, "*", func(key string, value map[string]interface{}) {
|
||||
m.Push(key, value)
|
||||
})
|
||||
break
|
||||
}
|
||||
m.Cmdy("web.label", arg[0], arg[1], "web.chat.commend", "get", arg[2:])
|
||||
// m.Cmdy("web.chat.commend", "get", arg[2:])
|
||||
}
|
||||
}},
|
||||
}}, nil)
|
||||
|
@ -178,7 +178,6 @@ func _file_copy(m *ice.Message, name string, from ...string) {
|
||||
}
|
||||
}
|
||||
func _file_link(m *ice.Message, name string, from string) {
|
||||
_file_trash(m, name)
|
||||
os.MkdirAll(path.Dir(name), 0760)
|
||||
os.Link(from, name)
|
||||
m.Echo(name)
|
||||
|
@ -3,6 +3,7 @@ package web
|
||||
import (
|
||||
ice "github.com/shylinux/icebergs"
|
||||
"github.com/shylinux/icebergs/base/aaa"
|
||||
"github.com/shylinux/icebergs/base/mdb"
|
||||
kit "github.com/shylinux/toolkits"
|
||||
"github.com/skip2/go-qrcode"
|
||||
|
||||
@ -131,6 +132,14 @@ func init() {
|
||||
m.Echo(`<input type="button" value="%s">`, arg[0])
|
||||
}},
|
||||
}, Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) {
|
||||
if arg[0] == mdb.RENDER {
|
||||
m.Search("_render", func(p *ice.Context, s *ice.Context, key string, cmd *ice.Command) {
|
||||
if action, ok := cmd.Action[arg[1]]; ok {
|
||||
action.Hand(m, arg[2:]...)
|
||||
}
|
||||
})
|
||||
return
|
||||
}
|
||||
m.Echo(`<input type="%s" value="%s">`, arg[1], arg[2])
|
||||
}},
|
||||
},
|
||||
|
@ -4,6 +4,7 @@ import (
|
||||
ice "github.com/shylinux/icebergs"
|
||||
"github.com/shylinux/icebergs/base/aaa"
|
||||
"github.com/shylinux/icebergs/base/cli"
|
||||
"github.com/shylinux/icebergs/base/mdb"
|
||||
kit "github.com/shylinux/toolkits"
|
||||
|
||||
"strings"
|
||||
@ -77,7 +78,7 @@ func init() {
|
||||
})
|
||||
if m.W != nil && len(arg) < 2 {
|
||||
m.Table(func(index int, value map[string]string, field []string) {
|
||||
m.Push("link", Format("a", kit.MergeURL(m.Option(ice.MSG_USERWEB), "pod", value["name"]), value["name"]))
|
||||
m.Push("link", m.Cmdx(mdb.RENDER, RENDER.A, value["name"], kit.MergeURL(m.Option(ice.MSG_USERWEB), "pod", value["name"])))
|
||||
})
|
||||
}
|
||||
}},
|
||||
|
@ -91,7 +91,7 @@ func _share_create(m *ice.Message, kind, name, text string, arg ...string) strin
|
||||
h := m.Rich(SHARE, nil, kit.Dict(
|
||||
kit.MDB_TIME, m.Time(m.Conf(SHARE, "meta.expire")),
|
||||
kit.MDB_TYPE, kind, kit.MDB_NAME, name, kit.MDB_TEXT, text,
|
||||
kit.MDB_EXTRA, kit.Dict(arg),
|
||||
kit.MDB_EXTRA, kit.Dict(aaa.USERROLE, m.Option(ice.MSG_USERROLE), aaa.USERNAME, m.Option(ice.MSG_USERNAME), arg),
|
||||
))
|
||||
|
||||
// 创建列表
|
||||
@ -172,7 +172,8 @@ func _share_action_list(m *ice.Message, value map[string]interface{}, river, sto
|
||||
m.Push("value", value["value"])
|
||||
|
||||
msg := m.Cmd(m.Space(value["pod"]), ctx.COMMAND, value["ctx"], value["cmd"])
|
||||
m.Push("name", value["cmd"])
|
||||
ls := strings.Split(kit.Format(value["cmd"]), ".")
|
||||
m.Push("name", ls[len(ls)-1])
|
||||
m.Push("help", kit.Select(msg.Append("help"), kit.Format(value["help"])))
|
||||
m.Push("inputs", msg.Append("list"))
|
||||
m.Push("feature", msg.Append("meta"))
|
||||
|
@ -107,6 +107,12 @@ var Index = &ice.Context{Name: "web", Help: "网络模块",
|
||||
m.Cmd(mdb.SEARCH, mdb.CREATE, FAVOR)
|
||||
m.Cmd(mdb.SEARCH, mdb.CREATE, SPIDE)
|
||||
m.Cmd(mdb.RENDER, mdb.CREATE, SPIDE)
|
||||
|
||||
m.Search("_render", func(p *ice.Context, s *ice.Context, key string, cmd *ice.Command) {
|
||||
for k := range cmd.Action {
|
||||
m.Cmd(mdb.RENDER, mdb.CREATE, k, "_render", "web")
|
||||
}
|
||||
})
|
||||
}},
|
||||
ice.CTX_EXIT: {Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) {
|
||||
m.Save(SPIDE, SERVE, GROUP, LABEL,
|
||||
|
@ -1,7 +1,10 @@
|
||||
package chat
|
||||
|
||||
import (
|
||||
"strings"
|
||||
|
||||
ice "github.com/shylinux/icebergs"
|
||||
"github.com/shylinux/icebergs/base/aaa"
|
||||
"github.com/shylinux/icebergs/base/ctx"
|
||||
"github.com/shylinux/icebergs/base/web"
|
||||
kit "github.com/shylinux/toolkits"
|
||||
@ -23,6 +26,9 @@ func _action_share_create(m *ice.Message, name, text string, arg ...string) {
|
||||
}
|
||||
func _action_share_list(m *ice.Message, key string) {
|
||||
m.Richs(web.SHARE, nil, key, func(key string, value map[string]interface{}) {
|
||||
m.Option(ice.MSG_USERNAME, kit.Value(value, "extra.username"))
|
||||
m.Option(ice.MSG_USERROLE, kit.Value(value, "extra.userrole"))
|
||||
m.Log_AUTH(aaa.USERNAME, m.Option(ice.MSG_USERNAME), aaa.USERROLE, m.Option(ice.MSG_USERROLE))
|
||||
kit.Fetch(kit.Value(value, "extra.tool"), func(index int, value map[string]interface{}) {
|
||||
m.Push(RIVER, "")
|
||||
m.Push(STORM, "")
|
||||
@ -34,7 +40,8 @@ func _action_share_list(m *ice.Message, key string) {
|
||||
m.Push("args", value[ARG])
|
||||
|
||||
msg := m.Cmd(m.Space(value[POD]), ctx.COMMAND, kit.Keys(value[CTX], value[CMD]))
|
||||
m.Push("name", value[CMD])
|
||||
ls := strings.Split(kit.Format(value[CMD]), ".")
|
||||
m.Push("name", ls[len(ls)-1])
|
||||
m.Push("help", kit.Select(msg.Append("help"), kit.Format(value["help"])))
|
||||
m.Push("inputs", msg.Append("list"))
|
||||
m.Push("feature", msg.Append("meta"))
|
||||
@ -71,9 +78,7 @@ func _action_list(m *ice.Message, river, storm string) {
|
||||
}
|
||||
|
||||
prefix := kit.Keys(kit.MDB_HASH, river, TOOL, kit.MDB_HASH, storm)
|
||||
m.Debug("what %v", prefix)
|
||||
m.Grows(RIVER, prefix, "", "", func(index int, value map[string]interface{}) {
|
||||
m.Debug("what %v", value)
|
||||
if meta, ok := kit.Value(value, kit.MDB_META).(map[string]interface{}); ok {
|
||||
m.Push(RIVER, river)
|
||||
m.Push(STORM, storm)
|
||||
@ -85,7 +90,8 @@ func _action_list(m *ice.Message, river, storm string) {
|
||||
m.Push("args", kit.Select("[]", kit.Format(meta["args"])))
|
||||
|
||||
msg := m.Cmd(m.Space(meta[POD]), ctx.COMMAND, kit.Keys(meta[CTX], meta[CMD]))
|
||||
m.Push("name", meta[CMD])
|
||||
ls := strings.Split(kit.Format(meta["cmd"]), ".")
|
||||
m.Push("name", ls[len(ls)-1])
|
||||
m.Push("help", kit.Select(msg.Append("help"), kit.Format(meta["help"])))
|
||||
m.Push("feature", msg.Append("meta"))
|
||||
m.Push("inputs", msg.Append("list"))
|
||||
@ -98,15 +104,24 @@ func _action_show(m *ice.Message, river, storm, index string, arg ...string) {
|
||||
|
||||
if i, e := strconv.Atoi(index); e == nil {
|
||||
m.Richs(web.SHARE, nil, m.Option("share"), func(key string, value map[string]interface{}) {
|
||||
m.Option(ice.MSG_USERNAME, kit.Value(value, "extra.username"))
|
||||
m.Option(ice.MSG_USERROLE, kit.Value(value, "extra.userrole"))
|
||||
m.Log_AUTH(aaa.USERNAME, m.Option(ice.MSG_USERNAME), aaa.USERROLE, m.Option(ice.MSG_USERROLE))
|
||||
kit.Fetch(kit.Value(value, kit.Keys("extra.tool", i)), func(value map[string]interface{}) {
|
||||
// 共享命令
|
||||
cmds = kit.Simple(m.Space(value[POD]), kit.Keys(value[CTX], value[CMD]), arg)
|
||||
if value[POD] != "" {
|
||||
m.Option(POD, value[POD])
|
||||
}
|
||||
cmds = kit.Simple(kit.Keys(value[CTX], value[CMD]), arg)
|
||||
})
|
||||
})
|
||||
m.Grows(RIVER, prefix, kit.MDB_ID, kit.Format(i+1), func(index int, value map[string]interface{}) {
|
||||
if value, ok := kit.Value(value, kit.MDB_META).(map[string]interface{}); ok {
|
||||
// 群组命令
|
||||
cmds = kit.Simple(m.Space(value[POD]), kit.Keys(value[CTX], value[CMD]), arg)
|
||||
if value[POD] != "" {
|
||||
m.Option(POD, value[POD])
|
||||
}
|
||||
cmds = kit.Simple(kit.Keys(value[CTX], value[CMD]), arg)
|
||||
}
|
||||
})
|
||||
} else if !m.Warn(!m.Right(index), "no right of %v", index) {
|
||||
@ -155,7 +170,6 @@ func init() {
|
||||
}, Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) {
|
||||
if len(arg) == 0 {
|
||||
// 命令列表
|
||||
m.Debug("%v", m.Formats("meta"))
|
||||
_action_list(m, m.Option(ice.MSG_RIVER), m.Option(ice.MSG_STORM))
|
||||
return
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
package chat
|
||||
|
||||
import (
|
||||
"github.com/shylinux/icebergs"
|
||||
ice "github.com/shylinux/icebergs"
|
||||
"github.com/shylinux/icebergs/base/mdb"
|
||||
)
|
||||
|
||||
@ -9,11 +9,11 @@ func init() {
|
||||
Index.Merge(&ice.Context{
|
||||
Commands: map[string]*ice.Command{
|
||||
"/" + mdb.SEARCH: {Name: "/search", Help: "搜索引擎", Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) {
|
||||
if len(arg) > 2 {
|
||||
m.Cmdy(m.Space(m.Option("pod")), mdb.RENDER, arg)
|
||||
if m.Option("cmd") == "" {
|
||||
m.Cmdy(m.Space(m.Option("pod")), mdb.SEARCH, arg)
|
||||
return
|
||||
}
|
||||
m.Cmdy(m.Space(m.Option("pod")), mdb.SEARCH, arg)
|
||||
m.Cmdy(m.Space(m.Option("pod")), mdb.RENDER, arg)
|
||||
}},
|
||||
},
|
||||
}, nil)
|
||||
|
@ -24,7 +24,7 @@ func _bench_list(m *ice.Message, zone string, id string, field ...interface{}) {
|
||||
if zone = kit.Format(kit.Value(val, kit.MDB_ZONE)); id == "" {
|
||||
m.Grows(BENCH, kit.Keys(kit.MDB_HASH, key), "", "", func(index int, value map[string]interface{}) {
|
||||
// 查看信息
|
||||
m.Push("操作", m.Cmdx("_render", web.RENDER.Button, "运行"))
|
||||
m.Push("操作", m.Cmdx(mdb.RENDER, web.RENDER.Button, "运行"))
|
||||
m.Push(zone, value, []string{
|
||||
kit.MDB_ZONE, kit.MDB_ID, kit.MDB_TYPE,
|
||||
kit.MDB_NAME, NCONN, NREQS, kit.MDB_TEXT,
|
||||
@ -36,7 +36,7 @@ func _bench_list(m *ice.Message, zone string, id string, field ...interface{}) {
|
||||
// 查看信息
|
||||
m.Push("detail", value)
|
||||
m.Push(kit.MDB_KEY, "操作")
|
||||
m.Push(kit.MDB_VALUE, m.Cmdx("_render", web.RENDER.Button, "运行"))
|
||||
m.Push(kit.MDB_VALUE, m.Cmdx(mdb.RENDER, web.RENDER.Button, "运行"))
|
||||
})
|
||||
})
|
||||
}
|
||||
@ -63,6 +63,9 @@ func _bench_redis(m *ice.Message, nconn, nreq int64, hosts []string, cmds []stri
|
||||
log.FmtDuration(s.Cost/time.Duration(s.NReq)), log.FmtDuration(s.EndTime.Sub(s.BeginTime)))
|
||||
}
|
||||
func _bench_engine(m *ice.Message, kind, name, target string, arg ...string) {
|
||||
for i := 0; i < len(arg); i += 2 {
|
||||
m.Option(arg[i], arg[i+1])
|
||||
}
|
||||
nconn := kit.Int64(kit.Select("10", m.Option(NCONN)))
|
||||
nreqs := kit.Int64(kit.Select("1000", m.Option(NREQS)))
|
||||
m.Echo("nconn: %d nreqs: %d\n", nconn, nreqs*nconn)
|
||||
|
@ -5,6 +5,7 @@ import (
|
||||
|
||||
ice "github.com/shylinux/icebergs"
|
||||
"github.com/shylinux/icebergs/base/cli"
|
||||
"github.com/shylinux/icebergs/base/mdb"
|
||||
"github.com/shylinux/icebergs/base/nfs"
|
||||
"github.com/shylinux/icebergs/base/web"
|
||||
kit "github.com/shylinux/toolkits"
|
||||
@ -44,6 +45,7 @@ var Index = &ice.Context{Name: "code", Help: "编程中心",
|
||||
Commands: map[string]*ice.Command{
|
||||
ice.CTX_INIT: {Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) {
|
||||
m.Load()
|
||||
m.Cmd(mdb.ENGINE, mdb.CREATE, BENCH)
|
||||
}},
|
||||
ice.CTX_EXIT: {Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) {
|
||||
m.Save("login")
|
||||
|
@ -20,7 +20,7 @@ func _pprof_list(m *ice.Message, zone string, id string, field ...interface{}) {
|
||||
if zone = kit.Format(kit.Value(val, kit.MDB_ZONE)); id == "" {
|
||||
m.Grows(PPROF, kit.Keys(kit.MDB_HASH, key), "", "", func(index int, value map[string]interface{}) {
|
||||
// 列表信息
|
||||
m.Push("操作", m.Cmdx("_render", web.RENDER.Button, "运行"))
|
||||
m.Push("操作", m.Cmdx(mdb.RENDER, web.RENDER.Button, "运行"))
|
||||
m.Push(zone, value, []string{
|
||||
kit.MDB_ZONE, kit.MDB_ID, kit.MDB_TYPE,
|
||||
kit.MDB_NAME, kit.MDB_TEXT, SECONDS, BINNARY, SERVICE,
|
||||
@ -31,7 +31,7 @@ func _pprof_list(m *ice.Message, zone string, id string, field ...interface{}) {
|
||||
// 详细信息
|
||||
m.Push("detail", value)
|
||||
m.Push(kit.MDB_KEY, "操作")
|
||||
m.Push(kit.MDB_VALUE, m.Cmdx("_render", web.RENDER.Button, "运行"))
|
||||
m.Push(kit.MDB_VALUE, m.Cmdx(mdb.RENDER, web.RENDER.Button, "运行"))
|
||||
})
|
||||
}
|
||||
})
|
||||
@ -50,8 +50,7 @@ func _pprof_show(m *ice.Message, zone string, id string) {
|
||||
m.Log_EXPORT(kit.MDB_META, PPROF, kit.MDB_ZONE, zone, kit.MDB_VALUE, kit.Format(value))
|
||||
cmd := kit.Format(value[kit.MDB_TYPE])
|
||||
arg := kit.Format(value[kit.MDB_TEXT])
|
||||
res := web.FavorShow(m.Spawn(), cmd, kit.Format(value[kit.MDB_NAME]),
|
||||
arg, kit.Simple(value[kit.MDB_EXTRA])...).Result()
|
||||
res := m.Cmd(mdb.ENGINE, value[kit.MDB_TYPE], value[kit.MDB_NAME], value[kit.MDB_TEXT], value[kit.MDB_EXTRA]).Result()
|
||||
m.Cmd(web.FAVOR, favor, cmd, arg, res)
|
||||
list = append(list, cmd+": "+arg, res)
|
||||
})
|
||||
|
@ -29,9 +29,10 @@ func init() {
|
||||
m.Echo("hello world")
|
||||
}},
|
||||
"save": {Name: "save name text", Help: "保存", Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) {
|
||||
if qr, e := qrs.New(kit.Select(m.Option("content", arg, 1)), qrs.Medium); m.Assert(e) {
|
||||
if qr, e := qrs.New(kit.Select(m.Option("content"), arg, 1), qrs.Medium); m.Assert(e) {
|
||||
if f, e := os.Create(arg[0]); m.Assert(e) {
|
||||
defer f.Close()
|
||||
m.Debug(m.Option("content"))
|
||||
m.Assert(qr.Write(kit.Int(kit.Select("256", arg, 2)), f))
|
||||
m.Echo(arg[0])
|
||||
}
|
||||
|
@ -1,10 +1,10 @@
|
||||
package team
|
||||
|
||||
import (
|
||||
"github.com/shylinux/icebergs"
|
||||
ice "github.com/shylinux/icebergs"
|
||||
"github.com/shylinux/icebergs/base/mdb"
|
||||
"github.com/shylinux/icebergs/base/web"
|
||||
"github.com/shylinux/toolkits"
|
||||
kit "github.com/shylinux/toolkits"
|
||||
|
||||
"encoding/csv"
|
||||
"os"
|
||||
@ -273,6 +273,8 @@ var Index = &ice.Context{Name: "team", Help: "团队中心",
|
||||
end_time = end_time.Add(-8 * time.Hour)
|
||||
m.Logs("info", "begin", begin_time, "end", end_time)
|
||||
|
||||
m.Set(ice.MSG_OPTION, "end_time")
|
||||
m.Set(ice.MSG_OPTION, "begin_time")
|
||||
m.Richs(TASK, nil, kit.Select(kit.MDB_FOREACH, m.Option(ZONE)), func(key string, val map[string]interface{}) {
|
||||
zone := kit.Format(kit.Value(val, "meta.zone"))
|
||||
m.Grows(TASK, kit.Keys(kit.MDB_HASH, key), "", "", func(index int, value map[string]interface{}) {
|
||||
|
@ -1,7 +1,7 @@
|
||||
package team
|
||||
|
||||
import (
|
||||
"github.com/shylinux/icebergs"
|
||||
ice "github.com/shylinux/icebergs"
|
||||
"github.com/shylinux/icebergs/base/web"
|
||||
)
|
||||
|
||||
@ -23,36 +23,10 @@ func init() {
|
||||
Index.Register(&ice.Context{Name: "工作", Help: "工作",
|
||||
Commands: map[string]*ice.Command{
|
||||
"项目开发": {Name: "项目开发", Help: "项目开发", Hand: func(m *ice.Message, c *ice.Context, key string, arg ...string) {
|
||||
|
||||
m.Echo("hello world")
|
||||
}},
|
||||
"项目测试": {Name: "项目测试", Help: "项目测试", Hand: func(m *ice.Message, c *ice.Context, key string, arg ...string) {
|
||||
|
||||
}},
|
||||
},
|
||||
}, &web.Frame{})
|
||||
|
||||
Index.Register(&ice.Context{Name: "创业", Help: "创业",
|
||||
Commands: map[string]*ice.Command{
|
||||
"项目调研": {Name: "项目调研", Help: "项目调研",
|
||||
Action: map[string]*ice.Action{
|
||||
"input": {Name: "input", Help: "补全", Hand: func(m *ice.Message, arg ...string) {
|
||||
_work_input(m, arg[0], arg[1])
|
||||
}},
|
||||
},
|
||||
Hand: func(m *ice.Message, c *ice.Context, key string, arg ...string) {
|
||||
|
||||
}},
|
||||
"项目开发": {Name: "项目开发", Help: "项目开发",
|
||||
Action: map[string]*ice.Action{
|
||||
"input": {Name: "input", Help: "补全", Hand: func(m *ice.Message, arg ...string) {
|
||||
_work_input(m, arg[0], arg[1])
|
||||
}},
|
||||
},
|
||||
Hand: func(m *ice.Message, c *ice.Context, key string, arg ...string) {
|
||||
m.Echo("hello world")
|
||||
}},
|
||||
"项目测试": {Name: "项目测试", Help: "项目测试", Hand: func(m *ice.Message, c *ice.Context, key string, arg ...string) {
|
||||
|
||||
m.Echo("hello world")
|
||||
}},
|
||||
},
|
||||
}, &web.Frame{})
|
||||
|
@ -21,7 +21,7 @@ func init() {
|
||||
Index.Merge(&ice.Context{Name: "feel", Help: "影音媒体",
|
||||
Configs: map[string]*ice.Config{
|
||||
FEEL: {Name: "feel", Help: "影音媒体", Value: kit.Data(
|
||||
kit.MDB_SHORT, "name", "path", "", "regs", ".*.(qrc|png|jpg|JPG|MOV|m4v|mp4)",
|
||||
kit.MDB_SHORT, "name", "path", "", "regs", ".*.(qrc|png|PNG|jpg|JPG|MOV|m4v|mp4)",
|
||||
"height", "400", "page.limit", "3",
|
||||
)},
|
||||
},
|
||||
|
5
meta.go
5
meta.go
@ -156,7 +156,10 @@ func (m *Message) Copy(msg *Message, arg ...string) *Message {
|
||||
|
||||
// 复制数据
|
||||
for _, k := range msg.meta[MSG_APPEND] {
|
||||
if kit.IndexOf(m.meta[MSG_OPTION], k) > -1 && len(m.meta[k]) > 0 {
|
||||
if i := kit.IndexOf(m.meta[MSG_OPTION], k); i > -1 && len(m.meta[k]) > 0 {
|
||||
m.meta[k] = m.meta[k][:0]
|
||||
}
|
||||
if i := kit.IndexOf(m.meta["_option"], k); i > -1 && len(m.meta[k]) > 0 {
|
||||
m.meta[k] = m.meta[k][:0]
|
||||
}
|
||||
if kit.IndexOf(m.meta[MSG_APPEND], k) == -1 {
|
||||
|
Loading…
x
Reference in New Issue
Block a user