mirror of
https://shylinux.com/x/community
synced 2025-07-03 05:51:20 +08:00
72 lines
2.2 KiB
Go
72 lines
2.2 KiB
Go
package gonganxitong
|
|
|
|
import (
|
|
"shylinux.com/x/ice"
|
|
|
|
"shylinux.com/x/community/src/api"
|
|
"shylinux.com/x/community/src/gonganxitong/model"
|
|
)
|
|
|
|
type city struct {
|
|
Table
|
|
order string `data:"507"`
|
|
role string `data:"tech"`
|
|
list string `name:"list name auto"`
|
|
}
|
|
|
|
func (s user) Init(m *ice.Message, arg ...string) {
|
|
cmdPortal[m.PrefixKey()] = api.GONGANXITONG_PORTAL
|
|
cmdSpace[m.PrefixKey()] = "20240724-community"
|
|
}
|
|
func (s street) Init(m *ice.Message, arg ...string) {
|
|
cmdPortal[m.PrefixKey()] = api.GONGANXITONG_PORTAL
|
|
}
|
|
func (s city) Init(m *ice.Message, arg ...string) {
|
|
cmdPortal[m.PrefixKey()] = api.GONGANXITONG_PORTAL
|
|
}
|
|
func (s city) FindOrCreateByName(m *ice.Message, arg ...string) {
|
|
if msg := m.Cmd(s, s.Select, model.NAME, arg[1]); msg.Length() == 0 {
|
|
msg := m.Cmd(s, s.Insert, model.NAME, arg[1])
|
|
arg[0], arg[1] = model.CITY_UID, msg.Result()
|
|
} else {
|
|
arg[0], arg[1] = model.CITY_UID, msg.Append(model.UID)
|
|
}
|
|
}
|
|
func (s city) List(m *ice.Message, arg ...string) {
|
|
if len(arg) == 0 {
|
|
s.Select(m)
|
|
s.SelectJoinAuth(m)
|
|
m.Table(func(value ice.Maps) {
|
|
switch value[model.AUTH_STATUS] {
|
|
case "create":
|
|
m.PushButton(s.AuthInfo, s.AuthMember, s.AuthClean)
|
|
case "issued":
|
|
m.PushButton(s.AuthInfo, s.AuthMember)
|
|
default:
|
|
m.PushButton(s.AuthCreate, s.Delete)
|
|
}
|
|
}).Action()
|
|
m.Sort("auth_status", []string{"issued", "create"})
|
|
} else if len(arg) == 1 {
|
|
s.SelectDetail(m, model.NAME, arg[0])
|
|
if m.Append(model.AUTH_UID) == "" && m.IsTech() {
|
|
m.EchoInfoButton(m.Trans("please auth city", "请申请城市认证"), s.AuthCreate)
|
|
}
|
|
}
|
|
}
|
|
func (s city) AuthCreate(m *ice.Message, arg ...string) {
|
|
s.Table.AuthCreate(m, api.AuthCity, "", m.OptionSimple(model.NAME)...)
|
|
}
|
|
func (s city) AuthInfo(m *ice.Message, arg ...string) {
|
|
m.ProcessOpen(s.SpaceLink(m, "20240724-community", api.RENZHENGSHOUQUAN_PORTAL, m.Option(model.AUTH_UID)))
|
|
}
|
|
func (s city) AuthMember(m *ice.Message, arg ...string) {
|
|
m.ProcessOpen(s.SpaceLink(m, "20240724-community", api.RENZHENGSHOUQUAN_PORTAL, m.Option(model.AUTH_UID), api.RENZHENGSHOUQUAN_MEMBER))
|
|
}
|
|
func (s city) AuthClean(m *ice.Message, arg ...string) {
|
|
s.Update(m, ice.Map{model.AUTH_UID: ""})
|
|
m.Cmd(api.RENZHENGSHOUQUAN_CLEAN, "prune", m.Option(model.AUTH_UID))
|
|
}
|
|
|
|
func init() { ice.TeamCtxCmd(city{}) }
|