2025-06-26 22:34:57 +08:00

43 lines
1.4 KiB
Go

package production
import (
"shylinux.com/x/ice"
kit "shylinux.com/x/toolkits"
"shylinux.com/x/operation/src/production/model"
)
type Deal struct {
Table
order string `data:"11"`
role string `data:"leader,worker"`
fields string `data:"from_user_uid,to_user_uid,price,title,content,issue_uid"`
create string `name:"create issue_uid*:select from_user_uid*:select to_user_uid*:select price* title* content" role:"leader"`
modify string `name:"modify title* content" role:"leader"`
}
func (s Deal) Create(m *ice.Message, arg ...string) {
s.ValueCreate(m, arg...)
s.SendMessage(s.GetCommandUID(m), m.Option(model.FROM_USER_UID), m.Option(model.TO_USER_UID))
s.SendMessage(s.GetCommandUID(m), m.Option(model.TO_USER_UID), m.Option(model.FROM_USER_UID))
}
func (s Deal) List(m *ice.Message, arg ...string) {
defer kit.If(!s.IsCreator(m), func() { m.Action() })
if s.IsLeader(m) {
s.ValueList(m, arg)
} else {
if len(arg) == 1 {
s.Select(m, model.STORY_UID, arg[0], model.TO_USER_UID, m.Option(model.USER_UID))
kit.If(m.Length() == 0, func() { m.Echo("请等待管理人员支付工钱") })
} else {
s.SelectDetail(m, model.STORY_UID, arg[0], model.TO_USER_UID, m.Option(model.USER_UID), model.UID, arg[1])
s.DoneMessage(m)
}
}
m.PushAction()
m.RenameAppend(model.TO_USER_UID, model.USER_UID).Display("")
s.OtherListCmd(m, s.IssueList, s.DesignList)
}
func init() { ice.TeamCtxCmd(Deal{}) }