1
0
forked from x/icebergs
This commit is contained in:
shaoying 2020-04-17 17:04:15 +08:00
parent 3eaa88d7a6
commit 87c4f3c998
5 changed files with 64 additions and 55 deletions

View File

@ -1589,29 +1589,29 @@ var Index = &ice.Context{Name: "web", Help: "网络模块",
if last := m.Richs(ice.WEB_STORY, nil, prev, nil); prev != "" && last != nil && last["data"] == arg[3] { if last := m.Richs(ice.WEB_STORY, nil, prev, nil); prev != "" && last != nil && last["data"] == arg[3] {
// 重复提交 // 重复提交
m.Echo(prev) m.Echo(prev)
break
}
// 添加节点
list := m.Rich(ice.WEB_STORY, nil, kit.Dict(
"scene", arg[1], "story", arg[2], "count", count+1, "data", arg[3], "prev", prev,
))
m.Log(ice.LOG_CREATE, "story: %s %s: %s", list, arg[1], arg[2])
m.Push("list", list)
if head == "" {
// 添加索引
m.Rich(ice.WEB_STORY, "head", kit.Dict("scene", arg[1], "story", arg[2], "count", count+1, "list", list))
} else { } else {
// 更新索引 // 添加节点
value["count"] = count + 1 list := m.Rich(ice.WEB_STORY, nil, kit.Dict(
value["time"] = m.Time() "scene", arg[1], "story", arg[2], "count", count+1, "data", arg[3], "prev", prev,
value["list"] = list ))
m.Log(ice.LOG_CREATE, "story: %s %s: %s", list, arg[1], arg[2])
m.Push("list", list)
if head == "" {
// 添加索引
m.Rich(ice.WEB_STORY, "head", kit.Dict("scene", arg[1], "story", arg[2], "count", count+1, "list", list))
} else {
// 更新索引
value["count"] = count + 1
value["time"] = m.Time()
value["list"] = list
}
m.Echo(list)
} }
m.Echo(list)
// 分发数据 // 分发数据
if p := kit.Select(m.Conf(ice.WEB_FAVOR, "meta.proxy"), m.Option("you")); p != "" { if p := kit.Select(m.Conf(ice.WEB_FAVOR, "meta.proxy"), m.Option("you")); p != "" {
m.Info("what %v", p)
m.Option("you", "") m.Option("you", "")
m.Cmd(ice.WEB_PROXY, p, ice.WEB_STORY, ice.STORY_PULL, arg[2], "dev", arg[2]) m.Cmd(ice.WEB_PROXY, p, ice.WEB_STORY, ice.STORY_PULL, arg[2], "dev", arg[2])
} }

12
conf.go
View File

@ -162,8 +162,10 @@ const ( // MDB
) )
const ( // APP const ( // APP
APP_MIND = "mind" APP_MIND = "mind"
APP_MISS = "miss" APP_MISS = "miss"
APP_SEARCH = "search"
APP_COMMEND = "commend"
) )
const ( // ROLE const ( // ROLE
ROLE_ROOT = "root" ROLE_ROOT = "root"
@ -273,8 +275,10 @@ var Alias = map[string]string{
CHAT_RIVER: "web.chat.river", CHAT_RIVER: "web.chat.river",
APP_MISS: "web.team.miss", APP_MISS: "web.team.miss",
APP_MIND: "web.wiki.mind", APP_MIND: "web.wiki.mind",
APP_SEARCH: "web.chat.search",
APP_COMMEND: "web.chat.commend",
"compile": "web.code.compile", "compile": "web.code.compile",
"publish": "web.code.publish", "publish": "web.code.publish",

View File

@ -13,26 +13,6 @@ var Index = &ice.Context{Name: "chat", Help: "聊天中心",
"template", kit.Dict("root", []interface{}{ "template", kit.Dict("root", []interface{}{
[]interface{}{"river", `{{.Option "user.nick"|Format}}@{{.Conf "runtime" "node.name"|Format}}`, "mall"}, []interface{}{"river", `{{.Option "user.nick"|Format}}@{{.Conf "runtime" "node.name"|Format}}`, "mall"},
[]interface{}{"storm", "mall", "mall"},
[]interface{}{"field", "asset", "web.mall"},
[]interface{}{"field", "spend", "web.mall"},
[]interface{}{"field", "trans", "web.mall"},
[]interface{}{"field", "bonus", "web.mall"},
[]interface{}{"field", "month", "web.mall"},
[]interface{}{"storm", "team", "team"},
[]interface{}{"field", "plan", "web.team"},
[]interface{}{"field", "miss", "web.team"},
[]interface{}{"field", "stat", "web.team"},
[]interface{}{"field", "task", "web.team"},
[]interface{}{"storm", "wiki", "wiki"},
[]interface{}{"field", "draw", "web.wiki"},
[]interface{}{"field", "data", "web.wiki"},
[]interface{}{"field", "word", "web.wiki"},
[]interface{}{"field", "walk", "web.wiki"},
[]interface{}{"field", "feel", "web.wiki"},
[]interface{}{"storm", "code", "code"}, []interface{}{"storm", "code", "code"},
[]interface{}{"field", "login", "web.code"}, []interface{}{"field", "login", "web.code"},
[]interface{}{"field", "buffer", "web.code.tmux"}, []interface{}{"field", "buffer", "web.code.tmux"},
@ -44,6 +24,13 @@ var Index = &ice.Context{Name: "chat", Help: "聊天中心",
[]interface{}{"field", "total", "web.code.git"}, []interface{}{"field", "total", "web.code.git"},
[]interface{}{"field", "status", "web.code.git"}, []interface{}{"field", "status", "web.code.git"},
[]interface{}{"storm", "wiki", "wiki"},
[]interface{}{"field", "draw", "web.wiki"},
[]interface{}{"field", "data", "web.wiki"},
[]interface{}{"field", "word", "web.wiki"},
[]interface{}{"field", "walk", "web.wiki"},
[]interface{}{"field", "feel", "web.wiki"},
[]interface{}{"storm", "root"}, []interface{}{"storm", "root"},
[]interface{}{"field", "spide"}, []interface{}{"field", "spide"},
[]interface{}{"field", "space"}, []interface{}{"field", "space"},
@ -51,6 +38,26 @@ var Index = &ice.Context{Name: "chat", Help: "聊天中心",
[]interface{}{"field", "favor"}, []interface{}{"field", "favor"},
[]interface{}{"field", "story"}, []interface{}{"field", "story"},
[]interface{}{"field", "share"}, []interface{}{"field", "share"},
[]interface{}{"storm", "miss"},
[]interface{}{"field", "route"},
[]interface{}{"field", "group"},
[]interface{}{"field", "label"},
[]interface{}{"field", "search"},
[]interface{}{"field", "commend"},
[]interface{}{"storm", "team", "team"},
[]interface{}{"field", "plan", "web.team"},
[]interface{}{"field", "miss", "web.team"},
[]interface{}{"field", "stat", "web.team"},
[]interface{}{"field", "task", "web.team"},
[]interface{}{"storm", "mall", "mall"},
[]interface{}{"field", "asset", "web.mall"},
[]interface{}{"field", "spend", "web.mall"},
[]interface{}{"field", "trans", "web.mall"},
[]interface{}{"field", "bonus", "web.mall"},
[]interface{}{"field", "month", "web.mall"},
}, "void", []interface{}{ }, "void", []interface{}{
[]interface{}{"storm", "wiki", "wiki"}, []interface{}{"storm", "wiki", "wiki"},
[]interface{}{"field", "note", "web.wiki"}, []interface{}{"field", "note", "web.wiki"},
@ -152,7 +159,7 @@ var Index = &ice.Context{Name: "chat", Help: "聊天中心",
case "login": case "login":
// 密码登录 // 密码登录
if len(arg) > 2 { if len(arg) > 2 {
m.Render("cookie", m.Option(ice.MSG_SESSID, m.Cmdx(ice.AAA_USER, "login", m.Option(ice.MSG_USERNAME, arg[1]), arg[2]))) web.Render(m, "cookie", m.Option(ice.MSG_SESSID, m.Cmdx(ice.AAA_USER, "login", m.Option(ice.MSG_USERNAME, arg[1]), arg[2])))
} }
default: default:
@ -215,14 +222,10 @@ var Index = &ice.Context{Name: "chat", Help: "聊天中心",
m.Richs(ice.AAA_USER, nil, m.Option(ice.MSG_USERNAME), func(key string, value map[string]interface{}) { m.Richs(ice.AAA_USER, nil, m.Option(ice.MSG_USERNAME), func(key string, value map[string]interface{}) {
m.Push("nickname", value["nickname"]) m.Push("nickname", value["nickname"])
}) })
m.Echo(m.Option(ice.MSG_USERNAME)) m.Render(m.Option(ice.MSG_USERNAME))
case "login": case "login":
if len(arg) > 1 { m.Render(m.Option(ice.MSG_SESSID))
m.Cmdy(ice.AAA_USER, "login", arg[1:])
break
}
m.Echo(m.Option(ice.MSG_SESSID))
case "share": case "share":
switch arg[1] { switch arg[1] {

View File

@ -212,10 +212,15 @@ var Index = &ice.Context{Name: "wiki", Help: "文档中心",
data := kit.Dict() data := kit.Dict()
cmds := kit.Split(arg[1]) cmds := kit.Split(arg[1])
m.Search(cmds[0], func(p *ice.Context, s *ice.Context, key string, cmd *ice.Command) { m.Search(cmds[0], func(p *ice.Context, s *ice.Context, key string, cmd *ice.Command) {
ls := strings.Split(cmds[0], ".")
m.Cmd(ice.CTX_COMMAND, strings.Join(ls[:len(ls)-1], "."), key)
if data["feature"], data["inputs"] = cmd.Meta, cmd.List; len(cmd.List) == 0 { if data["feature"], data["inputs"] = cmd.Meta, cmd.List; len(cmd.List) == 0 {
data["inputs"] = m.Confv("field", "meta.some.simple.inputs") data["inputs"] = m.Confv("field", "meta.some.simple.inputs")
} }
}) })
if len(data) == 0 {
m.Echo("not found", arg[1])
}
for i := 2; i < len(arg)-1; i += 2 { for i := 2; i < len(arg)-1; i += 2 {
if data := m.Confv("field", kit.Keys("meta.some", arg[i+1], arg[i])); data != nil { if data := m.Confv("field", kit.Keys("meta.some", arg[i+1], arg[i])); data != nil {

View File

@ -84,14 +84,11 @@ var Index = &ice.Context{Name: "tmux", Help: "工作台",
m.Option("cmd_env", "TMUX", "", "ctx_dev", dev, "ctx_share", share) m.Option("cmd_env", "TMUX", "", "ctx_dev", dev, "ctx_share", share)
m.Option("cmd_dir", path.Join(m.Conf(ice.WEB_DREAM, "meta.path"), arg[0])) m.Option("cmd_dir", path.Join(m.Conf(ice.WEB_DREAM, "meta.path"), arg[0]))
if arg[0] != "" && m.Cmd(prefix, "has-session", "-t", arg[0]).Append("code") == "0" { if arg[0] != "" && m.Cmd(prefix, "has-session", "-t", arg[0]).Append("code") != "0" {
// 复用会话 // 创建会话
return m.Cmd(prefix, "new-session", "-ds", arg[0])
} }
// 创建会话
m.Cmd(prefix, "new-session", "-ds", arg[0])
if m.Option("local") != "" { if m.Option("local") != "" {
// 创建容器 // 创建容器
m.Cmd("local", m.Option("local"), arg[0]) m.Cmd("local", m.Option("local"), arg[0])