mirror of
https://shylinux.com/x/community
synced 2025-05-08 06:46:55 +08:00
56 lines
1.4 KiB
Go
56 lines
1.4 KiB
Go
package renzhengshouquan
|
|
|
|
import (
|
|
"strconv"
|
|
|
|
"shylinux.com/x/ice"
|
|
"shylinux.com/x/icebergs/base/aaa"
|
|
kit "shylinux.com/x/toolkits"
|
|
|
|
"shylinux.com/x/community/src/renzhengshouquan/model"
|
|
"shylinux.com/x/enterprise/src/guanlixitong"
|
|
)
|
|
|
|
type Table struct {
|
|
guanlixitong.Table
|
|
list string `name:"list auth_uid uid auto" role:"void"`
|
|
}
|
|
|
|
func (s Table) Inputs(m *ice.Message, arg ...string) {
|
|
switch arg[0] {
|
|
case model.USER_AUTH_ROLE:
|
|
s.InputsListRole(m, UserAuthRoleList, arg...)
|
|
case model.AUTH_TYPE:
|
|
s.InputsListSkip(m, AuthTypeList, kit.Select("0", "-1", m.IsTech()), arg...)
|
|
case model.AUTH_STATUS:
|
|
s.InputsList(m, AuthStatusList, arg...)
|
|
case model.FROM_UID:
|
|
if AuthType(kit.Int(m.Option(model.AUTH_TYPE))) == AuthRoot {
|
|
m.Push(arg[0], aaa.ROOT)
|
|
}
|
|
default:
|
|
s.Table.Inputs(m, arg...)
|
|
}
|
|
}
|
|
func (s Table) RewriteAppend(m *ice.Message, arg ...string) *ice.Message {
|
|
m.RewriteAppend(func(value, key string, index int) string {
|
|
if _, e := strconv.ParseInt(value, 10, 64); e != nil {
|
|
return value
|
|
}
|
|
switch key {
|
|
case model.USER_AUTH_ROLE:
|
|
value = UserAuthRole(kit.Int(value)).String()
|
|
case model.AUTH_TYPE:
|
|
value = AuthType(kit.Int(value)).String()
|
|
case model.AUTH_STATUS:
|
|
value = AuthStatus(kit.Int(value)).String()
|
|
}
|
|
return value
|
|
})
|
|
return s.Table.RewriteAppend(m)
|
|
}
|
|
|
|
type Tables struct{ Table }
|
|
|
|
func (s Tables) BeforeMigrate(m *ice.Message, arg ...string) {}
|