mirror of
https://shylinux.com/x/community
synced 2025-04-25 17:48:06 +08:00
64 lines
1.5 KiB
Go
64 lines
1.5 KiB
Go
package gonganxitong
|
|
|
|
import (
|
|
"shylinux.com/x/ice"
|
|
|
|
"shylinux.com/x/community/src/gonganxitong/model"
|
|
)
|
|
|
|
type userPlace struct {
|
|
Table
|
|
user user
|
|
place place
|
|
street street
|
|
city city
|
|
}
|
|
|
|
func (s userPlace) User(m *ice.Message, arg ...string) {
|
|
s.Tables(m, s.user).FieldsWithCreatedAT(m, s,
|
|
model.USER_AVATAR, model.USER_NAME, model.USER_PLACE_ROLE, model.BEGIN_TIME, model.END_TIME,
|
|
)
|
|
if len(arg) == 1 {
|
|
s.Select(m, model.PLACE_UID, arg[0])
|
|
} else if len(arg) == 2 {
|
|
s.SelectDetail(m, model.PLACE_UID, arg[0], s.Key(s, model.UID), arg[1])
|
|
} else {
|
|
return
|
|
}
|
|
}
|
|
func (s userPlace) List(m *ice.Message, arg ...string) {
|
|
s.Tables(m, s.place, s.street, s.city).FieldsWithCreatedAT(m, s,
|
|
model.PLACE_NAME, model.PLACE_TYPE, model.USER_PLACE_ROLE,
|
|
model.CITY_NAME, model.STREET_NAME, model.PLACE_ADDRESS, model.PLACE_UID,
|
|
)
|
|
if len(arg) == 1 {
|
|
s.Select(m, model.USER_UID, arg[0])
|
|
} else if len(arg) == 2 {
|
|
s.SelectDetail(m, model.USER_UID, arg[0], s.Key(s, model.PLACE_UID), arg[1])
|
|
} else {
|
|
return
|
|
}
|
|
}
|
|
|
|
func init() { ice.TeamCtxCmd(userPlace{Table: newTable()}) }
|
|
|
|
type UserPlaceRole int
|
|
|
|
const (
|
|
UserPlaceVisitor UserPlaceRole = iota
|
|
UserPlaceCreator
|
|
UserPlaceLandlord
|
|
UserPlaceTenant
|
|
UserPlaceAdmin
|
|
)
|
|
|
|
var UserPlaceRoleList = map[UserPlaceRole]string{
|
|
UserPlaceVisitor: "visitor",
|
|
UserPlaceCreator: "creator",
|
|
UserPlaceLandlord: "landlord",
|
|
UserPlaceTenant: "tenant",
|
|
UserPlaceAdmin: "admin",
|
|
}
|
|
|
|
func (s UserPlaceRole) String() string { return UserPlaceRoleList[s] }
|