mirror of
https://shylinux.com/x/community
synced 2025-05-09 07:08:11 +08:00
47 lines
1.6 KiB
Go
47 lines
1.6 KiB
Go
package gonganxitong
|
|
|
|
import (
|
|
"shylinux.com/x/ice"
|
|
kit "shylinux.com/x/toolkits"
|
|
|
|
"shylinux.com/x/community/src/gonganxitong/model"
|
|
)
|
|
|
|
type street struct {
|
|
Table
|
|
city city
|
|
modify string `name:"modify info" role:"tech"`
|
|
list string `name:"list city_name street_name auto" role:"void"`
|
|
authCreate string `name:"authCreate" role:"tech"`
|
|
}
|
|
|
|
func (s street) FindOrCreateByName(m *ice.Message, arg ...string) {
|
|
if msg := m.Cmd(s, s.Select, model.CITY_UID, arg[1], model.NAME, arg[3]); msg.Length() == 0 {
|
|
msg := m.Cmd(s, s.Insert, model.CITY_UID, arg[1], model.NAME, arg[3])
|
|
arg[2], arg[3] = model.STREET_UID, msg.Result()
|
|
} else {
|
|
arg[2], arg[3] = model.STREET_UID, msg.Append(model.UID)
|
|
}
|
|
}
|
|
func (s street) Modify(m *ice.Message, arg ...string) {
|
|
s.Update(m, kit.Dict(m.OptionSimple(model.INFO)), m.OptionSimple(model.UID)...)
|
|
}
|
|
func (s street) List(m *ice.Message, arg ...string) {
|
|
if len(arg) == 0 {
|
|
m.Cmdy(s.city).RenameAppend(model.NAME, model.CITY_NAME)
|
|
} else if msg := m.Cmd(s.city, arg[0]); len(arg) == 1 {
|
|
s.Select(m, model.CITY_UID, msg.Append(model.UID)).Action()
|
|
} else if len(arg) == 2 {
|
|
s.SelectDetail(m, model.CITY_UID, msg.Append(model.UID), model.NAME, arg[1])
|
|
if m.Append(model.AUTH_UID) == "" && m.IsTech() {
|
|
m.EchoInfoButton("请申请街道认证", s.AuthCreate)
|
|
}
|
|
}
|
|
}
|
|
func (s street) AuthCreate(m *ice.Message, arg ...string) {
|
|
msg := m.Cmd("web.team.gonganxitong.city", s.Select, model.UID, m.Option(model.CITY_UID))
|
|
s.Table.AuthCreate(m, 6, msg.Append(model.AUTH_UID), m.OptionSimple(model.UID)...)
|
|
}
|
|
|
|
func init() { ice.TeamCtxCmd(street{}) }
|