From 48fe6bfe834684e25bcb9b2b927584b4e7f8cb06 Mon Sep 17 00:00:00 2001 From: shylinux Date: Sat, 25 Jul 2020 16:13:59 +0800 Subject: [PATCH] opt some --- core/chat/action.go | 8 +++++++- core/chat/chat.go | 14 ++++++++++++-- core/chat/river.go | 6 ++++++ core/chat/storm.go | 6 ++++++ 4 files changed, 31 insertions(+), 3 deletions(-) diff --git a/core/chat/action.go b/core/chat/action.go index a94a35b2..14df5b1d 100644 --- a/core/chat/action.go +++ b/core/chat/action.go @@ -70,7 +70,7 @@ func _action_list(m *ice.Message, river, storm string) { if p := m.Option(POD); p != "" { m.Option(POD, "") // 代理列表 - m.Cmdy(web.SPACE, p, "web.chat./action", river, storm) + m.Cmdy(web.SPACE, p, "web.chat./action") } if m.Option("share") != "" { // 共享列表 @@ -131,6 +131,12 @@ func _action_show(m *ice.Message, river, storm, index string, arg ...string) { return } if len(cmds) == 0 { + if p := m.Option(POD); p != "" { + m.Option(POD, "") + // 代理列表 + m.Cmdy(web.SPACE, p, "web.chat./action", index, arg) + return + } m.Render("status", 404, "not found") return } diff --git a/core/chat/chat.go b/core/chat/chat.go index 54c3c894..03b30169 100644 --- a/core/chat/chat.go +++ b/core/chat/chat.go @@ -112,16 +112,26 @@ var Index = &ice.Context{Name: "chat", Help: "聊天中心", }) switch m.Option(ice.MSG_USERURL) { case "/action": - arg = arg[2:] - case "/storm": if len(arg) > 0 { + m.Option(ice.MSG_RIVER, arg[0]) arg = arg[1:] } if len(arg) > 0 { + m.Option(ice.MSG_STORM, arg[0]) + arg = arg[1:] + } + case "/storm": + if len(arg) > 0 { + m.Option(ice.MSG_RIVER, arg[0]) + arg = arg[1:] + } + if len(arg) > 0 { + m.Option(ice.MSG_STORM, arg[0]) arg = arg[1:] } case "/river": if len(arg) > 0 { + m.Option(ice.MSG_RIVER, arg[0]) arg = arg[1:] } if len(arg) > 1 && arg[1] == "storm" { diff --git a/core/chat/river.go b/core/chat/river.go index 1a30ee83..92f9221e 100644 --- a/core/chat/river.go +++ b/core/chat/river.go @@ -12,6 +12,12 @@ import ( func _river_list(m *ice.Message) { m.Set(ice.MSG_OPTION, kit.MDB_KEY) m.Set(ice.MSG_OPTION, kit.MDB_NAME) + + if p := m.Option(POD); p != "" { + m.Option(POD, "") + // 代理列表 + m.Cmdy(web.SPACE, p, "web.chat./river") + } m.Richs(RIVER, nil, kit.MDB_FOREACH, func(key string, value map[string]interface{}) { m.Richs(RIVER, kit.Keys(kit.MDB_HASH, key, USER), m.Option(ice.MSG_USERNAME), func(k string, val map[string]interface{}) { m.Push(key, value[kit.MDB_META], []string{kit.MDB_KEY, kit.MDB_NAME}, val[kit.MDB_META]) diff --git a/core/chat/storm.go b/core/chat/storm.go index 508995a1..59898b8d 100644 --- a/core/chat/storm.go +++ b/core/chat/storm.go @@ -11,6 +11,12 @@ func _storm_list(m *ice.Message, river string) { m.Set(ice.MSG_OPTION, kit.MDB_KEY) m.Set(ice.MSG_OPTION, kit.MDB_NAME) m.Set(ice.MSG_OPTION, kit.MDB_COUNT) + + if p := m.Option(POD); p != "" { + m.Option(POD, "") + // 代理列表 + m.Cmdy(web.SPACE, p, "web.chat./storm") + } m.Richs(RIVER, kit.Keys(kit.MDB_HASH, river, USER), m.Option(ice.MSG_USERNAME), func(k string, val map[string]interface{}) { m.Richs(RIVER, kit.Keys(kit.MDB_HASH, river, TOOL), kit.MDB_FOREACH, func(key string, value map[string]interface{}) { m.Push(key, value[kit.MDB_META], []string{kit.MDB_KEY, kit.MDB_NAME, kit.MDB_COUNT}, val[kit.MDB_META])