diff --git a/src/gonganxitong/allow.go b/src/gonganxitong/allow.go index 55e0f73..077d871 100644 --- a/src/gonganxitong/allow.go +++ b/src/gonganxitong/allow.go @@ -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() } diff --git a/src/gonganxitong/apply.go b/src/gonganxitong/apply.go index 973a8c7..1db14f8 100644 --- a/src/gonganxitong/apply.go +++ b/src/gonganxitong/apply.go @@ -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) diff --git a/src/gonganxitong/portal.go b/src/gonganxitong/portal.go index ab451c0..7a90caa 100644 --- a/src/gonganxitong/portal.go +++ b/src/gonganxitong/portal.go @@ -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)