This commit is contained in:
IT 老营长 @云轩领航-创始人 2025-06-10 17:03:31 +08:00
parent 9984f8abab
commit bfaea581a0
3 changed files with 11 additions and 7 deletions

View File

@ -20,9 +20,11 @@ type allow struct {
func (s allow) Create(m *ice.Message, arg ...string) {
s.Insert(m.Spawn(), arg...)
s.SendMessage(s.GetCommandUID(m), m.Option(model.FROM_USER_UID), "")
m.Info("what %v", m.FormatChain())
s.SendTemplate(m, "", "", m.Trans("please allow", "权限审批 请处理"))
}
func (s allow) Remove(m *ice.Message, arg ...string) {
s.Delete(m, m.OptionSimple(model.UID, model.PLACE_UID)...)
}
func (s allow) List(m *ice.Message, arg ...string) {
s.Tables(m, s.apply).FieldsWithCreatedAT(m, s.apply,
s.Key(s.apply, model.USER_UID),
@ -30,14 +32,12 @@ func (s allow) List(m *ice.Message, arg ...string) {
s.AS(s.Key(s, model.UID), model.ALLOW_UID), model.ALLOW_STATUS,
)
if len(arg) == 1 {
// s.Select(m, s.Key(s, model.PLACE_UID), arg[0], s.Key(s, model.USER_UID), m.Option(model.USER_UID)).Action()
s.Select(m, s.Key(s, model.PLACE_UID), arg[0]).Action()
if m.Length() == 0 {
m.Cmdy(s.Prefix(m, qrcode{}), qrcode{}.ApplyQRCode, arg[0]).SetAppend().Action()
return
}
} else if len(arg) == 2 {
// s.SelectDetail(m, s.Key(s, model.PLACE_UID), arg[0], s.Key(s, model.USER_UID), m.Option(model.USER_UID), s.Key(s.apply, model.UID), arg[1])
s.SelectDetail(m, s.Key(s, model.PLACE_UID), arg[0], s.Key(s.apply, model.UID), arg[1])
m.Table(func(value ice.Maps) {
if AllowStatus(kit.Int(value[model.ALLOW_STATUS])) != AllowCreate {
@ -49,7 +49,7 @@ func (s allow) List(m *ice.Message, arg ...string) {
}
m.Table(func(value ice.Maps) {
if AllowStatus(kit.Int(value[model.ALLOW_STATUS])) == AllowCreate {
m.PushButton(s.Reject, s.Approve)
m.PushButton(s.Reject, s.Approve, s.Remove)
} else {
m.PushButton()
}

View File

@ -87,7 +87,10 @@ func (s apply) Submit(m *ice.Message, arg ...string) {
return
}
m.Option(model.FROM_USER_UID, m.Option(model.USER_UID))
m.Option(model.TO_USER_UID, msg.Append(model.USER_UID))
m.Cmd(s.Prefix(m, allow{}), s.Create, model.APPLY_UID, m.Option(model.UID), m.OptionSimple(model.PLACE_UID), msg.AppendSimple(model.USER_UID), model.STATUS, AllowCreate)
msg.Table(func(value ice.Maps) {
return
m.Option(model.TO_USER_UID, value[model.USER_UID])
m.Cmd(s.Prefix(m, allow{}), s.Create, model.APPLY_UID, m.Option(model.UID), model.PLACE_UID, m.Option(s.Keys(s.Place, model.UID)),
model.USER_UID, value[model.USER_UID], model.STATUS, AllowCreate)

View File

@ -198,6 +198,7 @@ func (s Portal) Link(m *ice.Message, arg ...string) *ice.Message {
}
func (s Portal) PlaceCreate(m *ice.Message, arg ...string) {
m.OptionDefault(model.USER_UID, m.Option(ice.MSG_USERUID))
if s.city.FindOrCreateByName(m, arg...); m.IsErr() {
return
} else if s.Street.FindOrCreateByName(m, arg...); m.IsErr() {
@ -361,13 +362,13 @@ func (s Portal) UserPlaceRole(m *ice.Message, arg ...string) *ice.Message {
}
func (s Portal) ValueCreate(m *ice.Message, arg ...string) {
s.Table.Insert(m, kit.Simple(arg, m.OptionSimple(s.Keys(s.Place, model.UID), model.USER_UID))...)
s.Table.Insert(m, kit.Simple(arg, m.OptionSimple(model.USER_UID, s.Keys(s.Place, model.UID)))...)
}
func (s Portal) ValueRemove(m *ice.Message, arg ...string) {
s.Table.Delete(m, m.OptionSimple(s.Keys(s.Place, model.UID), model.UID)...)
s.Table.Delete(m, m.OptionSimple(model.UID, s.Keys(s.Place, model.UID))...)
}
func (s Portal) ValueModify(m *ice.Message, arg ...string) {
s.Table.Update(m, kit.Dict(arg), m.OptionSimple(model.UID, s.Keys(s.Place, model.UID))...)
s.Table.Update(m, arg, m.OptionSimple(model.UID, s.Keys(s.Place, model.UID))...)
}
func (s Portal) ValueList(m *ice.Message, arg ...string) {
PLACE_UID := s.Keys(s.Place, model.UID)