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 credit struct { Tables user user city city order string `data:"101"` authCity string `name:"authCity" role:"void"` authPersonal string `name:"authPersonal" role:"void"` authService string `name:"authService" role:"void"` authCompany string `name:"authCompany" role:"void"` } func (s credit) List(m *ice.Message, arg ...string) { msg := m.Cmd(s.Place, s.Select, model.UID, arg[0]) if msg.Append(model.AUTH_UID) != "" { m.ProcessField(api.RENZHENGSHOUQUAN_PROFILE, msg.Append(model.AUTH_UID)) return } if !s.IsWorker(m) { m.Echo("本服务暂未申请认证") return } m.SetResult().EchoInfoButton("请申请服务认证", s.AuthService) msg = m.Cmd(s.Street, s.Select, model.UID, msg.Append(s.Keys(s.Street, model.UID))) if msg.Append(model.AUTH_UID) != "" { return } m.SetResult().EchoInfoButton("请申请公司认证", s.AuthCompany) msg = m.Cmd(s.city, s.Select, model.UID, msg.Append(model.CITY_UID)) if msg.Append(model.AUTH_UID) != "" { if msg := m.Cmd(s.user, s.Select, model.UID, m.Option(model.USER_UID)); msg.Append(model.AUTH_UID) == "" { m.SetResult().EchoInfoButton("请申请个人认证", s.AuthPersonal) } return } m.SetResult().EchoInfoButton("请申请城市认证", s.AuthCity) } func (s credit) AuthService(m *ice.Message, arg ...string) { m.Cmdy(s.PrefixPortal(m), Portal{}.PlaceAuth, kit.Dict(s.placeInfo(m).AppendSimple())).ProcessRefresh() } func (s credit) AuthPersonal(m *ice.Message, arg ...string) { msg := m.Cmd(s.city, s.Select, model.NAME, m.Option(model.CITY_NAME)) m.Cmdy(s.user, s.AuthCreate, kit.Dict(msg.AppendSimple(model.AUTH_UID))) } func (s credit) AuthCompany(m *ice.Message, arg ...string) { m.Cmdy(s.Street, s.AuthCreate, kit.Dict(s.streetInfo(m).AppendSimple(model.NAME, model.INFO, model.UID, model.CITY_UID))) } func (s credit) AuthCity(m *ice.Message, arg ...string) { m.Cmdy(s.city, s.AuthCreate, kit.Dict(s.cityInfo(m).AppendSimple(model.NAME, model.INFO))) } func init() { ice.TeamCtxCmd(credit{Tables: newTables()}) } func (s credit) placeInfo(m *ice.Message, arg ...string) *ice.Message { return m.Cmd(s.Place, s.Select, model.UID, m.Option(s.Keys(s.Place, model.UID))) } func (s credit) streetInfo(m *ice.Message, arg ...string) *ice.Message { return m.Cmd(s.Street, s.Select, model.UID, s.placeInfo(m).Append(s.Keys(s.Street, model.UID))) } func (s credit) cityInfo(m *ice.Message, arg ...string) *ice.Message { return m.Cmd(s.city, s.Select, model.UID, s.streetInfo(m).Append(model.CITY_UID)) }