mirror of
https://shylinux.com/x/community
synced 2025-07-01 21:21:19 +08:00
add some
This commit is contained in:
parent
bfaea581a0
commit
3ad6ba3a9a
@ -279,11 +279,33 @@ func (s Table) SelectJoinSess(m *ice.Message, arg ...string) *ice.Message {
|
|||||||
s.Fields(msg, append(arg, TARGET_UID)).Orders(msg, s.Desc(model.CREATED_AT)).Groups(msg, TARGET_UID).Limit(msg, 3000)
|
s.Fields(msg, append(arg, TARGET_UID)).Orders(msg, s.Desc(model.CREATED_AT)).Groups(msg, TARGET_UID).Limit(msg, 3000)
|
||||||
data := msg.CmdMap(target, s.SelectList, TARGET_UID, list, TARGET_UID)
|
data := msg.CmdMap(target, s.SelectList, TARGET_UID, list, TARGET_UID)
|
||||||
m.Table(func(value ice.Maps) {
|
m.Table(func(value ice.Maps) {
|
||||||
recent := data[value[TARGET_UID]]
|
recent := data[value[UID]]
|
||||||
kit.For(arg, func(k string) { m.Push(k, recent[k]) })
|
kit.For(arg, func(k string) { m.Push(k, recent[k]) })
|
||||||
})
|
})
|
||||||
return m
|
return m
|
||||||
}
|
}
|
||||||
|
func (s Table) SelectJoinToUser(m *ice.Message) *ice.Message {
|
||||||
|
s.SelectJoinBy(m, model.TO_USER_UID, model.UID, "to_user", api.GONGANXITONG_USER, model.NAME, model.AVATAR)
|
||||||
|
return m
|
||||||
|
}
|
||||||
|
func (s Table) SelectJoinBy(m *ice.Message, UID, TARGET_UID string, prefix string, target ice.Any, arg ...string) *ice.Message {
|
||||||
|
if m.Length() == 0 {
|
||||||
|
return m
|
||||||
|
}
|
||||||
|
if kit.IndexOf(m.Appendv(ice.MSG_APPEND), UID) == -1 && kit.IndexOf(m.Appendv(ice.KEY), UID) == -1 {
|
||||||
|
return m
|
||||||
|
}
|
||||||
|
list := []string{}
|
||||||
|
m.Table(func(value ice.Maps) { list = kit.AddUniq(list, value[UID]) })
|
||||||
|
msg := m.Spawn()
|
||||||
|
s.Fields(msg, append(arg, TARGET_UID)).Orders(msg, s.Desc(model.CREATED_AT)).Groups(msg, TARGET_UID).Limit(msg, 3000)
|
||||||
|
data := msg.CmdMap(target, s.SelectList, TARGET_UID, list, TARGET_UID)
|
||||||
|
m.Table(func(value ice.Maps) {
|
||||||
|
recent := data[value[UID]]
|
||||||
|
kit.For(arg, func(k string) { m.Push(s.Keys(prefix, k), recent[k]) })
|
||||||
|
})
|
||||||
|
return m
|
||||||
|
}
|
||||||
func (s Table) SelectJoinService(m *ice.Message, arg ...string) *ice.Message {
|
func (s Table) SelectJoinService(m *ice.Message, arg ...string) *ice.Message {
|
||||||
kit.If(len(arg) == 0, func() { arg = append(arg, model.NODENAME, model.INDEX, model.NAME, model.ICON) })
|
kit.If(len(arg) == 0, func() { arg = append(arg, model.NODENAME, model.INDEX, model.NAME, model.ICON) })
|
||||||
return s.SelectJoin(m, service{}, arg...)
|
return s.SelectJoin(m, service{}, arg...)
|
||||||
@ -463,12 +485,15 @@ func (s Table) SpaceOpsCmd(m *ice.Message, arg ...ice.Any) *ice.Message {
|
|||||||
return s.SpaceCmd(m, ice.OPS, arg...)
|
return s.SpaceCmd(m, ice.OPS, arg...)
|
||||||
}
|
}
|
||||||
func (s Table) SpaceLink(m *ice.Message, space, index string, arg ...string) string {
|
func (s Table) SpaceLink(m *ice.Message, space, index string, arg ...string) string {
|
||||||
|
defer s.SaveBack(m, ice.MSG_USERPOD, ice.MSG_USERROLE)()
|
||||||
return m.Cmdx(web.SPACE, space, index, s.Link, arg, ice.Maps{ice.MSG_USERPOD: space, ice.MSG_USERROLE: aaa.TECH})
|
return m.Cmdx(web.SPACE, space, index, s.Link, arg, ice.Maps{ice.MSG_USERPOD: space, ice.MSG_USERROLE: aaa.TECH})
|
||||||
}
|
}
|
||||||
func (s Table) SpaceCmdy(m *ice.Message, space string, arg ...ice.Any) *ice.Message {
|
func (s Table) SpaceCmdy(m *ice.Message, space string, arg ...ice.Any) *ice.Message {
|
||||||
|
defer s.SaveBack(m, ice.MSG_USERPOD, ice.MSG_USERROLE)()
|
||||||
return m.Cmdy(append([]ice.Any{web.SPACE, space, kit.Dict(ice.MSG_USERROLE, aaa.TECH)}, arg...)...)
|
return m.Cmdy(append([]ice.Any{web.SPACE, space, kit.Dict(ice.MSG_USERROLE, aaa.TECH)}, arg...)...)
|
||||||
}
|
}
|
||||||
func (s Table) SpaceCmd(m *ice.Message, space string, arg ...ice.Any) *ice.Message {
|
func (s Table) SpaceCmd(m *ice.Message, space string, arg ...ice.Any) *ice.Message {
|
||||||
|
defer s.SaveBack(m, ice.MSG_USERPOD, ice.MSG_USERROLE)()
|
||||||
return m.Cmd(append([]ice.Any{web.SPACE, space, kit.Dict(ice.MSG_USERROLE, aaa.TECH)}, arg...)...)
|
return m.Cmd(append([]ice.Any{web.SPACE, space, kit.Dict(ice.MSG_USERROLE, aaa.TECH)}, arg...)...)
|
||||||
}
|
}
|
||||||
func (s Table) AutoCmdy(m *ice.Message, arg ...ice.Any) *ice.Message {
|
func (s Table) AutoCmdy(m *ice.Message, arg ...ice.Any) *ice.Message {
|
||||||
@ -477,15 +502,14 @@ func (s Table) AutoCmdy(m *ice.Message, arg ...ice.Any) *ice.Message {
|
|||||||
return m.Cmdy(append([]ice.Any{s.findSpaceCmd(m, arg[0])}, arg[1:]...)...)
|
return m.Cmdy(append([]ice.Any{s.findSpaceCmd(m, arg[0])}, arg[1:]...)...)
|
||||||
}
|
}
|
||||||
func (s Table) AutoCmd(m *ice.Message, arg ...ice.Any) *ice.Message {
|
func (s Table) AutoCmd(m *ice.Message, arg ...ice.Any) *ice.Message {
|
||||||
|
defer s.SaveBack(m, ice.MSG_USERPOD, ice.MSG_USERROLE)()
|
||||||
arg = append(arg, kit.Dict(ice.MSG_USERROLE, aaa.TECH))
|
arg = append(arg, kit.Dict(ice.MSG_USERROLE, aaa.TECH))
|
||||||
return m.Cmd(append([]ice.Any{s.findSpaceCmd(m, arg[0])}, arg[1:]...)...)
|
return m.Cmd(append([]ice.Any{s.findSpaceCmd(m, arg[0])}, arg[1:]...)...)
|
||||||
}
|
}
|
||||||
func (s Table) SaveBack(m *ice.Message, arg ...string) func() {
|
func (s Table) SaveBack(m *ice.Message, arg ...string) func() {
|
||||||
list := []string{}
|
list := []string{}
|
||||||
kit.For(arg, func(k string) { list = append(list, m.Option(k)) })
|
kit.For(arg, func(k string) { list = append(list, m.Option(k)) })
|
||||||
return func() {
|
return func() { kit.For(arg, func(i int, k string) { m.Option(k, list[i]) }) }
|
||||||
kit.For(arg, func(i int, k string) { m.Option(k, list[i]) })
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
func (s Table) findSpaceCmd(m *ice.Message, cmd ice.Any) ice.Any {
|
func (s Table) findSpaceCmd(m *ice.Message, cmd ice.Any) ice.Any {
|
||||||
cmds := ice.GetTypeKey(cmd)
|
cmds := ice.GetTypeKey(cmd)
|
||||||
|
@ -50,7 +50,7 @@ func (s member) Enable(m *ice.Message, arg ...string) {
|
|||||||
func (s member) List(m *ice.Message, arg ...string) {
|
func (s member) List(m *ice.Message, arg ...string) {
|
||||||
USER_PLACE_ROLE := s.Keys(s.UserPlace, model.ROLE)
|
USER_PLACE_ROLE := s.Keys(s.UserPlace, model.ROLE)
|
||||||
user_uid, isLeader, isCreator := m.Option(model.USER_UID), s.IsLeader(m), s.IsCreator(m)
|
user_uid, isLeader, isCreator := m.Option(model.USER_UID), s.IsLeader(m), s.IsCreator(m)
|
||||||
s.FieldsWithCreatedAT(m, s.UserPlace, s.AS(s.Key(s.UserPlace, model.STATUS), model.MEMBER_STATUS), USER_PLACE_ROLE, model.INFO, model.USER_UID).Limit(m, 300)
|
s.FieldsWithCreatedAT(m, s.UserPlace, s.AS(s.Key(s.UserPlace, model.STATUS), model.MEMBER_STATUS), USER_PLACE_ROLE, model.INFO, model.USER_UID).Limit(m, 3000)
|
||||||
if len(arg) == 1 {
|
if len(arg) == 1 {
|
||||||
m.Cmdy(s.UserPlace, s.Select, s.Keys(s.Place, model.UID), arg[0]).Action()
|
m.Cmdy(s.UserPlace, s.Select, s.Keys(s.Place, model.UID), arg[0]).Action()
|
||||||
defer s.Place.RewriteAppend(m)
|
defer s.Place.RewriteAppend(m)
|
||||||
|
@ -84,6 +84,7 @@ const (
|
|||||||
SERVICE_TYPE = "service_type"
|
SERVICE_TYPE = "service_type"
|
||||||
SERVICE_STATUS = "service_status"
|
SERVICE_STATUS = "service_status"
|
||||||
SERVICE_ICON = "service_icon"
|
SERVICE_ICON = "service_icon"
|
||||||
|
COMPANY_UID = "company_uid"
|
||||||
COMMAND_UID = "command_uid"
|
COMMAND_UID = "command_uid"
|
||||||
COMMAND_NAME = "command_name"
|
COMMAND_NAME = "command_name"
|
||||||
COMMAND_ICON = "command_icon"
|
COMMAND_ICON = "command_icon"
|
||||||
@ -143,6 +144,7 @@ type User struct {
|
|||||||
OpenID string `gorm:"type:char(32);index"`
|
OpenID string `gorm:"type:char(32);index"`
|
||||||
Email string `gorm:"type:varchar(64)"`
|
Email string `gorm:"type:varchar(64)"`
|
||||||
Language string `gorm:"type:char(8)"`
|
Language string `gorm:"type:char(8)"`
|
||||||
|
Status uint8 `gorm:"default:0"`
|
||||||
}
|
}
|
||||||
type UserPlace struct {
|
type UserPlace struct {
|
||||||
db.ModelUserPlace
|
db.ModelUserPlace
|
||||||
@ -167,8 +169,8 @@ type Apply struct {
|
|||||||
db.ModelWithUID
|
db.ModelWithUID
|
||||||
PlaceUID string `gorm:"type:char(32);index:idx_place"`
|
PlaceUID string `gorm:"type:char(32);index:idx_place"`
|
||||||
UserUID string `gorm:"type:char(32);index:idx_place"`
|
UserUID string `gorm:"type:char(32);index:idx_place"`
|
||||||
Status uint8 `gorm:default:0`
|
Status uint8 `gorm:"default:0"`
|
||||||
Role uint8 `gorm:default:0`
|
Role uint8 `gorm:"default:0"`
|
||||||
BeginTime db.Time
|
BeginTime db.Time
|
||||||
EndTime db.Time
|
EndTime db.Time
|
||||||
}
|
}
|
||||||
|
@ -18,7 +18,7 @@ $action div.item.text.filter input:focus { border:var(--box-border); }
|
|||||||
fieldset>div.output>div.tabs { display:flex; }
|
fieldset>div.output>div.tabs { display:flex; }
|
||||||
fieldset.input.key>div.output>div.tabs { display:none; }
|
fieldset.input.key>div.output>div.tabs { display:none; }
|
||||||
fieldset>div.output>div.tabs>div.item { padding:5px; line-height:20px; }
|
fieldset>div.output>div.tabs>div.item { padding:5px; line-height:20px; }
|
||||||
fieldset>div.output div.item.card div.title span.role { display:none; }
|
// fieldset>div.output div.item.card div.title span.role { display:none; }
|
||||||
$output { background-color:var(--plugin-bg-color); }
|
$output { background-color:var(--plugin-bg-color); }
|
||||||
$output>div.header { background-image:linear-gradient(var(--notice-bg-color), var(--plugin-bg-color)); height:240px; width:100%; position:absolute; left:0; }
|
$output>div.header { background-image:linear-gradient(var(--notice-bg-color), var(--plugin-bg-color)); height:240px; width:100%; position:absolute; left:0; }
|
||||||
$output>div.header img { height:100%; width:100%; object-fit:cover; }
|
$output>div.header img { height:100%; width:100%; object-fit:cover; }
|
||||||
@ -78,7 +78,9 @@ $output div.item.card div.title div.action input { margin-right:0; }
|
|||||||
$output div.item.card div.action input { padding:0 10px; margin-left:0; margin-right:0; }
|
$output div.item.card div.action input { padding:0 10px; margin-left:0; margin-right:0; }
|
||||||
body.width1 $output div.item.card>div.action { max-width:240px; display:flex; flex-wrap:wrap; justify-content:center; }
|
body.width1 $output div.item.card>div.action { max-width:240px; display:flex; flex-wrap:wrap; justify-content:center; }
|
||||||
$output div.item.card div.status span { word-break:break-all; }
|
$output div.item.card div.status span { word-break:break-all; }
|
||||||
$output div.item.card img { border-radius:5px; padding:0; margin:0; margin-right:10px; height:48px; width:48px; min-width:48px; object-fit:cover; }
|
$output div.item.card div.container div.status img { height:24px; width:24px; min-width:24px; }
|
||||||
|
$output div.item.card img { border-radius:5px; padding:0; margin:0; height:48px; width:48px; min-width:48px; object-fit:cover; }
|
||||||
|
$output div.item.card img:not(:last-child) { margin-right:10px; }
|
||||||
$output div.item.card div.container img { margin-right:0; height:100%; width:100%; }
|
$output div.item.card div.container img { margin-right:0; height:100%; width:100%; }
|
||||||
$output div.item.card div.container>div.action { position:relative; float:right; }
|
$output div.item.card div.container>div.action { position:relative; float:right; }
|
||||||
body:not(.width1) $output div.item.card div.title>div.action { display:none; }
|
body:not(.width1) $output div.item.card div.title>div.action { display:none; }
|
||||||
@ -119,7 +121,10 @@ $output div.tabs { height:32px; display:flex; position:unset; }
|
|||||||
$output div.tabs span { padding:5px 10px; }
|
$output div.tabs span { padding:5px 10px; }
|
||||||
$output div.tabs span.select { background-color:var(--output-bg-color); color:var(--hover-fg-color); }
|
$output div.tabs span.select { background-color:var(--output-bg-color); color:var(--hover-fg-color); }
|
||||||
$output div.item.title { border-left:var(--box-notice3); background-color:var(--plugin-bg-color); padding:10px; margin-left:10px; }
|
$output div.item.title { border-left:var(--box-notice3); background-color:var(--plugin-bg-color); padding:10px; margin-left:10px; }
|
||||||
|
$output div.item.title.noteList { border-left:var(--box-danger3); }
|
||||||
|
$output div.item.title.fileList { border-left:var(--box-danger3); }
|
||||||
$output div.item.title.meetList { border-left:var(--box-danger3); }
|
$output div.item.title.meetList { border-left:var(--box-danger3); }
|
||||||
|
$output div.item.title.dealList { border-left:var(--box-danger3); }
|
||||||
$output div.item.title div.action div.item.notice input { background-color:var(--notice-bg-color); color:var(--notice-fg-color); }
|
$output div.item.title div.action div.item.notice input { background-color:var(--notice-bg-color); color:var(--notice-fg-color); }
|
||||||
$output fieldset.story>div.output { background-color:var(--plugin-bg-color); }
|
$output fieldset.story>div.output { background-color:var(--plugin-bg-color); }
|
||||||
$output fieldset.story>div.output>div.tabs { background-color:var(--plugin-bg-color); display:flex; overflow:auto; position:sticky; top:0; z-index:2; }
|
$output fieldset.story>div.output>div.tabs { background-color:var(--plugin-bg-color); display:flex; overflow:auto; position:sticky; top:0; z-index:2; }
|
||||||
@ -199,6 +204,9 @@ $output fieldset.story>div.output>table.detail tr.created_at { display:none; }
|
|||||||
$output fieldset.story>div.output>table.detail tr.updated_at { display:none; }
|
$output fieldset.story>div.output>table.detail tr.updated_at { display:none; }
|
||||||
$output fieldset.story>div.output>table.detail tr.user_name { display:none; }
|
$output fieldset.story>div.output>table.detail tr.user_name { display:none; }
|
||||||
$output fieldset.story>div.output>table.detail tr.user_avatar { display:none; }
|
$output fieldset.story>div.output>table.detail tr.user_avatar { display:none; }
|
||||||
|
$output fieldset.story>div.output>table.detail tr.to_user_name { display:none; }
|
||||||
|
$output fieldset.story>div.output>table.detail tr.to_user_avatar { display:none; }
|
||||||
|
body:not(.mobile) $action div.item.button input:hover { background-color:var(--hover-bg-color); }
|
||||||
body:not(.mobile) $action div.item.button input:hover { background-color:var(--hover-bg-color); }
|
body:not(.mobile) $action div.item.button input:hover { background-color:var(--hover-bg-color); }
|
||||||
body:not(.mobile) $action div.item.notice input[type=button]:hover { background-color:var(--notice-bg-color); color:var(--notice-fg-color); }
|
body:not(.mobile) $action div.item.notice input[type=button]:hover { background-color:var(--notice-bg-color); color:var(--notice-fg-color); }
|
||||||
body:not(.mobile) $output input.notice[type=button]:hover { background-color:var(--notice-bg-color); color:var(--notice-fg-color); }
|
body:not(.mobile) $output input.notice[type=button]:hover { background-color:var(--notice-bg-color); color:var(--notice-fg-color); }
|
||||||
|
@ -70,6 +70,11 @@ func (s Portal) Command(m *ice.Message, arg ...string) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
func (s Portal) Run(m *ice.Message, arg ...string) {
|
func (s Portal) Run(m *ice.Message, arg ...string) {
|
||||||
|
if m.Option("user.status") == "1" {
|
||||||
|
m.Option("display.style", "output")
|
||||||
|
m.Echo("用户已禁用")
|
||||||
|
return
|
||||||
|
}
|
||||||
if m.Option(model.MESSAGE_UID) != "" {
|
if m.Option(model.MESSAGE_UID) != "" {
|
||||||
msg := m.Cmd(message{}, s.Table.Select, model.UID, m.Option(model.MESSAGE_UID))
|
msg := m.Cmd(message{}, s.Table.Select, model.UID, m.Option(model.MESSAGE_UID))
|
||||||
m.Option(s.Keys(s.Place, model.UID), msg.Append(model.PLACE_UID))
|
m.Option(s.Keys(s.Place, model.UID), msg.Append(model.PLACE_UID))
|
||||||
@ -83,7 +88,12 @@ func (s Portal) Run(m *ice.Message, arg ...string) {
|
|||||||
m.Option(model.SERVICE_UID, ServiceUID(m))
|
m.Option(model.SERVICE_UID, ServiceUID(m))
|
||||||
m.Option(model.COMMAND_UID, CommandUID(m, arg[0]))
|
m.Option(model.COMMAND_UID, CommandUID(m, arg[0]))
|
||||||
m.OptionDefault(model.TO_USER_UID, m.Option(model.USER_UID))
|
m.OptionDefault(model.TO_USER_UID, m.Option(model.USER_UID))
|
||||||
defer m.Optionv(model.TO_USER_UID, []string{})
|
defer func() {
|
||||||
|
if kit.IndexOf(m.Appendv(ice.MSG_APPEND), model.TO_USER_UID) == -1 &&
|
||||||
|
kit.IndexOf(m.Appendv(ice.KEY), model.TO_USER_UID) == -1 {
|
||||||
|
m.Optionv(model.TO_USER_UID, []string{})
|
||||||
|
}
|
||||||
|
}()
|
||||||
m.Option(model.USER_UID, m.Option(ice.MSG_USERUID))
|
m.Option(model.USER_UID, m.Option(ice.MSG_USERUID))
|
||||||
m.Option(model.PLACE_UID, m.Option(s.Keys(s.Place, model.UID)))
|
m.Option(model.PLACE_UID, m.Option(s.Keys(s.Place, model.UID)))
|
||||||
m.Search(arg[0], func(key string, cmd *ice.Command) {
|
m.Search(arg[0], func(key string, cmd *ice.Command) {
|
||||||
@ -100,6 +110,7 @@ func (s Portal) Run(m *ice.Message, arg ...string) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
defer s.SelectJoinUser(m)
|
defer s.SelectJoinUser(m)
|
||||||
|
defer s.SelectJoinToUser(m)
|
||||||
if action, ok := cmd.Actions["beforeAction"]; ok {
|
if action, ok := cmd.Actions["beforeAction"]; ok {
|
||||||
action.Hand(m.Message, arg[1:]...)
|
action.Hand(m.Message, arg[1:]...)
|
||||||
}
|
}
|
||||||
@ -122,11 +133,21 @@ func (s Portal) Run(m *ice.Message, arg ...string) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
if kit.IndexOf(arg, mdb.INPUTS) == -1 {
|
if kit.IndexOf(arg, mdb.INPUTS) == -1 {
|
||||||
|
defer func() {
|
||||||
|
if e := recover(); e != nil {
|
||||||
|
m.Info("what %v", m.FormatsMeta(nil))
|
||||||
|
}
|
||||||
|
}()
|
||||||
s.Place.RewriteAppend(m)
|
s.Place.RewriteAppend(m)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
func (s Portal) List(m *ice.Message, arg ...string) {
|
func (s Portal) List(m *ice.Message, arg ...string) {
|
||||||
|
if m.Option("user.status") == "1" {
|
||||||
|
m.Option("display.style", "output")
|
||||||
|
m.Echo("用户已禁用")
|
||||||
|
return
|
||||||
|
}
|
||||||
m.OptionDefault(model.USER_UID, m.Option(ice.MSG_USERUID))
|
m.OptionDefault(model.USER_UID, m.Option(ice.MSG_USERUID))
|
||||||
if m.Option(mdb.VIEW) == mdb.TABLE || len(arg) > 0 && arg[0] == mdb.TABLE {
|
if m.Option(mdb.VIEW) == mdb.TABLE || len(arg) > 0 && arg[0] == mdb.TABLE {
|
||||||
s.Hash.List(m, kit.Slice(arg, 1)...).PushAction(mdb.DETAIL, s.Hash.Remove).Action().SortInt(mdb.ORDER)
|
s.Hash.List(m, kit.Slice(arg, 1)...).PushAction(mdb.DETAIL, s.Hash.Remove).Action().SortInt(mdb.ORDER)
|
||||||
|
@ -44,6 +44,7 @@ func (s sess) Check(m *ice.Message, arg ...string) {
|
|||||||
m.Option(ice.MSG_AVATAR, msg.Append(model.AVATAR))
|
m.Option(ice.MSG_AVATAR, msg.Append(model.AVATAR))
|
||||||
m.Option(ice.MSG_USERUID, msg.Append(model.UID))
|
m.Option(ice.MSG_USERUID, msg.Append(model.UID))
|
||||||
m.OptionDefault(model.USER_UID, msg.Append(model.UID))
|
m.OptionDefault(model.USER_UID, msg.Append(model.UID))
|
||||||
|
m.Option("user.status", msg.Append(model.STATUS))
|
||||||
}
|
}
|
||||||
func (s sess) Repair(m *ice.Message, arg ...string) {
|
func (s sess) Repair(m *ice.Message, arg ...string) {
|
||||||
m.Cmdy("").Table(func(value ice.Maps) {
|
m.Cmdy("").Table(func(value ice.Maps) {
|
||||||
|
@ -1,9 +1,10 @@
|
|||||||
$output>div.item { border-radius:10px; background-color:var(--output-bg-color); padding:10px; margin:10px; display:flex; align-items:center; }
|
$output>div.item:not(.title) { border-radius:10px; margin:0 10px; }
|
||||||
|
$output>div.item { background-color:var(--output-bg-color); padding:10px; margin:10px; display:flex; align-items:center; }
|
||||||
$output>div.item span.name { flex-grow:1; }
|
$output>div.item span.name { flex-grow:1; }
|
||||||
$output>div.item span.outer { background-color:gray; border-radius:12px; padding:2px; height:24px; width:40px; display:inline-block; float:right; }
|
$output>div.item span.outer { background-color:gray; border-radius:12px; padding:2px; height:24px; width:40px; display:inline-block; float:right; }
|
||||||
$output>div.item span.inner { border-radius:10px; background-color:white; height:20px; width:20px; display:inline-block; }
|
$output>div.item span.inner { border-radius:10px; background-color:white; height:20px; width:20px; display:inline-block; }
|
||||||
$output>div.item span.outer.on { background-color:var(--notice-bg-color); }
|
$output>div.item span.outer.on { background-color:var(--notice-bg-color); }
|
||||||
$output>div.item span.outer.on span.inner { float:right; }
|
$output>div.item span.outer.on span.inner { float:right; }
|
||||||
$output>div.item.story {
|
$output>div.item.story i { width:40px; text-align:center; }
|
||||||
flex-grow:1;
|
$output>div.item.title { margin-left:20px; }
|
||||||
}
|
$output>div.item.input input[type=text] { border:none; border-bottom:var(--box-border); text-align:right; flex-shrink:1; padding:0 20px; max-width:100px; }
|
@ -15,7 +15,7 @@ type setting struct {
|
|||||||
order string `data:"103"`
|
order string `data:"103"`
|
||||||
role string `data:"leader,worker,server"`
|
role string `data:"leader,worker,server"`
|
||||||
short string `data:"name"`
|
short string `data:"name"`
|
||||||
field string `data:"name,type,help,role,order,default"`
|
field string `data:"name,type,help,role,score,default"`
|
||||||
fields string `data:"name,value,user_uid"`
|
fields string `data:"name,value,user_uid"`
|
||||||
create string `name:"create name* type* help"`
|
create string `name:"create name* type* help"`
|
||||||
update string `name:"update" role:"void"`
|
update string `name:"update" role:"void"`
|
||||||
@ -23,8 +23,11 @@ type setting struct {
|
|||||||
|
|
||||||
func (s setting) Init(m *ice.Message, arg ...string) {
|
func (s setting) Init(m *ice.Message, arg ...string) {
|
||||||
s.Table.Init(m, arg...)
|
s.Table.Init(m, arg...)
|
||||||
s.Create(m, model.NAME, SETTING_PROFILE, model.TYPE, SETTING_RADIO, model.ORDER, "1")
|
s.SettingCreate(m, SETTING_APPLY_ENABLE, SETTING_RADIO, "开启权限申请", api.LEADER, "10", "on")
|
||||||
s.Create(m, model.NAME, SETTING_WEIXIN_NOTICE, model.TYPE, SETTING_RADIO, model.HELP, "微信接受系统消息通知", model.ORDER, "2", "default", "on")
|
s.SettingCreate(m, SETTING_ALLOW_AUTO, SETTING_RADIO, "开启权限自动审批", api.LEADER, "11")
|
||||||
|
s.Create(m, model.NAME, "personal", model.TYPE, "title", model.HELP, "个人配置", model.SCORE, "99")
|
||||||
|
s.Create(m, model.NAME, SETTING_PROFILE, model.TYPE, SETTING_RADIO, model.SCORE, "102")
|
||||||
|
s.Create(m, model.NAME, SETTING_WEIXIN_NOTICE, model.TYPE, SETTING_RADIO, model.HELP, "微信接受系统消息通知", model.SCORE, "150", "default", "on")
|
||||||
}
|
}
|
||||||
func (s setting) Create(m *ice.Message, arg ...string) {
|
func (s setting) Create(m *ice.Message, arg ...string) {
|
||||||
s.Hash.Create(m, arg...)
|
s.Hash.Create(m, arg...)
|
||||||
@ -78,25 +81,35 @@ func (s setting) List(m *ice.Message, arg ...string) {
|
|||||||
m.Push(model.NAME, value[model.NAME])
|
m.Push(model.NAME, value[model.NAME])
|
||||||
m.Push(model.TYPE, value[model.TYPE])
|
m.Push(model.TYPE, value[model.TYPE])
|
||||||
m.Push(model.HELP, value[model.HELP])
|
m.Push(model.HELP, value[model.HELP])
|
||||||
m.Push(model.ORDER, value[model.ORDER])
|
m.Push(model.SCORE, value[model.SCORE])
|
||||||
m.Push(model.VALUE, kit.Select(value["default"], data[value[model.NAME]]))
|
m.Push(model.VALUE, kit.Select(value["default"], data[value[model.NAME]]))
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
if msg := m.Cmd(s.Place, s.Select, model.UID, m.Option(model.PLACE_UID)); msg.Append(model.AUTH_UID) != "" {
|
|
||||||
m.Push(model.NAME, "authPortal")
|
|
||||||
m.Push(model.TYPE, SETTING_STORY)
|
|
||||||
m.Push(model.HELP, "进入服务认证的主页")
|
|
||||||
m.Push(model.ORDER, "10")
|
|
||||||
m.Push(model.VALUE, kit.Fields(api.RENZHENGSHOUQUAN_PORTAL, msg.Append(model.AUTH_UID)))
|
|
||||||
}
|
|
||||||
if msg := m.Cmd(user{}, s.Select, model.UID, m.Option(ice.MSG_USERUID)); msg.Append(model.AUTH_UID) != "" {
|
if msg := m.Cmd(user{}, s.Select, model.UID, m.Option(ice.MSG_USERUID)); msg.Append(model.AUTH_UID) != "" {
|
||||||
m.Push(model.NAME, "authPortal")
|
m.Push(model.NAME, "authPortal")
|
||||||
m.Push(model.TYPE, SETTING_STORY)
|
m.Push(model.TYPE, SETTING_STORY)
|
||||||
m.Push(model.HELP, "进入个人认证的主页")
|
m.Push(model.HELP, "进入个人认证的主页")
|
||||||
m.Push(model.ORDER, "11")
|
m.Push(model.SCORE, "101")
|
||||||
m.Push(model.VALUE, kit.Fields(api.RENZHENGSHOUQUAN_PORTAL, msg.Append(model.AUTH_UID)))
|
m.Push(model.VALUE, kit.Fields(api.RENZHENGSHOUQUAN_PORTAL, msg.Append(model.AUTH_UID)))
|
||||||
}
|
}
|
||||||
m.Action().SortInt(model.ORDER)
|
if msg := m.Cmd(s.Place, s.Select, model.UID, m.Option(model.PLACE_UID)); msg.Append(model.AUTH_UID) != "" {
|
||||||
|
m.Push(model.NAME, "authPortal")
|
||||||
|
m.Push(model.TYPE, SETTING_STORY)
|
||||||
|
m.Push(model.HELP, "进入服务认证的主页")
|
||||||
|
m.Push(model.SCORE, "11")
|
||||||
|
m.Push(model.VALUE, kit.Fields(api.RENZHENGSHOUQUAN_PORTAL, msg.Append(model.AUTH_UID)))
|
||||||
|
if msg.Append(model.COMPANY_UID) != "" {
|
||||||
|
if msg := m.Cmd(s.Street, s.Select, model.UID, msg.Append(model.COMPANY_UID)); msg.Append(model.AUTH_UID) != "" {
|
||||||
|
m.Push(model.NAME, "authCompany")
|
||||||
|
m.Push(model.TYPE, SETTING_STORY)
|
||||||
|
m.Push(model.HELP, "进入公司认证的主页")
|
||||||
|
m.Push(model.SCORE, "12")
|
||||||
|
m.Push(model.VALUE, kit.Fields(api.RENZHENGSHOUQUAN_PORTAL, msg.Append(model.AUTH_UID)))
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
m.Action().SortInt(model.SCORE)
|
||||||
} else if len(arg) == 2 {
|
} else if len(arg) == 2 {
|
||||||
s.SelectDetail(m, model.PLACE_UID, arg[0], model.USER_UID, m.Option(model.USER_UID), model.NAME, arg[1])
|
s.SelectDetail(m, model.PLACE_UID, arg[0], model.USER_UID, m.Option(model.USER_UID), model.NAME, arg[1])
|
||||||
}
|
}
|
||||||
@ -110,7 +123,8 @@ func (s Table) SettingCreate(m *ice.Message, arg ...string) {
|
|||||||
model.TYPE, kit.Select(SETTING_RADIO, arg, 1),
|
model.TYPE, kit.Select(SETTING_RADIO, arg, 1),
|
||||||
model.HELP, kit.Select("", arg, 2),
|
model.HELP, kit.Select("", arg, 2),
|
||||||
model.ROLE, kit.Select("", arg, 3),
|
model.ROLE, kit.Select("", arg, 3),
|
||||||
model.ORDER, kit.Select("1000", arg, 4),
|
model.SCORE, kit.Select("1000", arg, 4),
|
||||||
|
"default", kit.Select("", arg, 5),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
func (s Table) SettingSelect(m *ice.Message, arg ...string) {
|
func (s Table) SettingSelect(m *ice.Message, arg ...string) {
|
||||||
@ -131,6 +145,8 @@ func (s Table) SettingIsOn(m *ice.Message, key string) bool {
|
|||||||
const (
|
const (
|
||||||
SETTING_PROFILE = "profile"
|
SETTING_PROFILE = "profile"
|
||||||
SETTING_WEIXIN_NOTICE = "setting_weixin_notice"
|
SETTING_WEIXIN_NOTICE = "setting_weixin_notice"
|
||||||
|
SETTING_APPLY_ENABLE = "setting_apply_enable"
|
||||||
|
SETTING_ALLOW_AUTO = "setting_allow_auto"
|
||||||
SETTING_RADIO = "radio"
|
SETTING_RADIO = "radio"
|
||||||
SETTING_STORY = "story"
|
SETTING_STORY = "story"
|
||||||
)
|
)
|
||||||
|
@ -1,13 +1,16 @@
|
|||||||
Volcanos(chat.ONIMPORT, {
|
Volcanos(chat.ONIMPORT, {
|
||||||
_init: function(can, msg) {
|
_init: function(can, msg) {
|
||||||
can.page.Append(can, can._output, msg.Table(function(value) {
|
can.page.Append(can, can._output, msg.Table(function(value) {
|
||||||
|
if (value.type == "title") {
|
||||||
|
return {view: [[html.ITEM, html.TITLE], "", can.user.trans(can, value.name, value.help)]}
|
||||||
|
}
|
||||||
return {view: [[html.ITEM, value.type, value.name]], list: [{text: [value.help||can.user.trans(can, value.name, null, "value.setting"), "", mdb.NAME]}, can.onimport[value.type](can, value)]}
|
return {view: [[html.ITEM, value.type, value.name]], list: [{text: [value.help||can.user.trans(can, value.name, null, "value.setting"), "", mdb.NAME]}, can.onimport[value.type](can, value)]}
|
||||||
}))
|
}))
|
||||||
if (!can.misc.isDebug(can)) { return }
|
if (!can.misc.isDebug(can)) { return }
|
||||||
sessionStorage.length && can.onimport._plugin(can, {index: "can.sessionStorage"})
|
|
||||||
localStorage.length && can.onimport._plugin(can, {index: "can.localStorage"})
|
|
||||||
can.user.isTechOrRoot(can) && can.onimport._plugin(can, {index: "can.cookie"})
|
can.user.isTechOrRoot(can) && can.onimport._plugin(can, {index: "can.cookie"})
|
||||||
can.onimport._plugin(can, {index: "can.runtime"})
|
localStorage.length && can.onimport._plugin(can, {index: "can.localStorage"})
|
||||||
|
sessionStorage.length && can.onimport._plugin(can, {index: "can.sessionStorage"})
|
||||||
|
// can.onimport._plugin(can, {index: "can.runtime"})
|
||||||
},
|
},
|
||||||
_plugin: function(can, value) { value.width = can.ConfWidth()-20
|
_plugin: function(can, value) { value.width = can.ConfWidth()-20
|
||||||
can.onappend.plugin(can, value, function(sub) {
|
can.onappend.plugin(can, value, function(sub) {
|
||||||
@ -16,12 +19,22 @@ Volcanos(chat.ONIMPORT, {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
title: function(can, value) {
|
||||||
|
return {text: [value.name, "", value.type]}
|
||||||
|
},
|
||||||
radio: function(can, value) {
|
radio: function(can, value) {
|
||||||
return {text: ["", "", ["outer", value.value]], list: [{text: ["", "", "inner"]}], onclick: function(event) {
|
return {text: ["", "", ["outer", value.value]], list: [{text: ["", "", "inner"]}], onclick: function(event) {
|
||||||
if (value.value == "on") { value.value = "off" } else { value.value = "on" }
|
if (value.value == "on") { value.value = "off" } else { value.value = "on" }
|
||||||
can.runAction(can.request(event, value, can.Option(), {_toast: value.name}), mdb.UPDATE, [])
|
can.runAction(can.request(event, value, can.Option(), {_toast: value.name}), mdb.UPDATE, [])
|
||||||
}}
|
}}
|
||||||
},
|
},
|
||||||
|
input: function(can, value) {
|
||||||
|
return {type: "input", data: {type: "text", value: value.value}, onkeyup: function(event) {
|
||||||
|
if (event.key == code.ENTER) {
|
||||||
|
can.runAction(can.request(event, {value: event.target.value}, value, can.Option(), {_toast: value.name}), mdb.UPDATE, [])
|
||||||
|
}
|
||||||
|
}}
|
||||||
|
},
|
||||||
story: function(can, value) {
|
story: function(can, value) {
|
||||||
return {text: ["", "i", "bi bi-chevron-double-right"], _init: function(target) {
|
return {text: ["", "i", "bi bi-chevron-double-right"], _init: function(target) {
|
||||||
target.parentNode.onclick = function() {
|
target.parentNode.onclick = function() {
|
||||||
|
@ -21,7 +21,7 @@ type user struct {
|
|||||||
order string `data:"509"`
|
order string `data:"509"`
|
||||||
role string `data:"tech"`
|
role string `data:"tech"`
|
||||||
template string `data:"zJjgEbfiVKgJ_eDLfvHB_lXEzitNuxwZk0UHeTsFRns"`
|
template string `data:"zJjgEbfiVKgJ_eDLfvHB_lXEzitNuxwZk0UHeTsFRns"`
|
||||||
fields string `data:"auth_uid,open_id,language,name,info,avatar,background"`
|
fields string `data:"auth_uid,open_id,language,name,info,avatar,background,status"`
|
||||||
create string `name:"create open_id* avatar usernick"`
|
create string `name:"create open_id* avatar usernick"`
|
||||||
modify string `name:"modify info" role:"void"`
|
modify string `name:"modify info" role:"void"`
|
||||||
list string `name:"list uid auto" role:"void"`
|
list string `name:"list uid auto" role:"void"`
|
||||||
@ -50,7 +50,7 @@ func (s user) Remove(m *ice.Message, arg ...string) {
|
|||||||
}
|
}
|
||||||
func (s user) List(m *ice.Message, arg ...string) {
|
func (s user) List(m *ice.Message, arg ...string) {
|
||||||
s.Tables(m, "LEFT JOIN sesses ON users.uid = sesses.user_uid").Groups(m, "user_uid").Orders(m, s.Desc("sesses.created_at"))
|
s.Tables(m, "LEFT JOIN sesses ON users.uid = sesses.user_uid").Groups(m, "user_uid").Orders(m, s.Desc("sesses.created_at"))
|
||||||
s.FieldsWithCreatedAT(m, s, kit.Split("auth_uid,name,info,avatar,background,agent,system,location,ip,ua")).Limit(m, 3000)
|
s.FieldsWithCreatedAT(m, s, kit.Split("auth_uid,name,info,avatar,background,status,agent,system,location,ip,ua")).Limit(m, 3000)
|
||||||
if len(arg) == 0 {
|
if len(arg) == 0 {
|
||||||
if m.IsTech() {
|
if m.IsTech() {
|
||||||
s.Limit(m, 3000)
|
s.Limit(m, 3000)
|
||||||
@ -75,6 +75,13 @@ func (s user) List(m *ice.Message, arg ...string) {
|
|||||||
if m.IsTech() && value[model.UID] != m.Option(ice.MSG_USERUID) {
|
if m.IsTech() && value[model.UID] != m.Option(ice.MSG_USERUID) {
|
||||||
button = append(button, s.SetCookie, s.Remove)
|
button = append(button, s.SetCookie, s.Remove)
|
||||||
}
|
}
|
||||||
|
if m.IsTech() {
|
||||||
|
if value[model.STATUS] == "1" {
|
||||||
|
button = append(button, s.Enable)
|
||||||
|
} else {
|
||||||
|
button = append(button, s.Disable)
|
||||||
|
}
|
||||||
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
func (s user) SelectTotal(m *ice.Message, arg ...string) string {
|
func (s user) SelectTotal(m *ice.Message, arg ...string) string {
|
||||||
@ -103,6 +110,12 @@ func (s user) AuthRemove(m *ice.Message, arg ...string) {
|
|||||||
m.Cmd(api.RENZHENGSHOUQUAN_CLEAN, "prune", msg.Option(model.AUTH_UID))
|
m.Cmd(api.RENZHENGSHOUQUAN_CLEAN, "prune", msg.Option(model.AUTH_UID))
|
||||||
s.Update(m, ice.Maps{model.AUTH_UID: ""}, m.OptionSimple(model.UID)...)
|
s.Update(m, ice.Maps{model.AUTH_UID: ""}, m.OptionSimple(model.UID)...)
|
||||||
}
|
}
|
||||||
|
func (s user) Disable(m *ice.Message, arg ...string) {
|
||||||
|
s.Update(m, kit.Dict(model.STATUS, UserDisabled), m.OptionSimple(model.UID)...)
|
||||||
|
}
|
||||||
|
func (s user) Enable(m *ice.Message, arg ...string) {
|
||||||
|
s.Update(m, kit.Dict(model.STATUS, "0"), m.OptionSimple(model.UID)...)
|
||||||
|
}
|
||||||
func (s user) SetCookie(m *ice.Message, arg ...string) {
|
func (s user) SetCookie(m *ice.Message, arg ...string) {
|
||||||
m.ProcessCookie(ice.MSG_USERUID, m.Option(model.UID))
|
m.ProcessCookie(ice.MSG_USERUID, m.Option(model.UID))
|
||||||
}
|
}
|
||||||
@ -126,3 +139,10 @@ func (s user) Email(m *ice.Message, arg ...string) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func init() { ice.TeamCtxCmd(user{}) }
|
func init() { ice.TeamCtxCmd(user{}) }
|
||||||
|
|
||||||
|
type UserStatus int
|
||||||
|
|
||||||
|
const (
|
||||||
|
UserEnabled UserStatus = iota
|
||||||
|
UserDisabled
|
||||||
|
)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user