This commit is contained in:
IT 老营长 @云轩领航-创始人 2024-07-31 22:20:56 +08:00
parent 8292672921
commit 4504cd4ba6
20 changed files with 478 additions and 201 deletions

View File

@ -0,0 +1,2 @@
$output>div.item.card.cancel div.title span { border:none; color:gray; text-decoration:line-through; }
$output>div.item.card.rejected div.title span.status { border:var(--box-danger); color:var(--danger-bg-color); }

View File

@ -7,43 +7,32 @@ import (
"shylinux.com/x/community/src/gonganxitong/model"
)
type ApplyStatus int
const (
ApplyCreate ApplyStatus = iota
)
var ApplyStatusList = map[ApplyStatus]string{
ApplyCreate: "create",
}
func (s ApplyStatus) String() string {
return ApplyStatusList[s]
}
type apply struct {
Table
user user
userPlace userPlace
place place
street street
create string `name:"create place_uid* user_place_role* begin_time@date end_time@date"`
event event
portal string `data:"true"`
list string `name:"list place_uid uid auto"`
create string `name:"create place_uid*:select user_place_role*:select begin_time:select@date end_time:select@date" role:"void"`
cancel string `name:"cancel" role:"void"`
submit string `name:"submit" role:"void"`
list string `name:"list place_uid uid auto" role:"void"`
}
func (s apply) Inputs(m *ice.Message, arg ...string) {
switch arg[0] {
case model.PLACE_UID:
m.Cmdy(s.userPlace, s.userPlace.MyPlace, s.user.UserUID(m))
m.Cut(model.PLACE_UID, model.PLACE_NAME).RenameAppend(model.PLACE_NAME, model.NAME)
m.DisplayInputKeyNameIconTitle()
m.Cmdy(s.userPlace, m.Option(model.USER_UID))
m.Cut(model.PLACE_UID, model.PLACE_NAME).DisplayInputKeyNameIconTitle()
case model.USER_PLACE_ROLE:
for k, v := range UserPlaceRoleList {
m.Push(arg[0], k).Push(model.NAME, v)
if k != UserPlaceCreator && k != UserPlaceVisitor {
m.Push(arg[0], k).Push(model.NAME, v)
}
}
m.SortInt(arg[0])
m.DisplayInputKeyNameIconTitle()
m.SortInt(arg[0]).DisplayInputKeyNameIconTitle()
default:
s.Table.Inputs(m, arg...)
}
@ -51,39 +40,104 @@ func (s apply) Inputs(m *ice.Message, arg ...string) {
func (s apply) Create(m *ice.Message, arg ...string) {
arg = kit.TransArgKeys(arg, model.USER_PLACE_ROLE, model.ROLE)
arg = kit.TransArgValueTime(arg, model.BEGIN_TIME, model.END_TIME)
s.Table.Create(m, kit.Simple(arg, model.STATUS, ApplyCreate, model.USER_UID, s.user.UserUID(m))...)
s.Table.Create(m, kit.Simple(arg, m.OptionSimple(model.USER_UID), model.STATUS, ApplyCreate)...)
}
func (s apply) Cancel(m *ice.Message, arg ...string) {
msg := s.status(m, ApplyCreate, ApplyCancel)
s.SendTemplate(m, msg.Append(model.USER_UID), "场所权限申请 已取消")
}
func (s apply) Submit(m *ice.Message, arg ...string) {
defer s.event.Record(m, m.Option(model.UID))
defer m.ToastProcess()()
role := UserPlaceCreator
switch UserPlaceRole(kit.Int(s.status(m, ApplyCreate, ApplySubmit).Append(model.ROLE))) {
case UserPlaceLandlord:
role = UserPlaceCreator
case UserPlaceTenant, UserPlaceAdmin:
role = UserPlaceLandlord
}
msg := m.Cmd(s.userPlace, s.userPlace.Select, m.OptionSimple(model.PLACE_UID), model.ROLE, role.String())
m.Cmd(order{}, order{}.Create, msg.AppendSimple(model.USER_UID), model.APPLY_UID, m.Option(model.UID), model.STATUS, OrderCreate)
s.SendTemplate(m, m.Option(model.USER_UID), "场所权限申请 已提交 🕑")
}
func (s apply) List(m *ice.Message, arg ...string) {
s.Tables(m, s.place, s.street).Fields(m, "applies.created_at",
model.PLACE_NAME, model.PLACE_TYPE, "applies.role AS user_place_role", model.APPLY_STATUS,
model.STREET_NAME, model.PLACE_ADDRESS, "applies.uid", model.PLACE_UID, model.STREET_UID,
model.BEGIN_TIME, model.END_TIME,
).Orders(m, "created_at DESC")
if len(arg) == 0 {
s.Table.List(m, arg...)
if m.IsTech() {
s.Table.Select(m)
} else {
s.Table.Select(m, m.OptionSimple(model.USER_UID)...)
}
} else if len(arg) == 1 {
userUID := s.user.UserUID(m)
s.Tables(m, s.place, s.street).Fields(m,
"applies.uid", "begin_time", "end_time",
"applies.status AS apply_status",
model.PLACE_NAME, model.TYPE, "role AS user_place_role",
model.STREET_NAME, "places.address as place_address", model.PLACE_UID, model.STREET_UID)
s.Table.Select(m, model.USER_UID, userUID, model.PLACE_UID, arg[0]).Action(s.Create)
if s.Table.Select(m, model.USER_UID, m.Option(model.USER_UID), model.PLACE_UID, arg[0]).Action(s.Create); m.Length() == 0 {
m.EchoInfoButton(m.Trans("please create apply", "请创建权限申请"), s.Create)
return
}
defer m.Sort("apply_status,created_at", []string{
ApplyCreate.String(),
ApplySubmit.String(),
ApplyApproved.String(),
ApplyRejected.String(),
ApplyCancel.String(),
}, ice.STR_R)
} else {
s.Table.Select(m.FieldsSetDetail(), model.UID, arg[1])
m.RenameAppend(model.ROLE, model.USER_PLACE_ROLE)
s.Table.Select(m.FieldsSetDetail(), "applies.uid", arg[1])
if ApplyStatus(kit.Int(m.Append(model.APPLY_STATUS))) == ApplySubmit {
m.EchoQRCode(cmdurl(m, arg[0], m.Prefix("order"), arg[1]))
}
}
m.Table(func(value ice.Maps) {
switch ApplyStatus(kit.Int(value[model.APPLY_STATUS])) {
case ApplyCreate:
m.PushButton(s.Cancel)
m.PushButton(s.Cancel, s.Submit)
default:
m.PushButton()
}
})
m.RewriteAppend(func(value, key string, index int) string {
kit.If(key == model.APPLY_STATUS, func() { value = ApplyStatus(kit.Int(value)).String() })
kit.If(key == model.USER_PLACE_ROLE, func() { value = UserPlaceRole(kit.Int(value)).String() })
return value
})
m.Display("")
s.RewriteAppend(m).Display("").DisplayCSS("")
}
func init() { ice.Cmd(prefixKey(), apply{}) }
func (s apply) Reject(m *ice.Message, arg ...string) {
msg := s.status(m, ApplySubmit, ApplyRejected)
s.SendTemplate(m, msg.Append(model.USER_UID), "场所权限申请 已驳回 ❌")
}
func (s apply) Approve(m *ice.Message, arg ...string) {
msg := s.status(m, ApplySubmit, ApplyApproved)
s.SendTemplate(m, msg.Append(model.USER_UID), "场所权限申请 已通过 ✅")
m.Cmd(s.userPlace, s.userPlace.Create, msg.AppendSimple(model.USER_UID, model.PLACE_UID, model.ROLE))
}
func (s apply) status(m *ice.Message, from, todo ApplyStatus, arg ...string) *ice.Message {
msg := s.Table.Select(m.Spawn(), m.OptionSimple(model.UID)...)
if !m.WarnNotFound(msg.Length() == 0, m.Option(model.UID)) {
if status := ApplyStatus(kit.Int(msg.Append(model.STATUS))); !m.WarnNotValid(status != from, status.String()) {
s.Table.Update(m, kit.Dict(model.STATUS, todo), m.OptionSimple(model.UID)...)
}
}
return msg
}
type ApplyStatus int
const (
ApplyCreate ApplyStatus = iota
ApplyCancel
ApplySubmit
ApplyRejected
ApplyApproved
)
var ApplyStatusList = map[ApplyStatus]string{
ApplyCreate: "create",
ApplyCancel: "cancel",
ApplySubmit: "submit",
ApplyRejected: "rejected",
ApplyApproved: "approved",
}
func (s ApplyStatus) String() string { return ApplyStatusList[s] }

View File

@ -1,9 +1,15 @@
Volcanos(chat.ONIMPORT, {
_init: function(can, msg) { if (msg.IsDetail()) { return msg.Dump(can) }
can.page.Append(can, can._output, msg.Table(function(value) {
return can.page.itemcard(can, value, [
{view: html.TITLE, list: [{text: value.place_name}, {text: value.type}, {text: [value.user_place_role, "", aaa.ROLE]}]},
value._style = [value.place_type, value.user_place_role, value.apply_status]
return can.onimport.itemcard(can, value, [
{view: html.TITLE, list: [{text: value.place_name},
{text: [can.user.transValue(can, value, "place_type"), "", mdb.TYPE]},
{text: [can.user.transValue(can, value, "user_place_role"), "", aaa.ROLE]},
{text: [can.user.transValue(can, value, "apply_status"), "", mdb.STATUS]},
]},
{view: html.STATUS, list: [{text: value.street_name}, {text: value.place_address}]},
{view: html.STATUS, list: [{text: value.uid.slice(0, 6)}, {text: can.base.TimeTrim(value.created_at)}]},
{view: html.STATUS, list: [{text: value.begin_time.split(" ")[0]}, {text: value.end_time.split(" ")[0]}]},
], function() { can.Option("uid", value.uid), can.Update() })
}))

View File

@ -5,13 +5,50 @@ import (
"shylinux.com/x/icebergs/base/web"
kit "shylinux.com/x/toolkits"
"shylinux.com/x/community/src/gonganxitong/model"
"shylinux.com/x/mysql-story/src/db"
)
type Table struct{ db.Table }
type Table struct {
db.Table
list string `name:"list place_uid uid auto"`
}
func (s Table) Inputs(m *ice.Message, arg ...string) {
s.Table.Inputs(m, arg...)
}
func (s Table) Init(m *ice.Message, arg ...string) {
kit.If(m.Config(web.PORTAL) == ice.TRUE, func() { m.GoSleep("30ms", func() { portal{}.Show(m) }) })
kit.If(m.Config(web.PORTAL) == ice.TRUE, func() { portal{}.Show(m) })
}
func (s Table) List(m *ice.Message, arg ...string) *ice.Message {
if len(arg) == 0 || len(arg) == 1 {
if m.IsTech() {
s.Table.List(m)
}
} else if len(arg) == 2 {
s.Table.Select(m.FieldsSetDetail(), model.UID, arg[1])
}
return m
}
func (s Table) RewriteAppend(m *ice.Message, arg ...string) *ice.Message {
m.RewriteAppend(func(value, key string, index int) string {
kit.If(key == model.PLACE_TYPE, func() { value = PlaceType(kit.Int(value)).String() })
kit.If(key == model.USER_PLACE_ROLE, func() { value = UserPlaceRole(kit.Int(value)).String() })
kit.If(key == model.ORDER_STATUS, func() { value = OrderStatus(kit.Int(value)).String() })
kit.If(key == model.APPLY_STATUS, func() { value = ApplyStatus(kit.Int(value)).String() })
return value
})
return m
}
func (s Table) SendTemplate(m *ice.Message, user_uid, title string) {
if !m.IsErr() {
m.Cmd(user{}, user{}.SendTemplate, user_uid, cmdurl(m, m.Option(model.PLACE_UID), m.PrefixKey(), m.Option(model.UID)),
title, m.Option(model.PLACE_NAME), kit.Cut(m.Option(model.UID), 6))
}
}
func cmdurl(m *ice.Message, arg ...string) string {
return m.MergePodCmd("", m.Prefix(web.PORTAL), ice.MSG_DEBUG, m.Option(ice.MSG_DEBUG)) +
"#" + kit.Join([]string{arg[0], kit.Select(m.PrefixKey(), arg, 1), kit.Select("", arg, 2)}, ":")
}
func prefixKey() string { return kit.Keys("web.team", kit.PathName(-1), kit.FileName(-1)) }

View File

@ -15,23 +15,22 @@ type email struct {
user user
portal portal
Creds emails.Creds
list string `name:"list auto"`
apply string `name:"apply username* password*"`
reset string `name:"reset password*" help:"重置密码"`
}
func (s email) Init(m *ice.Message, arg ...string) {
m.GoSleep("30ms", func() { s.portal.Show(m) })
s.portal.Show(m)
}
func (s email) List(m *ice.Message, arg ...string) {
if msg := m.Cmd(s.user, s.user.Select, model.UID, s.user.UserUID(m)); len(msg.Append(model.EMAIL)) < 10 {
if msg := m.Cmd(s.user, s.user.Select, model.UID, m.Option(model.USER_UID)); len(msg.Append(model.EMAIL)) < 10 {
m.EchoInfoButton(m.Trans("please apply email", "请申请邮箱"), s.Apply)
} else {
m.EchoInfoButton(msg.Append(model.EMAIL), s.Reset)
}
}
func (s email) Apply(m *ice.Message, arg ...string) {
msg := m.Cmd(s.user, s.user.Select, model.UID, s.user.UserUID(m))
msg := m.Cmd(s.user, s.user.Select, model.UID, m.Option(model.USER_UID))
if m.Warn(msg.Append(model.EMAIL) != "", m.Trans("email already exists", "邮箱已存在")) {
return
}
@ -43,7 +42,7 @@ func (s email) Apply(m *ice.Message, arg ...string) {
kit.If(!m.IsErr(), func() { m.ToastSuccess() })
}
func (s email) Reset(m *ice.Message, arg ...string) {
msg := m.Cmd(s.user, s.user.Select, model.UID, s.user.UserUID(m))
msg := m.Cmd(s.user, s.user.Select, model.UID, m.Option(model.USER_UID))
m.Cmdy(s.Creds, s.Creds.Password, msg.Append(model.EMAIL), m.Option(aaa.PASSWORD))
kit.If(!m.IsErr(), func() { m.ToastSuccess() })
}

View File

@ -1,14 +1,28 @@
package gonganxitong
import "shylinux.com/x/ice"
import (
"shylinux.com/x/ice"
"shylinux.com/x/icebergs/base/ctx"
kit "shylinux.com/x/toolkits"
"shylinux.com/x/community/src/gonganxitong/model"
)
type event struct {
Table
user user
portal string `data:"true"`
}
func (s event) List(m *ice.Message, arg ...string) {
s.Table.List(m, arg...)
s.Tables(m, s.user).Fields(m,
"events.created_at", "events.uid",
"index", "operate", "args",
"users.avatar AS icons", "user_name", "user_uid",
).Orders(m, "created_at DESC").Select(m).Display("")
}
func init() { ice.Cmd(prefixKey(), event{}) }
func (s event) Record(m *ice.Message, arg ...string) {
m.Cmd(s, s.Create, m.OptionSimple(model.USER_UID, model.PLACE_UID), ctx.INDEX, m.PrefixKey(), "operate", m.ActionKey(), ctx.ARGS, kit.Join(arg, ","))
}

12
src/gonganxitong/event.js Normal file
View File

@ -0,0 +1,12 @@
Volcanos(chat.ONIMPORT, {
_init: function(can, msg) { if (msg.IsDetail()) { return msg.Dump(can) }
can.page.Append(can, can._output, msg.Table(function(value) {
return can.onimport.itemcard(can, value, [
{view: html.TITLE, list: [{text: value.user_name}]},
{view: html.STATUS, list: [{text: value.uid.slice(0, 6)}, {text: can.base.TimeTrim(value.created_at)}]},
{view: html.STATUS, list: [{text: value.index}, {text: value.operate}]},
{view: html.STATUS, list: [{text: value.args}]},
], function() { can.Option("uid", value.uid), can.Update() })
}))
},
})

View File

@ -12,22 +12,24 @@ const (
NAME = "name"
TYPE = "type"
ROLE = "role"
STATUS = "status"
ADDRESS = "address"
EMAIL = "email"
AVATAR = "avatar"
STATUS = "status"
OPENID = "openid"
OPEN_ID = "open_id"
ADDRESS = "address"
USER_UID = "user_uid"
USER_NAME = "user_name"
USER_PLACE_ROLE = "user_place_role"
PLACE_UID = "place_uid"
PLACE_TYPE = "place_type"
PLACE_NAME = "place_name"
PLACE_TYPE = "place_type"
PLACE_ADDRESS = "place_address"
STREET_UID = "street_uid"
STREET_NAME = "street_name"
APPLY_UID = "apply_uid"
APPLY_STATUS = "apply_status"
ORDER_STATUS = "order_status"
ORDER_UID = "order_uid"
BEGIN_TIME = "begin_time"
END_TIME = "end_time"
)
@ -56,8 +58,8 @@ type UserPlace struct {
type Place struct {
db.ModelWithUID
StreetUID string `gorm:"type:char(32)"`
Type uint8
Name string `gorm:"type:char(32)"`
Type uint8
Address string `gorm:"size:256"`
}
type Street struct {
@ -67,9 +69,11 @@ type Street struct {
type Event struct {
db.ModelWithUID
UserUID string `gorm:"type:char(32);index"`
Index string `gorm:"type:char(32)"`
args string `gorm:"type:char(32)"`
PlaceUID string `gorm:"type:char(32);index"`
UserUID string `gorm:"type:char(32)"`
Index string `gorm:"type:char(32)"`
Operate string `gorm:"type:char(32)"`
Args string `gorm:"type:char(32)"`
}
type Apply struct {
db.ModelWithUID
@ -83,7 +87,7 @@ type Apply struct {
type Order struct {
db.ModelWithUID
UserUID string `gorm:"type:char(32);index"`
ApplyUID string `gorm:"type:char(32)"`
ApplyUID string `gorm:"type:char(32);index"`
Status uint8
}

View File

@ -0,0 +1 @@
$output>div.item.card.rejected div.title span.status { border:var(--box-danger); color:var(--danger-bg-color); }

View File

@ -1,14 +1,87 @@
package gonganxitong
import "shylinux.com/x/ice"
import (
"shylinux.com/x/ice"
kit "shylinux.com/x/toolkits"
"shylinux.com/x/community/src/gonganxitong/model"
)
type order struct {
Table
portal string `data:"true"`
user user
apply apply
place place
street street
event event
portal string `data:"true"`
create string `name:"create user_uid* apply_uid* status*"`
reject string `name:"reject" role:"void"`
approve string `name:"approve" role:"void"`
list string `name:"list place_uid uid auto" role:"void"`
}
func (s order) Create(m *ice.Message, arg ...string) {
s.Table.Create(m, arg...)
s.SendTemplate(m, m.Option(model.USER_UID), "场所权限申请 请审批 🕑")
}
func (s order) Reject(m *ice.Message, arg ...string) {
defer m.ToastProcess()()
defer s.event.Record(m, m.Option(model.UID))
m.Cmd(s.apply, s.apply.Reject, m.Option(model.UID))
s.Table.Update(m, kit.Dict(model.STATUS, OrderRejected), model.UID, m.Option(model.ORDER_UID))
s.SendTemplate(m, m.Option(model.USER_UID), "场所权限申请 已驳回 ❌")
}
func (s order) Approve(m *ice.Message, arg ...string) {
defer m.ToastProcess()()
defer s.event.Record(m, m.Option(model.UID))
m.Cmd(s.apply, s.apply.Approve, m.Option(model.UID))
s.Table.Update(m, kit.Dict(model.STATUS, OrderApproved), model.UID, m.Option(model.ORDER_UID))
s.SendTemplate(m, m.Option(model.USER_UID), "场所权限申请 已通过 ✅")
}
func (s order) List(m *ice.Message, arg ...string) {
s.Table.List(m, arg...)
s.Tables(m, s.apply, s.place, s.street).Fields(m, "orders.created_at",
model.PLACE_NAME, model.PLACE_TYPE, "applies.role AS user_place_role", model.ORDER_STATUS,
model.STREET_NAME, model.PLACE_ADDRESS, model.PLACE_UID, "orders.uid AS order_uid",
"applies.uid", model.BEGIN_TIME, model.END_TIME,
).Orders(m, "created_at DESC")
if len(arg) == 0 {
if m.IsTech() {
s.Table.Select(m)
} else {
s.Table.Select(m, "orders.user_uid", m.Option(model.USER_UID))
}
} else if len(arg) == 1 {
s.Table.Select(m, "orders.user_uid", m.Option(model.USER_UID), model.PLACE_UID, arg[0]).Action(s.Create)
defer m.Sort("order_status,created_at", []string{OrderCreate.String(), OrderApproved.String(), OrderRejected.String()}, ice.STR_R)
} else {
s.Table.Select(m.FieldsSetDetail(), "orders.user_uid", m.Option(model.USER_UID), "applies.uid", arg[1])
}
m.Table(func(value ice.Maps) {
switch OrderStatus(kit.Int(value[model.ORDER_STATUS])) {
case OrderCreate:
m.PushButton(s.Reject, s.Approve)
default:
m.PushButton()
}
})
s.RewriteAppend(m).Display("").DisplayCSS("")
}
func init() { ice.Cmd(prefixKey(), order{}) }
type OrderStatus int
const (
OrderCreate OrderStatus = iota
OrderRejected
OrderApproved
)
var OrderStatusList = map[OrderStatus]string{
OrderCreate: "create",
OrderRejected: "rejected",
OrderApproved: "approved",
}
func init() { ice.Cmd(prefixKey(), order{}) }
func (s OrderStatus) String() string { return OrderStatusList[s] }

17
src/gonganxitong/order.js Normal file
View File

@ -0,0 +1,17 @@
Volcanos(chat.ONIMPORT, {
_init: function(can, msg) { if (msg.IsDetail()) { return msg.Dump(can) }
can.page.Append(can, can._output, msg.Table(function(value) {
value._style = [value.place_type, value.user_place_role, value.order_status]
return can.onimport.itemcard(can, value, [
{view: html.TITLE, list: [{text: value.place_name},
{text: [can.user.transValue(can, value, "place_type"), "", mdb.TYPE]},
{text: [can.user.transValue(can, value, "user_place_role"), "", aaa.ROLE]},
{text: [can.user.transValue(can, value, "order_status"), "", mdb.STATUS]},
]},
{view: html.STATUS, list: [{text: value.street_name}, {text: value.place_address}]},
{view: html.STATUS, list: [{text: value.uid.slice(0, 6)}, {text: can.base.TimeTrim(value.created_at)}]},
{view: html.STATUS, list: [{text: value.begin_time.split(" ")[0]}, {text: value.end_time.split(" ")[0]}]},
], function() { can.Option("uid", value.uid), can.Update() })
}))
},
})

View File

@ -6,33 +6,7 @@ import (
"shylinux.com/x/community/src/gonganxitong/model"
)
type PlaceType int
const (
PlaceHouse PlaceType = iota
PlaceHotel
PlacePublic
PlaceSchool
PlaceOffice
PlaceFactory
)
var PlaceTypeList = map[PlaceType]string{
PlaceHouse: "house",
PlaceHotel: "hotel",
PlacePublic: "public",
PlaceOffice: "office",
PlaceFactory: "factory",
}
func (s PlaceType) String() string {
return PlaceTypeList[s]
}
type place struct {
Table
create string `name:"create street_uid* address*"`
}
type place struct{ Table }
func (s place) Inputs(m *ice.Message, arg ...string) {
switch arg[0] {
@ -40,16 +14,36 @@ func (s place) Inputs(m *ice.Message, arg ...string) {
for k, v := range PlaceTypeList {
m.Push(arg[0], k).Push(model.NAME, v)
}
m.SortInt(arg[0])
m.DisplayInputKeyNameIconTitle()
m.SortInt(arg[0]).DisplayInputKeyNameIconTitle()
default:
s.Table.Inputs(m, arg...)
}
}
func (s place) List(m *ice.Message, arg ...string) {
if s.Table.List(m, arg...); len(arg) == 1 {
m.EchoQRCode(m.Append(model.UID))
}
}
func init() { ice.Cmd(prefixKey(), place{}) }
type PlaceType int
const (
PlaceHouse PlaceType = iota
PlaceHotel
PlaceStore
PlacePublic
PlaceSchool
PlaceOffice
PlaceFactory
PlaceHospital
)
var PlaceTypeList = map[PlaceType]string{
PlaceHouse: "house",
PlaceHotel: "hotel",
PlaceStore: "store",
PlacePublic: "public",
PlaceSchool: "school",
PlaceOffice: "office",
PlaceFactory: "factory",
PlaceHospital: "hospital",
}
func (s PlaceType) String() string { return PlaceTypeList[s] }

View File

@ -1,15 +1,16 @@
$output { background-color:var(--plugin-bg-color); }
$output>div.list { border-radius:10px; background-color:var(--output-bg-color); padding:10px; margin:10px; overflow-x:hidden; position:relative; }
$output>div.list>div.title { font-weight:bold; display:flex; align-items:center; }
$output>div.list>div.title div.action div.item.button.icons input { display:none; }
$output>div.list>div.title div.action div.item { margin-right:5px; }
$output>div.list>div.title span:first-child { flex-grow:1; }
$output>div.list>div.title div.action div.item { margin-right:5px; }
$output>div.list>div.title div.action div.item.button.icons input { display:none; }
$output>div.list>div.item.index { padding:10px; display:flex; flex-direction:column; align-items:center; float:left; }
$output>div.list>div.item.index.hide { display:none; }
$output>div.list>div.item.index img { width:100%; }
$output>div.list>div.action { display:flex; justify-content:center; }
$output>div.list>div.action input[type=button] { color:var(--notice-bg-color); border:none; }
$output>div.list>div.action div.item { margin-right:5px; }
$output>div.list>div.action i { display:none; }
$output>div.list>div.action div.item input[type=button] { color:var(--notice-bg-color); border:none; }
$output>div.list>div.action div.item i { display:none; }
$output>div.action div.item.button { margin-right:5px; }
$output>div.action div.item.button input { border:none; color:var(--notice-bg-color); min-width:80px; float:left; }
$output>div.action div.item.button span { display:none; }

View File

@ -4,16 +4,12 @@ import (
"shylinux.com/x/ice"
"shylinux.com/x/icebergs/base/ctx"
"shylinux.com/x/icebergs/base/mdb"
"shylinux.com/x/icebergs/base/web"
"shylinux.com/x/toolkits"
"shylinux.com/x/community/src/gonganxitong/model"
)
const (
EVENT_PLACE_CREATE = "web.team.community.place.create"
EVENT_PLACE_REMOVE = "web.team.community.place.remove"
)
type portal struct {
ice.Hash
user user
@ -22,9 +18,9 @@ type portal struct {
street street
export string `data:"true"`
short string `data:"index"`
field string `data:"time,name,icons,index,order,enable"`
field string `data:"time,name,icons,index,order,enable,type,role"`
list string `name:"list place_uid index uid auto" role:"void"`
placeCreate string `name:"placeCreate street_uid* place_type* name* address*" role:"void"`
placeCreate string `name:"placeCreate street_uid*:select place_type*:select name* address*" role:"void"`
placeRemove string `name:"placeRemove place_uid*" role:"void"`
scanQRCode string `name:"scanQRCode type text" role:"void"`
}
@ -33,9 +29,15 @@ func (s portal) Inputs(m *ice.Message, arg ...string) {
s.place.Inputs(m, arg...)
}
func (s portal) List(m *ice.Message, arg ...string) {
if m.Option("form") == "table" {
s.Hash.List(m, arg...).SortInt(mdb.ORDER)
return
}
if len(arg) == 0 {
m.Cmdy(s.userPlace, s.userPlace.MyPlace, s.user.UserUID(m)).Action(s.PlaceCreate, s.ScanQRCode).PushAction(s.PlaceRemove)
kit.If(m.Length() == 0, func() { m.EchoInfoButton(m.Trans("Please Create Your Place", "请添加场所"), s.PlaceCreate) })
m.Cmdy(s.userPlace, m.Option(model.USER_UID)).Action(s.PlaceCreate, s.ScanQRCode).PushAction(s.PlaceRemove)
kit.If(!m.IsErr() && m.Length() == 0, func() {
m.EchoInfoButton(m.Trans("Please Create Your Place", "请添加场所"), s.PlaceCreate, s.ScanQRCode)
})
} else if len(arg) == 1 {
s.Hash.List(m, arg[1:]...).SortInt(mdb.ORDER)
} else if len(arg) == 2 {
@ -45,14 +47,6 @@ func (s portal) List(m *ice.Message, arg ...string) {
}
m.Display("").DisplayCSS("")
}
func (s portal) ScanQRCode(m *ice.Message, arg ...string) {
defer m.ToastProcess()()
if m.Option(mdb.TYPE) == mdb.TEXT {
args := kit.Simple(model.USER_UID, s.user.UserUID(m), model.PLACE_UID, m.Option(mdb.TEXT))
m.Cmdy(s.userPlace, s.userPlace.Create, args, model.ROLE, UserPlaceVisitor)
}
}
func (s portal) PlaceCreate(m *ice.Message, arg ...string) {
defer m.ToastProcess()()
if m.WarnNotFound(m.Cmd(s.street, s.street.Select, model.UID, m.Option(model.STREET_UID)).Length() == 0, "street") {
@ -62,14 +56,13 @@ func (s portal) PlaceCreate(m *ice.Message, arg ...string) {
if m.Cmdy(s.place, s.place.Create, arg).IsErr() {
return
}
args := kit.Simple(model.USER_UID, s.user.UserUID(m), model.PLACE_UID, m.Result(), model.ROLE, UserPlaceCreator)
args := kit.Simple(model.USER_UID, m.Option(model.USER_UID), model.PLACE_UID, m.Result(), model.ROLE, UserPlaceCreator)
m.Cmdy(s.userPlace, s.userPlace.Create, args)
m.Event(EVENT_PLACE_CREATE, args, model.PLACE_ADDRESS, m.Option(model.ADDRESS))
m.ProcessRefresh()
}
func (s portal) PlaceRemove(m *ice.Message, arg ...string) {
defer m.ToastProcess()()
args := kit.Simple(model.USER_UID, s.user.UserUID(m), model.PLACE_UID, m.Option(model.PLACE_UID))
args := kit.Simple(model.USER_UID, m.Option(model.USER_UID), model.PLACE_UID, m.Option(model.PLACE_UID))
msg := m.Cmd(s.userPlace, s.userPlace.Select, args)
if m.WarnNotFound(msg.Length() == 0, "place") {
return
@ -78,9 +71,22 @@ func (s portal) PlaceRemove(m *ice.Message, arg ...string) {
if kit.Int(msg.Append(model.ROLE)) == kit.Int(UserPlaceCreator) {
m.Cmdy(s.place, s.place.Delete, model.UID, m.Option(model.PLACE_UID))
}
m.Event(EVENT_PLACE_REMOVE, args)
m.ProcessRefresh()
}
func (s portal) ScanQRCode(m *ice.Message, arg ...string) {
defer m.ToastProcess()()
if m.Option(mdb.TYPE) == mdb.TEXT {
args := kit.Simple(m.OptionSimple(model.USER_UID), model.PLACE_UID, m.Option(mdb.TEXT))
m.Cmdy(s.userPlace, s.userPlace.Create, args, model.ROLE, UserPlaceVisitor)
}
if m.Option(mdb.TYPE) == web.LINK {
args := m.ParseURL(m.Option(mdb.TEXT))
if len(args) > 1 && args[1] == m.Prefix("apply") {
args := kit.Simple(m.OptionSimple(model.USER_UID), model.PLACE_UID, args[0])
m.Cmdy(s.userPlace, s.userPlace.Create, args, model.ROLE, UserPlaceVisitor)
}
}
}
func init() { ice.Cmd(prefixKey(), portal{}) }
@ -88,13 +94,15 @@ type Portal struct {
portal
export string `data:"true"`
short string `data:"index"`
field string `data:"time,name,icons,index,order,enable"`
field string `data:"time,name,icons,index,order,enable,type,role"`
}
func init() { ice.Cmd(prefixKey(), Portal{}) }
func (s portal) Show(m *ice.Message, arg ...string) {
cmd := m.GetCommand()
icon := kit.Select(cmd.Icon, kit.Value(cmd.Meta, kit.Keys(ice.CTX_ICONS, m.CommandKey())))
m.Cmd(s, s.Create, mdb.NAME, cmd.Help, mdb.ICONS, icon, ctx.INDEX, m.PrefixKey())
m.GoSleep("30ms", func() {
cmd := m.GetCommand()
icon := kit.Select(cmd.Icon, kit.Value(cmd.Meta, kit.Keys(ice.CTX_ICONS, m.CommandKey())))
m.Cmd(s, s.Create, mdb.NAME, cmd.Help, mdb.ICONS, icon, ctx.INDEX, m.PrefixKey())
})
}

View File

@ -1,20 +1,23 @@
var UID = "uid", PLACE_UID = "place_uid", PLACE_NAME = "place_name"
var UID = "uid", PLACE_UID = "place_uid", PLACE_NAME = "place_name", PLACE_TYPE = "place_type"
Volcanos(chat.ONIMPORT, {
_init: function(can, msg) {
can.onimport.myPortal(can, msg, PLACE_UID, "place_address", "我的场所")
can.onimport.myPortal(can, msg, PLACE_UID, PLACE_NAME, "我的场所")
},
myValue: function(can, value) {
return [
{view: html.TITLE, list: [{text: value.place_address},
{text: [can.user.trans(can, value.type, null, "value.place_type"), "", mdb.TYPE]},
value.role != "creator" && {text: [can.user.trans(can, value.role, null, "value.user_place_role"), "", aaa.ROLE]},
{view: html.TITLE, list: [{text: value.place_name||value.place_address},
{text: [can.user.transValue(can, value, PLACE_TYPE), "", mdb.TYPE]},
value.user_place_role != "creator" && {text: [can.user.transValue(can, value, "user_place_role"), "", aaa.ROLE]},
]},
{view: html.STATUS, list: [{text: value[PLACE_UID].slice(0, 8)}, {text: value.street_name}, {text: can.base.TimeTrim(value.created_at)}]},
]
},
myPortal: function(can, msg, PLACE_UID, PLACE_NAME, title) { can.user.isMobile && can.isCmdMode() && can.onappend.style(can, html.OUTPUT)
can.db.hash = can.misc.SearchHash(can), can.sup.current = can.sup.current||{}
if (can.Option(PLACE_UID) == "") {
if (can.db.hash.length > 1 && can.db.hash[0]) { return can.Option(PLACE_UID, can.db.hash[0]), can.Option(ctx.INDEX, can.db.hash[1]), can.Update() }
if (can.db.hash.length > 1 && can.db.hash[0]) {
return can.Option(PLACE_UID, can.db.hash[0]), can.Option(ctx.INDEX, can.db.hash[1]), can.Update()
}
can.db.hash[0] && can.onexport.session(can, PLACE_UID, can.db.hash[0])
can.ui = can.page.Append(can, can._output, ["myplace.list", "myindex.list"])
can.page.Append(can, can.ui.myplace, [{view: html.TITLE, list: [{text: can.user.trans(can, "My Place", title)}], _init: function(target) {
@ -22,9 +25,11 @@ Volcanos(chat.ONIMPORT, {
msg.Option(ice.MSG_ACTION) && can.onappend._action(can, msg.Option(ice.MSG_ACTION), target)
}}])
}}])
can.run({}, [can.onimport.myPlace(can, msg, can.ui.myplace, PLACE_UID, PLACE_NAME)], function(msg) {
var uid = can.onimport.myPlace(can, msg, can.ui.myplace, PLACE_UID, PLACE_NAME)
msg.Length() > 0 && can.run({}, [uid], function(msg) {
can.page.Append(can, can.ui.myindex, [{view: html.TITLE, list: [{text: can.user.trans(can, "My Index", "我的应用")}]}])
for (var i = 0; i < 7; i++) { can.onimport.myIndex(can, msg, can.ui.myindex, PLACE_UID) }
for (var i = 0; i < 1; i++) { can.onimport.myIndex(can, msg, can.ui.myindex, PLACE_UID) }
can.onimport.selectIndex(can, can.sup.current)
})
} else {
can.onimport.myData(can, msg, can._output, PLACE_UID)
@ -33,8 +38,10 @@ Volcanos(chat.ONIMPORT, {
myPlace: function(can, msg, target, PLACE_UID, PLACE_NAME) { var place_uid
can.page.Append(can, target||can._output, msg.Table(function(value) {
place_uid = place_uid||value[PLACE_UID], can.base.isIn(value[PLACE_UID], can.onexport.session(can, PLACE_UID)||"", can.db.hash[0]||"") && (place_uid = value[PLACE_UID])
place_uid == value[PLACE_UID] && can.onexport.title(can, value[PLACE_NAME])
return can.page.itemcard(can, value, can.onimport.myValue(can, value), function(event) {
place_uid == value[PLACE_UID] && (can.onexport.title(can, value[PLACE_NAME]), can.sup.current = value)
value._uid = value[PLACE_UID]
return can.onimport.itemcard(can, value, can.onimport.myValue(can, value), function(event) {
can.sup.current = value, can.onimport.selectIndex(can, can.sup.current)
can.onexport.hash(can, value[PLACE_UID]), can.onexport.session(can, PLACE_UID, value[PLACE_UID]), can.onexport.title(can, value[PLACE_NAME])
can.user.agent.init(can, can.user.info.titles)
})
@ -43,10 +50,28 @@ Volcanos(chat.ONIMPORT, {
can.page.Append(can, target, [{view: html.ACTION, _init: function(target) { msg.Option(ice.MSG_ACTION) && can.onappend._action(can, msg.Option(ice.MSG_ACTION), target) }}])
can.onexport.hash(can, place_uid), can.onexport.session(can, PLACE_UID, place_uid); return place_uid
},
selectIndex: function(can, value) {
can.page.Select(can, can.ui.myindex, html.DIV_ITEM, function(target) {
var list = target.className.split(" ")
if (list.indexOf(mdb.TYPE) > -1 && list.indexOf(value.place_type) == -1) {
can.onmotion.toggle(can, target, false)
} else if (list.indexOf(aaa.ROLE) > -1 && list.indexOf(value.user_place_role) == -1) {
can.onmotion.toggle(can, target, false)
} else {
can.onmotion.toggle(can, target, true)
}
})
},
myIndex: function(can, msg, target, PLACE_UID) {
var width = (can.ConfWidth()-40)/parseInt((can.ConfWidth()-40)/100), height = width+20; can.user.isMobile && !can.user.isLandscape() && (width = (can.ConfWidth()-40)/4, height = width+20)
can.page.Append(can, target||can._output, msg.Table(function(value) {
var width; can.user.isMobile && !can.user.isLandscape() && (width = (can.ConfWidth()-40)/4)
return {view: [[html.ITEM, ctx.INDEX]], style: {width: width}, list: [
if (value.enable != ice.TRUE) {
return
}
return {view: [[html.ITEM, ctx.INDEX].concat(
value.type? ["type"]: [], can.core.Split(value.type||""),
value.role? ["role"]: [], can.core.Split(value.role||""),
)], style: {height: height, width: width}, list: [
{img: can.misc.ResourceIcons(can, value.icons)}, {text: can.user.trans(can, value.index.split(".").pop(), value.name)},
], onclick: function(event) {
can.Option(PLACE_UID, can.onexport.session(can, PLACE_UID)), can.Option(ctx.INDEX, value.index), can.Update()
@ -59,6 +84,7 @@ Volcanos(chat.ONIMPORT, {
var ui = can.page.Append(can, can._output, [{view: html.ACTION}])
if (can.db.hash.length > 2 && can.db.hash[0] && can.db.hash[2]) { value.args = [can.db.hash[0], can.db.hash[2]] }
value.style = html.OUTPUT, value.height = can.ConfHeight()-html.ACTION_HEIGHT
can.onexport.title(can, can.ConfHelp(), can.sup.current.place_name, value.help)
can.onappend.plugin(can, value, function(sub) { refresh = function() { sub.Update() }
sub.onexport.output = function(_sub, msg) { can.user.toastSuccess(can, "load", "", 1000), can.onappend.style(sub, html.OUTPUT)
can.page.Appends(can, ui.action, list), msg.Option(ice.MSG_ACTION) && can.onappend._action(sub, msg.Option(ice.MSG_ACTION), ui.action, null, true)

View File

@ -11,6 +11,8 @@
"event": "事件流",
"apply": "申请单",
"order": "审批单",
"reject": "驳回",
"approve": "通过",
"icons": {
"email": "usr/icons/Mail.png",
"qrcode": "usr/icons/Chess.png",
@ -26,15 +28,28 @@
"user_uid": "用户",
"user_name": "用户名",
"user_place_role": "用户角色",
"begin_time": "起始时间",
"end_time": "结束时间",
"place_uid": "场所",
"place_name": "场所名称",
"place_type": "场所类型",
"place_address": "场所地址",
"street_uid": "街道",
"street_name": "街道名称"
"street_name": "街道名称",
"apply_status": "申请状态",
"order_status": "审批状态",
"begin_time": "起始时间",
"end_time": "结束时间"
},
"value": {
"place_type": {
"house": "住宅",
"hotel": "宾馆",
"store": "商铺",
"public": "公共",
"school": "学校",
"office": "办公",
"factory": "工厂",
"hospital": "医院"
},
"user_place_role": {
"creator": "创建人",
"admin": "管理员",
@ -42,12 +57,17 @@
"tenant": "租客",
"visitor": "访客"
},
"place_type": {
"house": "住宅",
"hotel": "宾馆",
"public": "公共",
"office": "办公",
"factory": "工厂"
"apply_status": {
"create": "待提交 🕑",
"cancel": "已取消 ❌",
"submit": "已提交 🕑",
"rejected": "已驳回 ❌",
"approved": "已通过 ✅"
},
"order_status": {
"create": "待审批 🕑",
"rejected": "已驳回 ❌",
"approved": "已通过 ✅"
}
}
}

View File

@ -7,15 +7,20 @@ import (
)
type qrcode struct {
portal portal
portal portal
user user
userPlace userPlace
}
func (s qrcode) Init(m *ice.Message, arg ...string) {
m.GoSleep("30ms", func() { s.portal.Show(m) })
s.portal.Show(m)
}
func (s qrcode) List(m *ice.Message, arg ...string) {
msg := m.Cmd(s.userPlace, m.Option(model.USER_UID), arg[0])
m.FieldsSetDetail()
m.Push(model.PLACE_NAME, msg.Append(model.PLACE_NAME))
m.Push(model.PLACE_UID, arg[0])
m.EchoQRCode(arg[0])
m.EchoQRCode(cmdurl(m, arg[0], m.Prefix("apply")))
}
func init() { ice.Cmd(prefixKey(), qrcode{}) }

View File

@ -11,8 +11,8 @@ import (
type sess struct {
Table
create string `name:"create user_uid*"`
check string `name:"check uid*"`
user user
create string `name:"create user_uid"`
}
func (s sess) Create(m *ice.Message, arg ...string) {
@ -21,7 +21,11 @@ func (s sess) Create(m *ice.Message, arg ...string) {
}
func (s sess) Check(m *ice.Message, arg ...string) {
msg := s.Table.Select(m.Spawn(), model.UID, arg[0])
m.Option(ice.MSG_USERNAME, msg.Append(model.USER_UID))
msg = m.Cmd(s.user, s.user.Select, model.UID, msg.Append(model.USER_UID))
m.Option(ice.MSG_USERNAME, msg.Append(model.UID))
m.Option(ice.MSG_USERNICK, msg.Append(model.NAME))
m.Option(ice.MSG_AVATAR, msg.Append(model.AVATAR))
m.Option(model.USER_UID, msg.Append(model.UID))
}
func init() { ice.Cmd(prefixKey(), sess{}) }

View File

@ -4,7 +4,7 @@ import (
"time"
"shylinux.com/x/ice"
"shylinux.com/x/icebergs/base/mdb"
"shylinux.com/x/icebergs/base/aaa"
kit "shylinux.com/x/toolkits"
"shylinux.com/x/community/src/gonganxitong/model"
@ -13,33 +13,29 @@ import (
type user struct {
Table
template string `data:"4b-Z_r8dZmm1pHdd2h4A10VVYX4OIHvemlLjsHKBj2s"`
create string `name:"create openid*"`
create string `name:"create openid* headimgurl nickname"`
email string `name:"email email*"`
}
func (s user) Create(m *ice.Message, arg ...string) {
if s.Table.Select(m, model.OPEN_ID, m.Option(model.OPENID)).Length() == 0 {
s.Table.Create(m, model.OPEN_ID, m.Option(model.OPENID), model.AVATAR, m.Option("headimgurl"), model.NAME, m.Option("nickname"))
if s.Table.Select(m, m.OptionSimple(model.OPEN_ID)...).Length() == 0 {
s.Table.Create(m, kit.Simple(m.OptionSimple(model.OPEN_ID, model.AVATAR), model.NAME, m.Option(aaa.USERNICK))...)
m.Option(model.USER_UID, m.Result())
} else {
m.Option(model.USER_UID, m.Append(model.UID))
}
}
func (s user) Email(m *ice.Message, arg ...string) {
s.Table.Update(m, kit.Dict(model.EMAIL, m.Option(model.EMAIL)), model.UID, s.UserUID(m))
s.Table.Update(m, m.OptionSimple(model.EMAIL), model.UID, m.Option(model.USER_UID))
}
func init() { ice.Cmd(prefixKey(), user{}) }
func (s user) UserUID(m *ice.Message) string {
msg := m.Cmd(s, s.Select, model.UID, m.Option(ice.MSG_USERNAME))
m.Options(ice.MSG_AVATAR, msg.Append(model.AVATAR), ice.MSG_USERNICK, msg.Append(mdb.NAME), model.OPEN_ID, msg.Append(model.OPEN_ID))
return m.Option(model.USER_UID, msg.Append(model.UID))
}
func (s user) SendTemplate(m *ice.Message, arg ...string) { // url type name hash
m.Cmdy("web.chat.wx.template", "", m.Config("template"), m.Option(model.OPEN_ID), kit.Select("", arg, 0),
"thing7", kit.Select("", arg, 1), "thing12", kit.Select("", arg, 2), "character_string2", kit.Select("", arg, 3),
"time11", time.Now().Format("2006年01月02日 15:04"), "thing18", m.Option(ice.MSG_USERNICK),
func (s user) SendTemplate(m *ice.Message, arg ...string) { // uid url type name hash
msg := s.Select(m, model.UID, arg[0])
m.Cmdy("web.chat.wx.template", "", m.Config("template"), msg.Append(model.OPEN_ID), kit.Select("", arg, 1),
"thing7", kit.Select("", arg, 2), "thing12", kit.Select("", arg, 3), "character_string2", kit.Cut(kit.Select("", arg, 4), 6),
"time11", time.Now().Format("2006年01月02日 15:04"), "thing18", msg.Append(model.NAME),
)
}

View File

@ -2,48 +2,52 @@ package gonganxitong
import (
"shylinux.com/x/ice"
kit "shylinux.com/x/toolkits"
"shylinux.com/x/community/src/gonganxitong/model"
)
type UserPlaceRole int
const (
UserPlaceCreator UserPlaceRole = iota
UserPlaceAdmin
UserPlaceLandlord
UserPlaceTenant
UserPlaceVisitor
)
var UserPlaceRoleList = map[UserPlaceRole]string{
UserPlaceCreator: "creator",
UserPlaceAdmin: "admin",
UserPlaceLandlord: "landlord",
UserPlaceTenant: "tenant",
UserPlaceVisitor: "visitor",
}
func (s UserPlaceRole) String() string {
return UserPlaceRoleList[s]
}
type userPlace struct {
Table
place place
street street
create string `name:"create user_uid* place_uid* role*"`
list string `name:"list user_uid place_uid auto"`
}
func (s userPlace) MyPlace(m *ice.Message, arg ...string) {
s.Tables(m, s.place, s.street).Fields(m, "places.created_at", model.STREET_NAME, model.PLACE_NAME, model.TYPE, model.ROLE,
"places.address as place_address", model.PLACE_UID, model.STREET_UID)
s.Orders(m, "role desc", "created_at desc").Select(m, model.USER_UID, arg[0])
m.RewriteAppend(func(value, key string, index int) string {
kit.If(key == model.ROLE, func() { value = UserPlaceRole(kit.Int(value)).String() })
kit.If(key == model.TYPE, func() { value = PlaceType(kit.Int(value)).String() })
return value
})
func (s userPlace) List(m *ice.Message, arg ...string) {
s.Tables(m, s.place, s.street).Fields(m, "user_places.created_at",
model.USER_UID, model.PLACE_UID,
model.PLACE_NAME, model.PLACE_TYPE, model.USER_PLACE_ROLE,
model.STREET_NAME, model.PLACE_ADDRESS,
).Orders(m, "user_places.id DESC")
if len(arg) == 0 {
s.Select(m)
} else if len(arg) == 1 {
s.Select(m, model.USER_UID, arg[0])
} else {
s.Select(m.FieldsSetDetail(), model.USER_UID, arg[0], model.PLACE_UID, arg[1])
}
s.RewriteAppend(m)
}
func init() { ice.Cmd(prefixKey(), userPlace{}) }
type UserPlaceRole int
const (
UserPlaceCreator UserPlaceRole = iota
UserPlaceLandlord
UserPlaceTenant
UserPlaceAdmin
UserPlaceVisitor
)
var UserPlaceRoleList = map[UserPlaceRole]string{
UserPlaceCreator: "creator",
UserPlaceLandlord: "landlord",
UserPlaceTenant: "tenant",
UserPlaceAdmin: "admin",
UserPlaceVisitor: "visitor",
}
func (s UserPlaceRole) String() string { return UserPlaceRoleList[s] }