forked from x/icebergs
add inner.favor
This commit is contained in:
parent
de90153919
commit
7634b366e5
@ -208,13 +208,13 @@ func init() {
|
||||
return
|
||||
}
|
||||
|
||||
fields := []string{kit.MDB_TIME, kit.MDB_ID, kit.MDB_TYPE, kit.MDB_NAME, kit.MDB_TEXT}
|
||||
if len(arg) > 1 && arg[1] == "extra" {
|
||||
fields, arg = append(fields, arg[2:]...), arg[:1]
|
||||
}
|
||||
m.Option("favor", arg[0])
|
||||
if len(arg) < 3 {
|
||||
// 收藏列表
|
||||
fields := []string{kit.MDB_TIME, kit.MDB_ID, kit.MDB_TYPE, kit.MDB_NAME, kit.MDB_TEXT}
|
||||
if len(arg) > 1 && arg[1] == "extra" {
|
||||
fields, arg = append(fields, arg[2:]...), arg[:1]
|
||||
}
|
||||
_favor_list(m, arg[0], kit.Select("", arg, 1), fields...)
|
||||
return
|
||||
}
|
||||
|
@ -157,6 +157,13 @@ func init() {
|
||||
"record": {Name: "record", Help: "记录", Hand: func(m *ice.Message, arg ...string) {
|
||||
web.StoryAdd(m, "display", path.Join("./", m.Option("path"), m.Option("name"))+".display", m.Option("display"))
|
||||
}},
|
||||
"favor": {Name: "favor", Help: "收藏", Hand: func(m *ice.Message, arg ...string) {
|
||||
m.Cmd(ice.WEB_FAVOR, arg, "extra", "extra.poster").Table(func(index int, value map[string]string, header []string) {
|
||||
m.Push("image", kit.Format(`<a title="%s" href="%s" target="_blank"><img src="%s" width=200></a>`,
|
||||
value["name"], value["text"], value["extra.poster"]))
|
||||
m.Push("video", kit.Format(`<video src="%s" controls></video>`, value["text"]))
|
||||
})
|
||||
}},
|
||||
"recover": {Name: "recover", Help: "复盘", Hand: func(m *ice.Message, arg ...string) {
|
||||
msg := m.Spawn()
|
||||
web.StoryHistory(msg, path.Join("./", arg[0], arg[1])+".display")
|
||||
@ -197,6 +204,12 @@ func init() {
|
||||
|
||||
_inner_main(m, arg...)
|
||||
}},
|
||||
|
||||
"video": {Name: "video", Help: "视频", Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) {
|
||||
m.Cmd(ice.WEB_FAVOR, arg, "extra", "extra.poster").Table(func(index int, value map[string]string, header []string) {
|
||||
m.Echo(`<video src="%s" controls loop></video>`, value["text"])
|
||||
})
|
||||
}},
|
||||
},
|
||||
}, nil)
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user