mirror of
https://shylinux.com/x/community
synced 2025-04-27 10:18:28 +08:00
54 lines
1.7 KiB
Go
54 lines
1.7 KiB
Go
package yuehaoxitong
|
|
|
|
import (
|
|
"shylinux.com/x/ice"
|
|
kit "shylinux.com/x/toolkits"
|
|
|
|
"shylinux.com/x/community/src/yuehaoxitong/model"
|
|
)
|
|
|
|
type call struct {
|
|
Tables
|
|
queue queue
|
|
schedule schedule
|
|
reception reception
|
|
call string `name:"call" help:"叫号" role:"void"`
|
|
expire string `name:"expire" role:"void"`
|
|
finish string `name:"finish" role:"void"`
|
|
list string `name:"list queue_uid uid reception_uid auto"`
|
|
}
|
|
|
|
func (s call) Call(m *ice.Message, arg ...string) {
|
|
if s.CheckRole(m, UserQueueCreator, UserQueueServer) {
|
|
m.Cmdy(s.schedule, s.schedule.Call).PushAction(s.Expire, s.Finish)
|
|
}
|
|
}
|
|
func (s call) Expire(m *ice.Message, arg ...string) {
|
|
if s.CheckRole(m, UserQueueCreator, UserQueueServer) {
|
|
m.Cmdy(s.schedule, s.schedule.Expire).ProcessRefresh()
|
|
}
|
|
}
|
|
func (s call) Finish(m *ice.Message, arg ...string) {
|
|
if s.CheckRole(m, UserQueueCreator, UserQueueServer) {
|
|
m.Cmdy(s.schedule, s.schedule.Finish).ProcessRefresh()
|
|
}
|
|
}
|
|
func (s call) List(m *ice.Message, arg ...string) {
|
|
if len(arg) == 1 {
|
|
m.Cmdy(s.schedule, s.schedule.SelectByStatus, arg[0], ScheduleTake).Action(s.Call)
|
|
kit.If(m.Length() == 0, func() { m.Echo(m.Trans("not found order", "没有等待")) })
|
|
} else if len(arg) == 2 {
|
|
m.Cmdy(s.schedule, arg[0], arg[1]).Table(func(value ice.Maps) {
|
|
if value[model.SCHEDULE_STATUS] == ScheduleCall.String() {
|
|
m.PushButton(s.Expire, s.Finish)
|
|
} else {
|
|
m.PushButton()
|
|
}
|
|
}).Action(s.Call)
|
|
} else if len(arg) == 3 {
|
|
m.Cmdy(s.schedule, s.Select, model.QUEUE_UID, arg[0], model.RECEPTION_UID, arg[2], model.STATUS, ScheduleTake).PushAction().Action(s.Call)
|
|
}
|
|
}
|
|
|
|
func init() { ice.TeamCtxCmd(call{Tables: newTables()}) }
|