mirror of
https://shylinux.com/x/community
synced 2025-05-03 20:57:01 +08:00
119 lines
3.6 KiB
Go
119 lines
3.6 KiB
Go
package renzhengshouquan
|
|
|
|
import (
|
|
"shylinux.com/x/ice"
|
|
"shylinux.com/x/icebergs/base/mdb"
|
|
kit "shylinux.com/x/toolkits"
|
|
|
|
"shylinux.com/x/community/src/renzhengshouquan/model"
|
|
)
|
|
|
|
type profile struct {
|
|
Auth
|
|
order string `data:"3"`
|
|
modify string `name:"modify info" role:"leader,worker"`
|
|
upload string `name:"upload" role:"leader,worker"`
|
|
authList string `name:"authList" role:"void"`
|
|
memberList string `name:"memberList" role:"void"`
|
|
serviceList string `name:"serviceList" role:"void"`
|
|
fromList string `name:"fromList" role:"void"`
|
|
authPersonal string `name:"authPersonal" role:"void"`
|
|
}
|
|
|
|
func (s profile) Modify(m *ice.Message, arg ...string) {
|
|
s.Update(m, m.OptionSimple(model.INFO), model.UID, m.Option(model.AUTH_UID))
|
|
}
|
|
func (s profile) Upload(m *ice.Message, arg ...string) {
|
|
if !m.WarnNotValid(!kit.IsIn(m.OptionDefault(mdb.FIELD, model.AVATAR), model.AVATAR, model.BACKGROUND)) {
|
|
s.UploadUpdate(m, "", m.Option(model.AUTH_UID))
|
|
}
|
|
}
|
|
func (s profile) List(m *ice.Message, arg ...string) {
|
|
if len(arg) == 0 {
|
|
s.Select(m).PushAction(s.Remove)
|
|
return
|
|
}
|
|
s.Select(m, model.UID, arg[0]).Action()
|
|
name := m.Append(model.NAME)
|
|
switch AuthType(kit.Int(m.Append(model.AUTH_TYPE))) {
|
|
case AuthService:
|
|
name = kit.JoinWord(m.Append(model.CITY_NAME), m.Append(model.STREET_NAME), m.Append(model.PLACE_NAME))
|
|
kit.If(s.IsWorker(m), func() { m.PushAction(s.Modify, s.Enter) }, func() { m.PushAction() })
|
|
s.SelectJoinRecent(m, "")
|
|
s.SelectJoinService(m)
|
|
case AuthCompany:
|
|
kit.If(s.IsWorker(m), func() { m.PushAction(s.Modify, s.Enter) }, func() { m.PushAction() })
|
|
case AuthPersonal:
|
|
s.SelectJoinUser(m)
|
|
case AuthCity:
|
|
}
|
|
m.EchoQRCode(s.Link(m, arg[0], m.PrefixKey())).Echo(name)
|
|
m.Display("").DisplayCSS("")
|
|
s.RewriteAppend(m)
|
|
}
|
|
func (s profile) AuthList(m *ice.Message, arg ...string) {
|
|
m.Cmdy(s.Auth, arg[0]).Table(func(value ice.Maps) {
|
|
if value[model.PLACE_UID] == "" {
|
|
m.PushButton()
|
|
} else {
|
|
m.PushButton(s.Enter)
|
|
}
|
|
})
|
|
s.SelectJoinRecent(m, "")
|
|
s.SelectJoinService(m)
|
|
s.authSort(m)
|
|
}
|
|
func (s profile) MemberList(m *ice.Message, arg ...string) {
|
|
user_uid := m.Option(model.USER_UID)
|
|
s.Fields(m, model.USER_UID)
|
|
s.settingProfile(m, model.PLACE_UID, arg[0])
|
|
if m.Length() == 0 {
|
|
return
|
|
}
|
|
s.SelectJoinUser(m, model.NAME, model.INFO, model.AVATAR, model.BACKGROUND, model.AUTH_UID)
|
|
s.SelectJoinAuth(m)
|
|
m.Table(func(value ice.Maps) {
|
|
if value[model.AUTH_STATUS] == "" && value[model.USER_UID] == user_uid {
|
|
m.PushButton(s.AuthPersonal)
|
|
} else {
|
|
m.PushButton()
|
|
}
|
|
})
|
|
s.RewriteAppend(m)
|
|
}
|
|
func (s profile) ServiceList(m *ice.Message, arg ...string) {
|
|
msg := m.Spawn()
|
|
s.Fields(msg, model.PLACE_UID)
|
|
list := s.settingProfile(msg, model.USER_UID, arg[0]).Appendv(model.PLACE_UID)
|
|
if m.WarnNotFound(len(list) == 0, model.USER_UID, arg[0]) {
|
|
return
|
|
}
|
|
s.FieldsWithCreatedAT(m, s.Auth, kit.TransArgs(kit.Split(m.Config(mdb.FIELDS), ",", ","))...)
|
|
s.SelectList(m, kit.Simple(model.PLACE_UID, kit.Sort(list))...)
|
|
s.SelectJoinRecent(m, "")
|
|
s.SelectJoinService(m)
|
|
s.authSort(m)
|
|
m.PushAction(s.Enter)
|
|
}
|
|
func (s profile) FromList(m *ice.Message, arg ...string) {
|
|
from := arg[0]
|
|
for {
|
|
msg := s.Select(m.Spawn(), model.UID, from)
|
|
if m.Copy(msg); msg.Append(model.FROM_UID) != "" {
|
|
from = msg.Append(model.FROM_UID)
|
|
} else {
|
|
break
|
|
}
|
|
}
|
|
}
|
|
func (s profile) AuthPersonal(m *ice.Message, arg ...string) {
|
|
s.CreditCmdy(m, m.ActionKey(), arg)
|
|
}
|
|
func (s profile) Enter(m *ice.Message, arg ...string) {}
|
|
|
|
func init() { ice.TeamCtxCmd(profile{}) }
|
|
|
|
func (s profile) settingProfile(m *ice.Message, arg ...string) *ice.Message {
|
|
return s.SettingCmdy(m, s.Select, arg, model.NAME, "profile", model.VALUE, "on")
|
|
}
|