2025-06-16 13:39:59 +08:00

74 lines
3.2 KiB
Go

package yingxiaotuiguang
import (
"shylinux.com/x/ice"
kit "shylinux.com/x/toolkits"
"shylinux.com/x/community/src/gonganxitong"
"shylinux.com/x/enterprise/src/yingxiaotuiguang/model"
)
type product struct {
Table
order string `data:"1"`
fields string `data:"icon,name,title,content,invite_count AS invite_count,begin_time,end_time,user_uid"`
create string `name:"create service_uid*:select place_uid:select title content begin_time:select@date end_time:select@date" role:"leader"`
modify string `name:"modify title content" role:"leader"`
remove string `name:"remove" role:"leader"`
document string `name:"document title content link" role:"leader"`
}
func (s product) Inputs(m *ice.Message, arg ...string) {
switch arg[0] {
case model.SERVICE_UID:
m.Cmdy(s.PrefixService(m), s.Select, model.STATUS, gonganxitong.ServiceOnline)
m.Cut(model.UID, model.NAME, model.ICON).RenameAppend(model.UID, arg[0])
m.DisplayInputKeyNameIconTitle()
case model.PLACE_UID:
s.Orders(m, s.Desc(model.SCORE), s.Desc(model.UPDATED_AT))
m.Cmdy(s.PrefixRecent(m), s.Select, m.OptionSimple(model.SERVICE_UID, model.USER_UID))
m.Cut(model.PLACE_UID, model.PLACE_NAME, model.PLACE_AVATAR).RenameAppend(model.PLACE_NAME, model.NAME, model.PLACE_AVATAR, model.ICON)
m.DisplayInputKeyNameIconTitle()
default:
s.Table.Inputs(m, arg...)
}
}
func (s product) Create(m *ice.Message, arg ...string) {
m.Options(arg).OptionDefault(model.BEGIN_TIME, m.Time(), model.END_TIME, m.Time("720h"))
if m.Option(model.PLACE_UID) == "" {
msg := m.Cmd(s.PrefixService(m), s.Select, model.UID, m.Option(model.SERVICE_UID)).RenameAppend(model.NODENAME, model.SPACE)
s.ValueCreate(m, kit.Simple(msg.AppendSimple(model.SERVICE_UID, model.SPACE, model.INDEX, model.NAME, model.ICON),
m.OptionSimple(model.TITLE, model.CONTENT, model.BEGIN_TIME, model.END_TIME))...)
} else {
msg := m.Cmd(s.PrefixRecent(m), s.Select, m.OptionSimple(model.PLACE_UID, model.SERVICE_UID, model.USER_UID))
s.SelectJoinService(msg)
s.ValueCreate(m, kit.Simple(msg.AppendSimple(model.SERVICE_UID, model.PLACE_UID, model.SPACE, model.INDEX),
model.ICON, msg.Append(model.PLACE_AVATAR), model.NAME, msg.Append(model.PLACE_NAME),
m.OptionSimple(model.TITLE, model.CONTENT, model.BEGIN_TIME, model.END_TIME))...)
}
}
func (s product) List(m *ice.Message, arg ...string) {
s.ValueList(m, arg).Display("").Table(func(value ice.Maps) {
button := []ice.Any{s.Enter}
defer func() { m.PushButton(button...) }()
if s.IsLeader(m) {
if button = append(button, s.Document, s.Modify); kit.Int(value[model.INVITE_COUNT]) == 0 {
button = append(button, s.Remove)
}
}
})
s.WaitLeaderCreate(m, "产品")
s.OtherListCmd(m, s.DocumentList, s.FeedbackList, s.BonusList, s.DealList, s.InviteList, s.VisiteList)
}
func (s product) Enter(m *ice.Message, arg ...string) {
s.Fields(m, model.SPACE, model.INDEX, model.PLACE_UID).Select(m, m.OptionSimple(model.UID, model.PROMOTION_UID)...)
if m.Append(model.INDEX) != "" {
m.ProcessOpen(s.SpaceLink(m, m.Append(model.SPACE), m.Append(model.INDEX), m.Append(model.PLACE_UID)))
}
}
func (s product) Document(m *ice.Message, arg ...string) {
m.Cmdy(document{}, s.Create, model.PRODUCT_UID, m.Option(model.UID), arg)
}
func init() { ice.TeamCtxCmd(product{}) }