mirror of
https://shylinux.com/x/community
synced 2025-05-12 00:08:15 +08:00
76 lines
2.5 KiB
Go
76 lines
2.5 KiB
Go
package gonganxitong
|
|
|
|
import (
|
|
"shylinux.com/x/ice"
|
|
kit "shylinux.com/x/toolkits"
|
|
|
|
"shylinux.com/x/community/src/api"
|
|
"shylinux.com/x/community/src/gonganxitong/model"
|
|
)
|
|
|
|
type goodslist struct {
|
|
Table
|
|
order string `data:"91"`
|
|
fields string `data:"name,price,title,content,user_uid"`
|
|
create string `name:"create name* price* title* content*" role:"leader"`
|
|
remove string `name:"remove" role:"leader"`
|
|
payfor string `name:"payfor" help:"购买" style:"notice" role:"worker"`
|
|
}
|
|
|
|
func (s goodslist) AfterMigrate(m *ice.Message, arg ...string) {
|
|
s.Table.AfterMigrate(m, arg...)
|
|
s.insert(m, "service", "3-1", "1000", "初级版")
|
|
s.insert(m, "service", "3-2", "3000", "高级版")
|
|
s.insert(m, "service", "3-3", "5000", "旗舰版")
|
|
s.insert(m, "company", "4-1", "10000", "企业初级版")
|
|
s.insert(m, "company", "4-2", "30000", "企业高级版")
|
|
s.insert(m, "company", "4-3", "50000", "企业旗舰版")
|
|
s.insert(m, "school", "5-1", "10000", "教育初级版")
|
|
s.insert(m, "school", "5-2", "30000", "教育高级版")
|
|
s.insert(m, "school", "5-3", "50000", "教育旗舰版")
|
|
}
|
|
func (s goodslist) Create(m *ice.Message, arg ...string) {
|
|
s.ValueCreate(m, s.TransPrice(m, arg, model.PRICE)...)
|
|
}
|
|
func (s goodslist) List(m *ice.Message, arg ...string) {
|
|
if len(arg) == 1 {
|
|
if s.PrefixPortal(m) == api.RENZHENGSHOUQUAN_PORTAL {
|
|
msg := m.Cmd(api.RENZHENGSHOUQUAN_AUTH, s.Table.Select, model.UID, arg[0])
|
|
switch kit.Int(msg.Append(model.AUTH_TYPE)) {
|
|
case 3:
|
|
s.Table.Select(m, model.PLACE_UID, "service")
|
|
case 4:
|
|
s.Table.Select(m, model.PLACE_UID, "company")
|
|
case 5:
|
|
s.Table.Select(m, model.PLACE_UID, "school")
|
|
}
|
|
m.PushAction(s.Payfor).Action()
|
|
} else {
|
|
if s.IsLeader(m) {
|
|
s.Table.Select(m, model.PLACE_UID, "service")
|
|
m.PushAction(s.Payfor).Action()
|
|
}
|
|
msg := s.Table.Select(m.Spawn(), model.PLACE_UID, arg[0])
|
|
if s.IsLeader(m) {
|
|
msg.PushAction(s.Payfor, s.Table.Remove).Action(s.Table.Create)
|
|
} else {
|
|
msg.PushAction(s.Payfor).Action()
|
|
}
|
|
m.Copy(msg)
|
|
s.SelectJoinUser(m)
|
|
}
|
|
} else if len(arg) == 2 {
|
|
m.Cmdy(quotalist{}, s.Select, model.GOODSLIST_UID, arg[1])
|
|
m.Action(s.Payfor)
|
|
}
|
|
m.Display("")
|
|
}
|
|
func (s goodslist) Payfor(m *ice.Message, arg ...string) {
|
|
}
|
|
|
|
func init() { ice.TeamCtxCmd(goodslist{Table: newTable()}) }
|
|
|
|
func (s goodslist) insert(m *ice.Message, auth, level, price string, arg ...string) {
|
|
s.Insert(m, model.UID, kit.Hashs(auth, level), model.PLACE_UID, auth, model.NAME, level, model.PRICE, price, model.TITLE, kit.Select("", arg, 0), model.CONTENT, kit.Select("", arg, 1))
|
|
}
|