This commit is contained in:
IT 老营长 @云轩领航-创始人 2025-02-03 22:15:49 +08:00
parent a2b51f8ea0
commit f9138c8588

View File

@ -42,15 +42,10 @@ func (s user) Modify(m *ice.Message, arg ...string) {
func (s user) Remove(m *ice.Message, arg ...string) { func (s user) Remove(m *ice.Message, arg ...string) {
s.Delete(m, m.OptionSimple(model.UID)...) s.Delete(m, m.OptionSimple(model.UID)...)
} }
func (s user) SelectTotal(m *ice.Message, arg ...string) string {
msg := m.Spawn()
s.Fields(msg, "count(*) AS total")
return s.Select(msg, arg...).Append("total")
}
func (s user) List(m *ice.Message, arg ...string) { func (s user) List(m *ice.Message, arg ...string) {
if len(arg) == 0 { if len(arg) == 0 {
if m.IsTech() { if m.IsTech() {
s.Limit(m, 100) s.Limit(m, 300)
s.Select(m, arg...).Table(func(value ice.Maps) { s.Select(m, arg...).Table(func(value ice.Maps) {
if value[model.UID] != m.Option(model.USER_UID) { if value[model.UID] != m.Option(model.USER_UID) {
m.PushButton(s.SetCookie) m.PushButton(s.SetCookie)
@ -68,17 +63,18 @@ func (s user) List(m *ice.Message, arg ...string) {
} }
} }
} }
func (s user) SelectTotal(m *ice.Message, arg ...string) string {
msg := m.Spawn()
s.Fields(msg, "count(*) AS total")
return s.Select(msg, arg...).Append("total")
}
func (s user) Email(m *ice.Message, arg ...string) {
s.Table.Update(m, kit.Dict(m.OptionSimple(model.EMAIL)))
}
func (s user) AuthCreate(m *ice.Message, arg ...string) { func (s user) AuthCreate(m *ice.Message, arg ...string) {
m.Options(s.Select(m.Spawn(), model.UID, m.Option(model.USER_UID)).AppendSimple(model.NAME, model.INFO)) m.Options(s.Select(m.Spawn(), model.UID, m.Option(model.USER_UID)).AppendSimple(model.NAME, model.INFO))
s.Table.AuthCreate(m, 2, m.Option(model.AUTH_UID)) s.Table.AuthCreate(m, 2, m.Option(model.AUTH_UID))
} }
func (s user) SendTemplate(m *ice.Message, arg ...string) { // from uid url type name hash
msg := s.Select(m, model.UID, kit.Select(m.Option(model.USER_UID), arg, 1))
m.Cmdy("web.chat.wx.template", "", m.Config(nfs.TEMPLATE), msg.Append(model.OPEN_ID), kit.Select("", arg, 2),
"thing7", kit.Select("", arg, 3), "thing12", kit.Select("", arg, 4), "character_string2", kit.Cut(kit.Select("", arg, 5), 6),
"time11", time.Now().Format("2006年01月02日 15:04"), "thing18", kit.Select(kit.Select(m.Option(ice.MSG_USERNAME), m.Option(ice.MSG_USERNICK)), arg, 0),
)
}
func (s user) SendCookie(m *ice.Message, arg ...string) { func (s user) SendCookie(m *ice.Message, arg ...string) {
if m.Option(ice.MSG_METHOD) == http.MethodGet { if m.Option(ice.MSG_METHOD) == http.MethodGet {
m.EchoInfoButton("请确认授权", s.SendCookie) m.EchoInfoButton("请确认授权", s.SendCookie)
@ -89,8 +85,12 @@ func (s user) SendCookie(m *ice.Message, arg ...string) {
func (s user) SetCookie(m *ice.Message, arg ...string) { func (s user) SetCookie(m *ice.Message, arg ...string) {
m.ProcessCookie(model.USER_UID, m.Option(model.UID)) m.ProcessCookie(model.USER_UID, m.Option(model.UID))
} }
func (s user) Email(m *ice.Message, arg ...string) { func (s user) SendTemplate(m *ice.Message, arg ...string) { // from uid url type name hash
s.Table.Update(m, kit.Dict(m.OptionSimple(model.EMAIL))) msg := s.Select(m, model.UID, kit.Select(m.Option(model.USER_UID), arg, 1))
m.Cmdy("web.chat.wx.template", "", m.Config(nfs.TEMPLATE), msg.Append(model.OPEN_ID), kit.Select("", arg, 2),
"thing7", kit.Select("", arg, 3), "thing12", kit.Select("", arg, 4), "character_string2", kit.Cut(kit.Select("", arg, 5), 6),
"time11", time.Now().Format("2006年01月02日 15:04"), "thing18", kit.Select(kit.Select(m.Option(ice.MSG_USERNAME), m.Option(ice.MSG_USERNICK)), arg, 0),
)
} }
func init() { ice.TeamCtxCmd(user{}) } func init() { ice.TeamCtxCmd(user{}) }