mirror of
https://shylinux.com/x/community
synced 2025-05-03 04:37:01 +08:00
46 lines
1.4 KiB
Go
46 lines
1.4 KiB
Go
package gonganxitong
|
|
|
|
import (
|
|
"shylinux.com/x/ice"
|
|
"shylinux.com/x/icebergs/base/mdb"
|
|
kit "shylinux.com/x/toolkits"
|
|
|
|
"shylinux.com/x/community/src/gonganxitong/model"
|
|
)
|
|
|
|
type notice struct {
|
|
Table
|
|
order string `data:"95"`
|
|
fields string `data:"title,content,user_uid"`
|
|
create string `name:"create title* content*" role:"landlord,teacher,leader"`
|
|
remove string `name:"remove" role:"landlord,teacher,leader"`
|
|
}
|
|
|
|
func (s notice) Init(m *ice.Message, arg ...string) {
|
|
s.Table.Init(m, arg...)
|
|
m.Design(s.List, "", kit.JoinWord(s.Keys(s.Place, model.UID), model.UID, ice.AUTO))
|
|
}
|
|
func (s notice) Create(m *ice.Message, arg ...string) {
|
|
m.Option(model.PLACE_UID, m.Option(s.Keys(s.Place, model.UID)))
|
|
s.Insert(m, kit.Simple(arg, m.OptionSimple(model.PLACE_UID, model.USER_UID))...)
|
|
s.RecordEventWithName(m, "")
|
|
}
|
|
func (s notice) Remove(m *ice.Message, arg ...string) {
|
|
m.Option(model.PLACE_UID, m.Option(s.Keys(s.Place, model.UID)))
|
|
s.Delete(m, m.OptionSimple(model.PLACE_UID, model.UID)...)
|
|
s.RecordEventWithName(m, "")
|
|
}
|
|
func (s notice) List(m *ice.Message, arg ...string) {
|
|
s.Table.FieldsWithCreatedAT(m, s, kit.TransArgs(kit.Split(m.Config(mdb.FIELDS), ",", ","))...)
|
|
if len(arg) == 1 {
|
|
s.Select(m, model.PLACE_UID, arg[0])
|
|
} else if len(arg) == 2 {
|
|
s.SelectDetail(m, model.PLACE_UID, arg[0], model.UID, arg[1])
|
|
} else {
|
|
return
|
|
}
|
|
s.SelectJoinUser(m)
|
|
}
|
|
|
|
func init() { ice.TeamCtxCmd(notice{Table: newTable()}) }
|