1
0
mirror of https://shylinux.com/x/icebergs synced 2025-06-26 18:37:29 +08:00

opt share

This commit is contained in:
shaoying 2021-01-11 23:07:48 +08:00
parent 771c8ebc9d
commit cbd9c74357
5 changed files with 32 additions and 19 deletions

View File

@ -244,7 +244,7 @@ func (f *Frame) scan(m *ice.Message, h, line string, r io.Reader) *Frame {
continue // 空行 continue // 空行
} }
m.Cmdx(mdb.INSERT, SOURCE, kit.Keys(kit.MDB_HASH, h), mdb.LIST, kit.MDB_TEXT, bio.Text()) // m.Cmdx(mdb.INSERT, SOURCE, kit.Keys(kit.MDB_HASH, h), mdb.LIST, kit.MDB_TEXT, bio.Text())
f.count++ f.count++
if len(bio.Text()) == 0 { if len(bio.Text()) == 0 {

View File

@ -44,7 +44,7 @@ func _dream_show(m *ice.Message, name string) {
// 任务模板 // 任务模板
if m.Option("template") != "" { if m.Option("template") != "" {
for _, file := range []string{"etc/miss.sh", "src/main.shy", "src/main.go", "go.mod"} { for _, file := range []string{"etc/miss.sh", "src/main.shy", "src/main.go", "go.mod", "Makefile"} {
if _, e := os.Stat(path.Join(p, file)); os.IsNotExist(e) { if _, e := os.Stat(path.Join(p, file)); os.IsNotExist(e) {
switch m.Cmdy(nfs.COPY, path.Join(p, file), path.Join(m.Option("template"), file)); file { switch m.Cmdy(nfs.COPY, path.Join(p, file), path.Join(m.Option("template"), file)); file {
case "go.mod": case "go.mod":

View File

@ -320,7 +320,6 @@ func init() {
m.Optionv("content_data", data) m.Optionv("content_data", data)
data = kit.KeyValue(map[string]interface{}{}, "", data) data = kit.KeyValue(map[string]interface{}{}, "", data)
m.Debug("res: %s", kit.Formats(data))
m.Push("", data) m.Push("", data)
} }
}) })

View File

@ -110,12 +110,14 @@ func init() {
}}, }},
}, 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 arg[0] == "_share" { if arg[0] == "_share" {
switch msg := m.Cmd(web.SHARE, arg[1]); msg.Append("type") { switch msg := m.Cmd(web.SHARE, arg[1]); msg.Append(kit.MDB_TYPE) {
case "storm": case STORM:
m.Debug(msg.Format("meta")) m.Debug(msg.Format(kit.MDB_META))
arg[0] = msg.Append("river") arg[0] = msg.Append(RIVER)
arg[1] = msg.Append("storm") arg[1] = msg.Append(STORM)
m.Option("title", msg.Append("name")) m.Option(kit.MDB_TITLE, msg.Append(kit.MDB_NAME))
default:
return
} }
} else { } else {
if m.Warn(m.Option(ice.MSG_USERNAME) == "", ice.ErrNotLogin) { if m.Warn(m.Option(ice.MSG_USERNAME) == "", ice.ErrNotLogin) {

View File

@ -12,16 +12,6 @@ import (
) )
func _river_list(m *ice.Message) { func _river_list(m *ice.Message) {
if m.Option(web.SHARE) != "" && m.Option(web.SHARE) != "" {
m.Option(ice.MSG_RIVER, m.Option(RIVER))
if m.Cmd(m.Prefix(AUTH), m.Option(web.SHARE)).Append(kit.MDB_TYPE) == USER {
if m.Cmd(m.Prefix(USER), m.Option(ice.MSG_USERNAME)).Append(ice.MSG_USERNAME) == "" {
m.Cmd(m.Prefix(USER), mdb.INSERT, aaa.USERNAME, m.Option(ice.MSG_USERNAME))
// 加入群组
}
}
}
m.Set(ice.MSG_OPTION, kit.MDB_HASH) m.Set(ice.MSG_OPTION, kit.MDB_HASH)
m.Set(ice.MSG_OPTION, kit.MDB_NAME) m.Set(ice.MSG_OPTION, kit.MDB_NAME)
@ -31,6 +21,27 @@ func _river_list(m *ice.Message) {
}) })
}) })
} }
func _river_share(m *ice.Message) {
if m.Option(web.SHARE) == "" || m.Option(RIVER) == "" {
return
}
msg := m.Spawn()
msg.Option(mdb.FIELDS, "type,name,text,river,storm")
if res := msg.Cmd(web.SHARE, m.Option(web.SHARE)); res.Append(kit.MDB_TYPE) == RIVER {
msg.Option(ice.MSG_RIVER, res.Append(RIVER))
} else {
if res := msg.Cmd(m.Prefix(AUTH), m.Option(web.SHARE)); res.Append(kit.MDB_TYPE) == USER {
} else {
return
}
}
if msg.Cmd(m.Prefix(USER), m.Option(ice.MSG_USERNAME)).Append(aaa.USERNAME) == "" {
msg.Cmd(m.Prefix(USER), mdb.INSERT, aaa.USERNAME, m.Option(ice.MSG_USERNAME))
// 加入群组
}
}
func _river_proxy(m *ice.Message, pod string) (proxy []string) { func _river_proxy(m *ice.Message, pod string) (proxy []string) {
if p := kit.Select(m.Option(POD), pod); p != "" { if p := kit.Select(m.Option(POD), pod); p != "" {
proxy = append(proxy, web.SPACE, p) proxy = append(proxy, web.SPACE, p)
@ -321,6 +332,7 @@ func init() {
return // 没有登录 return // 没有登录
} }
if len(arg) == 0 { if len(arg) == 0 {
_river_share(m)
_river_list(m) _river_list(m)
return // 群组列表 return // 群组列表
} }