mirror of
https://shylinux.com/x/community
synced 2025-04-25 09:38:06 +08:00
63 lines
1.4 KiB
Go
63 lines
1.4 KiB
Go
package huodongzuzhi
|
|
|
|
import (
|
|
"shylinux.com/x/ice"
|
|
|
|
"shylinux.com/x/community/src/huodongzuzhi/model"
|
|
)
|
|
|
|
type userGroup struct {
|
|
Table
|
|
group group
|
|
}
|
|
|
|
func (s userGroup) User(m *ice.Message, arg ...string) {
|
|
s.FieldsWithCreatedAT(m, s, model.USER_UID, model.ROLE)
|
|
if len(arg) == 1 {
|
|
s.Select(m, model.GROUP_UID, arg[0])
|
|
} else if len(arg) == 2 {
|
|
s.SelectDetail(m, model.GROUP_UID, arg[0], model.UID, arg[1])
|
|
} else {
|
|
return
|
|
}
|
|
m.RenameAppend(model.ROLE, model.USER_GROUP_ROLE)
|
|
s.SelectJoinUser(m)
|
|
}
|
|
func (s userGroup) List(m *ice.Message, arg ...string) {
|
|
s.Tables(m, s.group).FieldsWithCreatedAT(m, s,
|
|
model.GROUP_NAME, model.GROUP_TYPE, model.USER_GROUP_ROLE,
|
|
model.COMPANY_UID, model.GROUP_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.GROUP_UID), arg[1])
|
|
} else {
|
|
return
|
|
}
|
|
s.SelectJoinCompany(m)
|
|
s.SelectJoinCity(m)
|
|
}
|
|
|
|
func init() { ice.TeamCtxCmd(userGroup{}) }
|
|
|
|
type UserGroupRole int
|
|
|
|
const (
|
|
UserGroupVisitor UserGroupRole = iota
|
|
UserGroupCreator
|
|
UserGroupLeader
|
|
UserGroupWorker
|
|
UserGroupServer
|
|
)
|
|
|
|
var UserGroupRoleList = map[UserGroupRole]string{
|
|
UserGroupVisitor: "visitor",
|
|
UserGroupCreator: "creator",
|
|
UserGroupLeader: "leader",
|
|
UserGroupWorker: "worker",
|
|
UserGroupServer: "server",
|
|
}
|
|
|
|
func (s UserGroupRole) String() string { return UserGroupRoleList[s] }
|