2024-08-20 22:09:33 +08:00

43 lines
1.3 KiB
Go

package gonganxitong
import (
"shylinux.com/x/ice"
"shylinux.com/x/icebergs/base/ctx"
"shylinux.com/x/icebergs/base/web"
kit "shylinux.com/x/toolkits"
"shylinux.com/x/community/src/gonganxitong/model"
)
type recent struct {
Table
order string `data:"101"`
portal string `data:"true"`
domain string `data:"gonganxitong"`
create string `name:"create name icon space index args"`
remove string `name:"remove" role:"void"`
open string `name:"open" role:"void"`
}
func (s recent) Create(m *ice.Message, arg ...string) {
if s.Table.Select(m, m.OptionSimple(model.USER_UID, web.SPACE, ctx.INDEX)...).Length() == 0 {
}
s.Table.Create(m, kit.Simple(arg, m.OptionSimple(model.USER_UID))...)
}
func (s recent) Remove(m *ice.Message, arg ...string) {
s.Table.Delete(m, m.OptionSimple(model.USER_UID, model.UID)...)
}
func (s recent) List(m *ice.Message, arg ...string) {
if len(arg) == 1 {
s.Select(m, model.USER_UID, m.Option(model.USER_UID))
} else if len(arg) == 2 {
s.SelectDetail(m, model.USER_UID, m.Option(model.USER_UID), model.UID, arg[1])
}
m.PushAction(s.Open, s.Remove).Action()
}
func (s recent) Open(m *ice.Message, arg ...string) {
m.ProcessOpen(web.S(m.Option(web.SPACE)) + web.C(m.Option(ctx.INDEX)))
}
func init() { ice.TeamCtxCmd(recent{}) }