2025-06-02 19:13:16 +08:00

45 lines
1.5 KiB
Go

package production
import (
"shylinux.com/x/ice"
"shylinux.com/x/operation/src/production/model"
kit "shylinux.com/x/toolkits"
)
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* from_user_uid* to_user_uid* 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) {
if s.IsLeader(m) {
s.ValueList(m, arg).PushAction()
s.StatusPrice(m, arg...)
} else {
if len(arg) == 1 {
s.Select(m, model.STORY_UID, arg[0], model.TO_USER_UID, m.Option(model.USER_UID)).PushAction().Action()
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]).PushAction().Action()
s.DoneMessage(m)
}
}
if m.Display(""); s.IsLeader(m) {
m.RenameAppend(model.TO_USER_UID, model.USER_UID)
} else {
m.RenameAppend(model.FROM_USER_UID, model.USER_UID)
}
s.OtherListCmd(m, s.IssueList, s.DesignList)
}
func init() { ice.TeamCtxCmd(Deal{}) }