mirror of
https://shylinux.com/x/community
synced 2025-04-25 17:48:06 +08:00
50 lines
1.5 KiB
Go
50 lines
1.5 KiB
Go
package yuehaoxitong
|
|
|
|
import (
|
|
"shylinux.com/x/ice"
|
|
"shylinux.com/x/icebergs/base/mdb"
|
|
|
|
"shylinux.com/x/community/src/yuehaoxitong/model"
|
|
)
|
|
|
|
type reception struct {
|
|
Table
|
|
create string `name:"create name*" role:"void"`
|
|
rename string `name:"rename name*" role:"void"`
|
|
delete string `name:"delete" role:"void"`
|
|
}
|
|
|
|
func (s reception) Create(m *ice.Message, arg ...string) {
|
|
if s.checkRole(m) {
|
|
s.Table.Create(m, append(arg, m.OptionSimple(model.QUEUE_UID)...)...)
|
|
s.recordEvent(m, m.Trans("create reception ", "创建服务场所 ")+m.Option(mdb.NAME), m.Result())
|
|
}
|
|
}
|
|
func (s reception) List(m *ice.Message, arg ...string) {
|
|
s.Table.Fields(m, model.UID, model.NAME, model.CREATED_AT)
|
|
if len(arg) == 0 {
|
|
if m.Option(model.QUEUE_UID) != "" {
|
|
s.Table.Select(m, m.OptionSimple(model.QUEUE_UID)...)
|
|
}
|
|
} else if len(arg) == 1 {
|
|
s.Table.Select(m, model.QUEUE_UID, arg[0])
|
|
} else if len(arg) == 2 {
|
|
s.Table.SelectDetail(m, model.QUEUE_UID, arg[0], model.UID, arg[1])
|
|
}
|
|
m.PushAction(s.Rename, s.Delete)
|
|
}
|
|
func (s reception) Rename(m *ice.Message, arg ...string) {
|
|
if s.checkRole(m) {
|
|
s.Table.Rename(m, m.OptionSimple(model.QUEUE_UID, model.UID)...)
|
|
s.recordEvent(m, m.Trans("rename reception %s", "重命名服务场所 %s")+m.Option(mdb.NAME))
|
|
}
|
|
}
|
|
func (s reception) Delete(m *ice.Message, arg ...string) {
|
|
if s.checkRole(m) {
|
|
s.Table.Delete(m, m.OptionSimple(model.QUEUE_UID, model.UID)...)
|
|
s.recordEvent(m, m.Trans("delete reception %s", "删除服务场所 %s")+m.Option(mdb.NAME))
|
|
}
|
|
}
|
|
|
|
func init() { ice.TeamCtxCmd(reception{}) }
|