mirror of
https://shylinux.com/x/community
synced 2025-04-25 17:48:06 +08:00
opt some
This commit is contained in:
parent
a75fa32db0
commit
9e66460435
@ -7,43 +7,39 @@ import (
|
||||
"shylinux.com/x/community/src/gonganxitong/model"
|
||||
)
|
||||
|
||||
type apply struct {
|
||||
type Apply struct {
|
||||
Table
|
||||
user user
|
||||
userPlace userPlace
|
||||
street street
|
||||
city city
|
||||
place place
|
||||
event event
|
||||
portal string `data:"true"`
|
||||
domain string `data:"gonganxitong"`
|
||||
create string `name:"create place_uid* user_place_role*:select begin_time:select@date end_time:select@date" role:"void"`
|
||||
list string `name:"list place_uid uid auto" role:"void"`
|
||||
cancel string `name:"cancel" role:"void"`
|
||||
submit string `name:"submit" role:"void"`
|
||||
}
|
||||
|
||||
func (s apply) Inputs(m *ice.Message, arg ...string) {
|
||||
switch arg[0] {
|
||||
case model.USER_PLACE_ROLE:
|
||||
for k, v := range UserPlaceRoleList {
|
||||
if k != UserPlaceCreator && k != UserPlaceVisitor {
|
||||
m.Push(arg[0], k).Push(model.NAME, v)
|
||||
}
|
||||
}
|
||||
m.SortInt(arg[0]).DisplayInputKeyNameIconTitle()
|
||||
default:
|
||||
s.Table.Inputs(m, arg...)
|
||||
}
|
||||
func (s Apply) Inputs(m *ice.Message, arg ...string) {
|
||||
s.Place.(interface{ Inputs(*ice.Message, ...string) }).Inputs(m, arg...)
|
||||
}
|
||||
func (s apply) Create(m *ice.Message, arg ...string) {
|
||||
arg = kit.TransArgKeys(arg, model.USER_PLACE_ROLE, model.ROLE)
|
||||
func (s Apply) Init(m *ice.Message, arg ...string) {
|
||||
s.Table.Init(m, arg...)
|
||||
place_uid := s.Keys(s.Place, model.UID)
|
||||
user_place_role := s.Keys(s.UserPlace, model.ROLE)
|
||||
m.Design("create", "", place_uid+"* "+user_place_role+"*:select")
|
||||
m.Design("list", "", place_uid+" uid auto")
|
||||
}
|
||||
func (s Apply) Create(m *ice.Message, arg ...string) {
|
||||
arg = kit.TransArgKeys(arg, s.Keys(s.Place, model.UID), model.PLACE_UID)
|
||||
arg = kit.TransArgKeys(arg, s.Keys(s.UserPlace, model.ROLE), model.ROLE)
|
||||
arg = kit.TransArgValueTime(arg, model.BEGIN_TIME, model.END_TIME)
|
||||
s.Table.Create(m, kit.Simple(arg, m.OptionSimple(model.USER_UID), model.STATUS, ApplyCreate)...)
|
||||
s.Table.Create(m, kit.Simple(arg, m.OptionSimple(model.USER_UID), "tables", s.Keys(s.Place, model.UID), model.STATUS, ApplyCreate)...)
|
||||
}
|
||||
func (s apply) Cancel(m *ice.Message, arg ...string) {
|
||||
func (s Apply) Cancel(m *ice.Message, arg ...string) {
|
||||
msg := s.status(m, ApplyCreate, ApplyCancel)
|
||||
s.SendTemplate(m, msg.Append(model.USER_UID), "场所权限申请 已取消")
|
||||
s.SendTemplate(m, "", msg.Append(model.USER_UID), "场所权限申请 已取消")
|
||||
}
|
||||
func (s apply) Submit(m *ice.Message, arg ...string) {
|
||||
func (s Apply) Submit(m *ice.Message, arg ...string) {
|
||||
msg := s.status(m, ApplyCreate, ApplySubmit)
|
||||
if m.WarnNotValid(msg.IsErr()) {
|
||||
return
|
||||
@ -57,35 +53,30 @@ func (s apply) Submit(m *ice.Message, arg ...string) {
|
||||
case UserPlaceTenant, UserPlaceAdmin:
|
||||
role = UserPlaceLandlord
|
||||
}
|
||||
msg = m.Cmd(s.userPlace, s.userPlace.Select, m.OptionSimple(model.PLACE_UID), model.ROLE, role.String())
|
||||
msg = m.Cmd(s.UserPlace, s.Select, m.OptionSimple(s.Keys(s.Place, model.UID)), model.ROLE, role)
|
||||
if m.WarnNotFound(msg.Length() == 0, role.String()) {
|
||||
return
|
||||
}
|
||||
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), "场所权限申请 已提交")
|
||||
m.Cmd(Order{}, s.Create, msg.AppendSimple(model.USER_UID), model.APPLY_UID, m.Option(model.UID), model.STATUS, OrderCreate)
|
||||
s.SendTemplate(m, m.Cmd(s.user, s.Select, model.UID, msg.Append(model.USER_UID)).Append(model.NAME), m.Option(model.USER_UID), "场所权限申请 已提交")
|
||||
}
|
||||
func (s apply) Reject(m *ice.Message, arg ...string) {
|
||||
func (s Apply) Reject(m *ice.Message, arg ...string) {
|
||||
msg := s.status(m, ApplySubmit, ApplyRejected)
|
||||
s.SendTemplate(m, msg.Append(model.USER_UID), "场所权限申请 已驳回 ❌")
|
||||
s.SendTemplate(m, "", msg.Append(model.USER_UID), "场所权限申请 已驳回 ❌")
|
||||
}
|
||||
func (s apply) Approve(m *ice.Message, arg ...string) {
|
||||
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))
|
||||
s.SendTemplate(m, "", msg.Append(model.USER_UID), "场所权限申请 已通过 ✅")
|
||||
m.Cmd(s.UserPlace, s.Create, msg.AppendSimple(model.USER_UID, model.ROLE), s.Keys(s.Place, model.UID), msg.Append(model.PLACE_UID))
|
||||
}
|
||||
func (s apply) List(m *ice.Message, arg ...string) {
|
||||
s.Tables(m, s.user, s.place, s.street, s.city).Fields(m, s.Key(s, model.CREATED_AT), s.Key(s, model.ID),
|
||||
model.USER_NAME, model.USER_AVATAR,
|
||||
model.PLACE_NAME, model.PLACE_TYPE, s.AS(s.Key(s, model.ROLE), model.USER_PLACE_ROLE), model.APPLY_STATUS,
|
||||
model.CITY_NAME, model.STREET_NAME, model.PLACE_ADDRESS,
|
||||
func (s Apply) List(m *ice.Message, arg ...string) {
|
||||
s.Tables(m, s.user).FieldsWithCreatedAT(m, s,
|
||||
model.USER_AVATAR, model.USER_NAME,
|
||||
s.AS(s.Key(s, model.ROLE), s.Keys(s.UserPlace, model.ROLE)), model.APPLY_STATUS,
|
||||
model.BEGIN_TIME, model.END_TIME,
|
||||
s.Key(s, model.UID), model.PLACE_UID,
|
||||
).Orders(m, s.Desc(model.CREATED_AT))
|
||||
if len(arg) == 0 {
|
||||
if m.IsTech() {
|
||||
s.Table.Select(m)
|
||||
}
|
||||
} else if len(arg) == 1 {
|
||||
model.PLACE_UID,
|
||||
)
|
||||
if len(arg) == 1 {
|
||||
if s.Table.Select(m, model.USER_UID, m.Option(model.USER_UID), model.PLACE_UID, arg[0]); m.Length() == 0 {
|
||||
m.EchoInfoButton(m.Trans("please create apply", "请创建权限申请"), s.Create)
|
||||
return
|
||||
@ -97,12 +88,14 @@ func (s apply) List(m *ice.Message, arg ...string) {
|
||||
ApplyRejected.String(),
|
||||
ApplyCancel.String(),
|
||||
}, ice.STR_R)
|
||||
} else {
|
||||
s.Table.Select(m.FieldsSetDetail(), s.Key(s, model.UID), arg[1])
|
||||
} else if len(arg) == 2 {
|
||||
s.Table.SelectDetail(m, model.PLACE_UID, arg[0], s.Key(s, model.UID), arg[1])
|
||||
if ApplyStatus(kit.Int(m.Append(model.APPLY_STATUS))) == ApplySubmit {
|
||||
m.EchoQRCode(portal{}.Link(m, arg[0], m.Prefix("order"), arg[1]))
|
||||
m.EchoQRCode(Portal{}.Link(m, arg[0], m.Prefix("order"), arg[1]))
|
||||
}
|
||||
}
|
||||
m.RenameAppend(model.PLACE_UID, s.Keys(s.Place, model.UID))
|
||||
s.SelectJoin(m, s.Place, model.NAME, model.TYPE)
|
||||
m.Table(func(value ice.Maps) {
|
||||
switch ApplyStatus(kit.Int(value[model.APPLY_STATUS])) {
|
||||
case ApplyCreate:
|
||||
@ -111,12 +104,20 @@ func (s apply) List(m *ice.Message, arg ...string) {
|
||||
m.PushButton()
|
||||
}
|
||||
})
|
||||
s.RewriteAppend(m).Display("").DisplayCSS("")
|
||||
s.UserPlace.(interface {
|
||||
RewriteAppend(*ice.Message, ...string) *ice.Message
|
||||
}).RewriteAppend(m)
|
||||
s.RewriteAppend(m)
|
||||
s.Display(m)
|
||||
}
|
||||
|
||||
func init() { ice.TeamCtxCmd(apply{}) }
|
||||
func init() { ice.TeamCtxCmd(Apply{Table: newTable()}) }
|
||||
|
||||
func (s apply) status(m *ice.Message, from, todo ApplyStatus, arg ...string) *ice.Message {
|
||||
func NewApply(userPlace, place ice.Any, street Container) Apply {
|
||||
return Apply{Table: Table{UserPlace: userPlace, Place: place, Street: street}}
|
||||
}
|
||||
|
||||
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()) {
|
||||
|
@ -1,15 +1,19 @@
|
||||
Volcanos(chat.ONIMPORT, {
|
||||
_init: function(can, msg) { if (msg.IsDetail()) { return msg.Dump(can) }
|
||||
var PLACE_NAME = msg.Option("_place_name")
|
||||
var PLACE_TYPE = PLACE_NAME.replace("_name", "_type")
|
||||
var USER_PLACE_ROLE = "user_"+PLACE_NAME.replace("_name", "_role")
|
||||
var STREET_NAME = msg.Option("_street_name")
|
||||
can.page.Append(can, can._output, msg.Table(function(value) { 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]},
|
||||
{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.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]}]},
|
||||
{view: html.STATUS, list: [{text: value.city_name}, {text: value.street_name}, {text: value.place_address}]},
|
||||
{view: html.STATUS, list: [{text: value.city_name}, {text: value[STREET_NAME]}]},
|
||||
])
|
||||
}))
|
||||
},
|
||||
|
@ -1,6 +1,8 @@
|
||||
package gonganxitong
|
||||
|
||||
import (
|
||||
"path"
|
||||
|
||||
"shylinux.com/x/ice"
|
||||
"shylinux.com/x/icebergs/base/web"
|
||||
kit "shylinux.com/x/toolkits"
|
||||
@ -11,12 +13,15 @@ import (
|
||||
|
||||
type Table struct {
|
||||
db.Table
|
||||
UserPlace ice.Any
|
||||
Place ice.Any
|
||||
Street Container
|
||||
inputs string `name:"inputs" role:"void"`
|
||||
list string `name:"list place_uid uid auto" role:"void"`
|
||||
}
|
||||
|
||||
func (s Table) Init(m *ice.Message, arg ...string) {
|
||||
kit.If(m.Config(web.PORTAL) == ice.TRUE, func() { portal{}.Show(m) })
|
||||
kit.If(m.Config(web.PORTAL) == ice.TRUE, func() { Portal{}.Show(m) })
|
||||
}
|
||||
func (s Table) Inputs(m *ice.Message, arg ...string) {
|
||||
s.Table.Inputs(m, arg...)
|
||||
@ -27,10 +32,16 @@ func (s Table) List(m *ice.Message, arg ...string) *ice.Message {
|
||||
s.Table.List(m)
|
||||
}
|
||||
} else if len(arg) == 2 {
|
||||
s.Table.Select(m.FieldsSetDetail(), model.UID, arg[1])
|
||||
s.Table.SelectDetail(m, model.UID, arg[1])
|
||||
}
|
||||
return m
|
||||
}
|
||||
func (s Table) SelectJoinUser(m *ice.Message) *ice.Message {
|
||||
return s.SelectJoin(m, user{}, model.NAME, model.AVATAR)
|
||||
}
|
||||
func (s Table) SelectJoinCity(m *ice.Message) *ice.Message {
|
||||
return s.SelectJoin(m, city{}, model.NAME)
|
||||
}
|
||||
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() })
|
||||
@ -41,9 +52,63 @@ func (s Table) RewriteAppend(m *ice.Message, arg ...string) *ice.Message {
|
||||
})
|
||||
return m
|
||||
}
|
||||
func (s Table) SendTemplate(m *ice.Message, user_uid, title string) {
|
||||
func (s Table) SendTemplate(m *ice.Message, from, user_uid, title string) {
|
||||
if !m.IsErr() {
|
||||
m.Cmd(user{}, user{}.SendTemplate, user_uid, portal{}.Link(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))
|
||||
m.Cmd(user{}, user{}.SendTemplate, from, user_uid, Portal{}.Link(m, m.Option(s.Keys(s.Place, model.UID)), m.PrefixKey(), m.Option(model.UID)),
|
||||
title, m.Option(s.Keys(s.Place, model.NAME))+" "+m.Option(s.Keys(s.UserPlace, model.ROLE)), kit.Cut(m.Option(model.UID), 6))
|
||||
}
|
||||
}
|
||||
func (s Table) Display(m *ice.Message) {
|
||||
m.Option("_place_uid", s.ToLower(kit.TypeName(s.Place))+"_uid")
|
||||
m.Option("_place_name", s.ToLower(kit.TypeName(s.Place))+"_name")
|
||||
m.Option("_street_name", s.ToLower(kit.TypeName(s.Street))+"_name")
|
||||
m.Option(ice.MSG_USERPOD, "20240724-community")
|
||||
m.Display("/p/src/gonganxitong/" + m.CommandKey() + ".js?pod=20240724-community").DisplayCSS("")
|
||||
}
|
||||
|
||||
type Tables struct {
|
||||
Table
|
||||
Portal Portal
|
||||
list string `name:"list place_uid auto" role:"void"`
|
||||
}
|
||||
|
||||
func (s Tables) Init(m *ice.Message, arg ...string) {
|
||||
s.Portal.Show(m)
|
||||
}
|
||||
func (s Tables) Link(m *ice.Message, arg ...string) string {
|
||||
return s.Portal.Link(m, arg...)
|
||||
}
|
||||
func (s Tables) BeforeMigrate(m *ice.Message, arg ...string) {
|
||||
}
|
||||
|
||||
func newTables() Tables { return Tables{Table: newTable()} }
|
||||
|
||||
func newTable() Table { return Table{UserPlace: userPlace{}, Place: place{}, Street: street{}} }
|
||||
|
||||
func NewTable(userPlace, place ice.Any, street Container) Table {
|
||||
return Table{UserPlace: userPlace, Place: place, Street: street}
|
||||
}
|
||||
func NewPortal(userPlace, place ice.Any, street Container) Portal {
|
||||
return Portal{Table: Table{UserPlace: userPlace, Place: place, Street: street}}
|
||||
}
|
||||
|
||||
type Container interface {
|
||||
FindOrCreateByName(m *ice.Message, arg ...string)
|
||||
}
|
||||
|
||||
func (s Portal) getTable() Table { return s.Table }
|
||||
|
||||
func PortalCmd(portal ice.Any) {
|
||||
h := kit.FileLine(-1, 100)
|
||||
p := kit.Keys("web.team", kit.ModPath(-1))
|
||||
cmd := func(name string, data ice.Any) {
|
||||
_, cmd := ice.Cmd(kit.Keys(p, name), data)
|
||||
cmd.RawHand = path.Join(path.Dir(h), name+".go")
|
||||
}
|
||||
table := portal.(interface{ getTable() Table }).getTable()
|
||||
cmd("portal", portal)
|
||||
cmd("qrcode", qrcode{Tables: Tables{Table: table}})
|
||||
cmd("apply", Apply{Table: table})
|
||||
cmd("order", Order{Table: table})
|
||||
cmd("event", event{})
|
||||
}
|
||||
|
@ -13,7 +13,7 @@ import (
|
||||
|
||||
type email struct {
|
||||
user user
|
||||
portal portal
|
||||
portal Portal
|
||||
creds emails.Creds
|
||||
apply string `name:"apply username* password*" role:"void"`
|
||||
reset string `name:"reset password*" help:"重置密码" role:"void"`
|
||||
|
@ -12,28 +12,33 @@ type event struct {
|
||||
Table
|
||||
user user
|
||||
portal string `data:"true"`
|
||||
domain string `data:"gonganxitong"`
|
||||
}
|
||||
|
||||
func (s event) List(m *ice.Message, arg ...string) {
|
||||
s.Tables(m, s.user).Fields(m,
|
||||
s.Key(s, model.CREATED_AT), s.Key(s, model.ID),
|
||||
s.Tables(m, s.user).FieldsWithCreatedAT(m, s,
|
||||
model.USER_AVATAR, model.USER_NAME,
|
||||
ctx.INDEX, model.OPERATE, ctx.ARGS, model.INFO,
|
||||
s.Key(s, model.UID), model.USER_UID,
|
||||
).Orders(m, s.Desc(model.CREATED_AT))
|
||||
)
|
||||
if len(arg) == 0 {
|
||||
if m.IsTech() {
|
||||
s.Select(m)
|
||||
}
|
||||
} else if len(arg) == 1 {
|
||||
s.Select(m, model.PLACE_UID, arg[0])
|
||||
} else {
|
||||
} else if len(arg) == 2 {
|
||||
s.Select(m.FieldsSetDetail(), s.Key(s, model.UID), arg[1])
|
||||
}
|
||||
m.Display("")
|
||||
}
|
||||
|
||||
func init() { ice.TeamCtxCmd(event{}) }
|
||||
|
||||
type Event struct{ event }
|
||||
|
||||
func init() { ice.TeamCtxCmd(Event{}) }
|
||||
|
||||
func (s event) Record(m *ice.Message, info string, arg ...string) {
|
||||
m.Cmd(s, s.Create, m.OptionSimple(model.USER_UID, model.PLACE_UID), model.INFO, info, ctx.INDEX, m.PrefixKey(), model.OPERATE, m.ActionKey(), ctx.ARGS, kit.Join(arg, ","))
|
||||
}
|
||||
|
@ -26,11 +26,13 @@ const (
|
||||
STREET_UID = "street_uid"
|
||||
CITY_NAME = "city_name"
|
||||
CITY_UID = "city_uid"
|
||||
EVENT_UID = "event_uid"
|
||||
APPLY_UID = "apply_uid"
|
||||
APPLY_STATUS = "apply_status"
|
||||
ORDER_STATUS = "order_status"
|
||||
ORDER_UID = "order_uid"
|
||||
CREATED_AT = "created_at"
|
||||
OPERATOR = "operator"
|
||||
OPERATE = "operate"
|
||||
BEGIN_TIME = "begin_time"
|
||||
END_TIME = "end_time"
|
||||
@ -88,6 +90,7 @@ type Apply struct {
|
||||
db.ModelWithUID
|
||||
PlaceUID string `gorm:"type:char(32);index"`
|
||||
UserUID string `gorm:"type:char(32)"`
|
||||
Tables string `gorm:"type:char(32)"`
|
||||
Status uint8
|
||||
Role uint8
|
||||
BeginTime db.Time
|
||||
|
@ -7,60 +7,55 @@ import (
|
||||
"shylinux.com/x/community/src/gonganxitong/model"
|
||||
)
|
||||
|
||||
type order struct {
|
||||
type Order struct {
|
||||
Table
|
||||
user user
|
||||
apply apply
|
||||
userPlace userPlace
|
||||
place place
|
||||
street street
|
||||
city city
|
||||
apply Apply
|
||||
event event
|
||||
portal string `data:"true"`
|
||||
domain string `data:"gonganxitong"`
|
||||
create string `name:"create user_uid* apply_uid* status*"`
|
||||
reject string `name:"reject" role:"void"`
|
||||
approve string `name:"approve" role:"void"`
|
||||
}
|
||||
|
||||
func (s order) Create(m *ice.Message, arg ...string) {
|
||||
func (s Order) Create(m *ice.Message, arg ...string) {
|
||||
s.Table.Create(m, arg...)
|
||||
s.SendTemplate(m, m.Option(model.USER_UID), "场所权限审批 请处理")
|
||||
s.SendTemplate(m, "", m.Option(model.USER_UID), "场所权限审批 请处理")
|
||||
}
|
||||
func (s order) Reject(m *ice.Message, arg ...string) {
|
||||
func (s Order) Reject(m *ice.Message, arg ...string) {
|
||||
defer m.ToastProcess()()
|
||||
defer s.event.Record(m, kit.Format("审批驳回%s成为%s", m.Option(model.USER_NAME), m.Option(model.USER_PLACE_ROLE)), m.Option(model.UID))
|
||||
defer s.event.Record(m, kit.Format("审批驳回%s成为%s", m.Option(model.USER_NAME), m.Option(s.Key(s.UserPlace, model.ROLE))), 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), "场所权限审批 已驳回 ❌")
|
||||
s.SendTemplate(m, m.Option(model.USER_NAME), m.Option(model.USER_UID), "场所权限审批 已驳回 ❌")
|
||||
}
|
||||
func (s order) Approve(m *ice.Message, arg ...string) {
|
||||
func (s Order) Approve(m *ice.Message, arg ...string) {
|
||||
defer m.ToastProcess()()
|
||||
defer s.event.Record(m, kit.Format("审批通过%s成为%s", m.Option(model.USER_NAME), m.Option(model.USER_PLACE_ROLE)), m.Option(model.UID))
|
||||
defer s.event.Record(m, kit.Format("审批通过%s成为%s", m.Option(model.USER_NAME), m.Option(s.Key(s.UserPlace, model.ROLE))), 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), "场所权限审批 已通过 ✅")
|
||||
s.SendTemplate(m, m.Option(model.USER_NAME), m.Option(model.USER_UID), "场所权限审批 已通过 ✅")
|
||||
}
|
||||
func (s order) List(m *ice.Message, arg ...string) {
|
||||
s.Tables(m, s.apply, "left join users on applies.user_uid = users.uid", s.place, s.street, s.city).Fields(m,
|
||||
s.Key(s, model.CREATED_AT), s.Key(s, model.ID),
|
||||
func (s Order) List(m *ice.Message, arg ...string) {
|
||||
s.Tables(m, s.apply, "left join users on applies.user_uid = users.uid").Fields(m, s.Key(s, model.CREATED_AT),
|
||||
model.USER_AVATAR, model.USER_NAME,
|
||||
model.PLACE_NAME, model.PLACE_TYPE, s.AS(s.Key(s.apply, model.ROLE), model.USER_PLACE_ROLE), model.ORDER_STATUS,
|
||||
model.CITY_NAME, model.STREET_NAME, model.PLACE_ADDRESS,
|
||||
s.AS(s.Key(s.apply, model.ROLE), s.Keys(s.UserPlace, model.ROLE)), model.ORDER_STATUS,
|
||||
model.BEGIN_TIME, model.END_TIME,
|
||||
s.Key(s.apply, model.UID), s.AS(s.Key(s, model.UID), model.ORDER_UID), model.PLACE_UID,
|
||||
s.AS(s.Key(s, model.UID), model.ORDER_UID), s.Key(s.apply, model.UID), model.PLACE_UID,
|
||||
).Orders(m, s.Desc(model.CREATED_AT))
|
||||
if len(arg) == 0 {
|
||||
if m.IsTech() {
|
||||
s.Table.Select(m)
|
||||
} else {
|
||||
s.Table.Select(m, s.Key(s, model.USER_UID), m.Option(model.USER_UID))
|
||||
}
|
||||
} else if len(arg) == 1 {
|
||||
s.Table.Select(m, s.Key(s, model.USER_UID), m.Option(model.USER_UID), model.PLACE_UID, arg[0])
|
||||
defer m.Sort(kit.Fields(model.ORDER_STATUS, model.CREATED_AT), []string{OrderCreate.String(), OrderApproved.String(), OrderRejected.String()}, ice.STR_R)
|
||||
} else if len(arg) == 2 {
|
||||
s.Table.SelectDetail(m, s.Key(s, model.USER_UID), m.Option(model.USER_UID), s.Key(s.apply, model.UID), arg[1])
|
||||
} else {
|
||||
s.Table.Select(m.FieldsSetDetail(), s.Key(s, model.USER_UID), m.Option(model.USER_UID), s.Key(s.apply, model.UID), arg[1])
|
||||
return
|
||||
}
|
||||
m.RenameAppend(model.PLACE_UID, s.Keys(s.Place, model.UID))
|
||||
s.SelectJoin(m, s.Place, model.NAME, model.TYPE)
|
||||
m.Table(func(value ice.Maps) {
|
||||
switch OrderStatus(kit.Int(value[model.ORDER_STATUS])) {
|
||||
case OrderCreate:
|
||||
@ -69,10 +64,14 @@ func (s order) List(m *ice.Message, arg ...string) {
|
||||
m.PushButton()
|
||||
}
|
||||
})
|
||||
s.RewriteAppend(m).Display("").DisplayCSS("")
|
||||
|
||||
s.UserPlace.(interface {
|
||||
RewriteAppend(*ice.Message, ...string) *ice.Message
|
||||
}).RewriteAppend(m)
|
||||
s.RewriteAppend(m)
|
||||
s.Display(m)
|
||||
}
|
||||
func init() { ice.TeamCtxCmd(order{}) }
|
||||
|
||||
func init() { ice.TeamCtxCmd(Order{Table: newTable()}) }
|
||||
|
||||
type OrderStatus int
|
||||
|
||||
|
@ -11,17 +11,6 @@ type place struct {
|
||||
user user
|
||||
}
|
||||
|
||||
func (s place) Inputs(m *ice.Message, arg ...string) {
|
||||
switch arg[0] {
|
||||
case model.PLACE_TYPE:
|
||||
for k, v := range PlaceTypeList {
|
||||
m.Push(arg[0], k).Push(model.NAME, v)
|
||||
}
|
||||
m.SortInt(arg[0]).DisplayInputKeyNameIconTitle()
|
||||
default:
|
||||
s.Table.Inputs(m, arg...)
|
||||
}
|
||||
}
|
||||
func (s place) User(m *ice.Message, arg ...string) {
|
||||
userPlace := userPlace{}
|
||||
s.Tables(m, "left join user_places on places.uid = user_places.place_uid", s.user).Fields(m,
|
||||
|
@ -8,7 +8,7 @@ import (
|
||||
|
||||
type placeUser struct {
|
||||
place place
|
||||
portal portal
|
||||
portal Portal
|
||||
list string `name:"list place_uid uid auto" role:"void"`
|
||||
}
|
||||
|
||||
|
@ -10,110 +10,92 @@ import (
|
||||
"shylinux.com/x/community/src/gonganxitong/model"
|
||||
)
|
||||
|
||||
type portal struct {
|
||||
type Portal struct {
|
||||
ice.Hash
|
||||
Table
|
||||
user user
|
||||
userPlace userPlace
|
||||
place place
|
||||
street street
|
||||
city city
|
||||
export string `data:"true"`
|
||||
short string `data:"index"`
|
||||
field string `data:"time,name,icons,index,order,enable,type,role"`
|
||||
inputs string `name:"inputs" role:"void"`
|
||||
list string `name:"list place_uid index uid auto" role:"void"`
|
||||
placeCreate string `name:"placeCreate city_name* street_name* place_type*:select name* address*" role:"void"`
|
||||
placeRemove string `name:"placeRemove user_uid* place_uid* user_place_role*" role:"void"`
|
||||
scanQRCode string `name:"scanQRCode type text" role:"void"`
|
||||
placeCreate string `name:"placeCreate city_name* street_name* place_type*:select name* address*" role:"void" icon:"bi bi-plus-square-dotted"`
|
||||
placeRemove string `name:"placeRemove uid*" role:"void"`
|
||||
scanQRCode string `name:"scanQRCode type text" role:"void" icon:"bi bi-qr-code-scan"`
|
||||
}
|
||||
|
||||
func (s portal) Inputs(m *ice.Message, arg ...string) {
|
||||
s.place.Inputs(m, arg...)
|
||||
func (s Portal) BeforeMigrate(m *ice.Message, arg ...string) {
|
||||
|
||||
}
|
||||
func (s portal) List(m *ice.Message, arg ...string) {
|
||||
func (s Portal) Inputs(m *ice.Message, arg ...string) {
|
||||
m.Cmdy(s.Place, m.ActionKey(), 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, m.Option(model.USER_UID)).PushAction(s.PlaceRemove).Action(s.PlaceCreate, s.ScanQRCode)
|
||||
m.Cmdy(s.UserPlace, m.Option(model.USER_UID)).PushAction(s.PlaceRemove).Action(s.PlaceCreate, s.ScanQRCode)
|
||||
kit.If(!m.IsErr() && m.Length() == 0, func() {
|
||||
m.EchoInfoButton(m.Trans("Please Create Your Place", "请添加场所"), s.PlaceCreate, s.ScanQRCode)
|
||||
})
|
||||
} else if len(arg) == 2 {
|
||||
msg := m.Cmd(s.place, s.place.Select, model.UID, arg[0])
|
||||
m.Option(model.PLACE_NAME, msg.Append(model.NAME))
|
||||
msg := m.Cmd(s.Place, s.Select, model.UID, arg[0])
|
||||
m.Option(s.Key(s.Place, model.NAME), msg.Append(model.NAME))
|
||||
m.Cmdy(ctx.COMMAND, arg[1]).Push(ctx.ARGS, arg[0])
|
||||
} else if len(arg) == 1 {
|
||||
s.Hash.List(m, arg[1:]...).SortInt(mdb.ORDER)
|
||||
} else {
|
||||
m.FieldsSetDetail().Cmdy(arg[1], mdb.SELECT, model.UID, arg[2]).PushAction().Action()
|
||||
}
|
||||
m.Display("").DisplayCSS("")
|
||||
s.Display(m)
|
||||
}
|
||||
func (s portal) PlaceCreate(m *ice.Message, arg ...string) {
|
||||
func (s Portal) PlaceCreate(m *ice.Message, arg ...string) {
|
||||
defer m.ToastProcess()()
|
||||
if s.city.FindOrCreateByName(m, arg...); m.IsErr() {
|
||||
return
|
||||
}
|
||||
if s.street.FindOrCreateByName(m, arg...); m.IsErr() {
|
||||
if s.Street.FindOrCreateByName(m, arg...); m.IsErr() {
|
||||
return
|
||||
}
|
||||
arg = kit.TransArgKeys(arg, model.PLACE_TYPE, model.TYPE)
|
||||
if m.Cmdy(s.place, s.place.Create, arg[2:]).IsErr() {
|
||||
arg = kit.TransArgKeys(arg, s.Keys(s.Place, model.TYPE), model.TYPE)
|
||||
if m.Cmdy(s.Place, s.Create, arg[2:]).IsErr() {
|
||||
return
|
||||
}
|
||||
args := kit.Simple(m.OptionSimple(model.USER_UID), model.PLACE_UID, m.Result(), model.ROLE, UserPlaceCreator)
|
||||
m.Cmdy(s.userPlace, s.userPlace.Create, args).ProcessRefresh()
|
||||
args := kit.Simple(m.OptionSimple(model.USER_UID), s.Keys(s.Place, model.UID), m.Result(), model.ROLE, UserPlaceCreator)
|
||||
m.Cmdy(s.UserPlace, s.Create, args).ProcessRefresh()
|
||||
}
|
||||
func (s portal) PlaceRemove(m *ice.Message, arg ...string) {
|
||||
func (s Portal) PlaceRemove(m *ice.Message, arg ...string) {
|
||||
defer m.ToastProcess()()
|
||||
args := kit.Simple(m.OptionSimple(model.USER_UID, model.PLACE_UID), model.ROLE, m.Option(model.USER_PLACE_ROLE))
|
||||
msg := m.Cmd(s.userPlace, s.userPlace.Select, args)
|
||||
if m.WarnNotFound(msg.Length() == 0, "place") {
|
||||
return
|
||||
}
|
||||
m.Cmdy(s.userPlace, s.userPlace.Delete, msg.AppendSimple(model.UID))
|
||||
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.Cmdy(s.UserPlace, s.Delete, m.OptionSimple(model.UID))
|
||||
m.ProcessRefresh()
|
||||
}
|
||||
func (s portal) ScanQRCode(m *ice.Message, arg ...string) {
|
||||
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)
|
||||
args := kit.Simple(m.OptionSimple(model.USER_UID), s.Key(s.Place, model.UID), m.Option(mdb.TEXT))
|
||||
m.Cmdy(s.UserPlace, s.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)
|
||||
args := kit.Simple(m.OptionSimple(model.USER_UID), s.Key(s.Place, model.UID), args[0])
|
||||
m.Cmdy(s.UserPlace, s.Create, args, model.ROLE, UserPlaceVisitor)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func init() { ice.TeamCtxCmd(portal{}) }
|
||||
func init() { ice.TeamCtxCmd(Portal{Table: newTable()}) }
|
||||
|
||||
func (s portal) Show(m *ice.Message, arg ...string) {
|
||||
func (s Portal) Show(m *ice.Message, arg ...string) {
|
||||
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(), arg)
|
||||
m.Cmd(m.Prefix(web.PORTAL), s.Create, mdb.NAME, cmd.Help, mdb.ICONS, cmd.Icon, ctx.INDEX, m.PrefixKey())
|
||||
})
|
||||
}
|
||||
func (s portal) Link(m *ice.Message, arg ...string) string {
|
||||
func (s Portal) Link(m *ice.Message, arg ...string) string {
|
||||
return m.MergePodCmd("", m.Prefix(web.PORTAL)) + "?debug=true" +
|
||||
"#" + kit.Join([]string{arg[0], kit.Select(m.PrefixKey(), arg, 1), kit.Select("", arg, 2)}, ":")
|
||||
"#" + kit.TrimSuffix(kit.Join([]string{arg[0], kit.Select(m.Prefix("apply"), arg, 1), kit.Select("", arg, 2)}, ":"), ":")
|
||||
}
|
||||
|
||||
type Portal struct {
|
||||
portal
|
||||
export string `data:"true"`
|
||||
short string `data:"index"`
|
||||
field string `data:"time,name,icons,index,order,enable,type,role"`
|
||||
inputs string `name:"inputs" role:"void"`
|
||||
}
|
||||
|
||||
func init() { ice.TeamCtxCmd(Portal{}) }
|
||||
|
@ -1,21 +1,22 @@
|
||||
var UID = "uid", PLACE_UID = "place_uid", PLACE_NAME = "place_name", PLACE_TYPE = "place_type"
|
||||
var UID = "uid", PLACE_UID = "place_uid", PLACE_NAME = "place_name", PLACE_TYPE = "place_type", STREET_NAME = "street_name"
|
||||
Volcanos(chat.ONIMPORT, {
|
||||
_init: function(can, msg) {
|
||||
can.onimport.myPortal(can, msg, PLACE_UID, PLACE_NAME, "我的场所")
|
||||
can.onimport.myPortal(can, msg, msg.Option("_place_uid")||PLACE_UID, msg.Option("_place_name")||PLACE_NAME, msg.Option("_street_name"), "我的场所")
|
||||
},
|
||||
myValue: function(can, value) {
|
||||
myValue: function(can, value, PLACE_UID, PLACE_NAME, STREET_NAME) {
|
||||
var USER_PLACE_ROLE = "user_"+PLACE_NAME.replace("_name", "_role")
|
||||
return [
|
||||
{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.TITLE, list: [{text: value[PLACE_NAME]},
|
||||
{text: [can.user.transValue(can, value, PLACE_NAME.replace("_name", "_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, 6)}, {text: can.base.TimeTrim(value.created_at)},
|
||||
{text: value.city_name}, {text: value.street_name},
|
||||
{text: value.city_name}, {text: value[STREET_NAME]},
|
||||
// {text: value[PLACE_UID].slice(0, 6)}, {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)
|
||||
myPortal: function(can, msg, PLACE_UID, PLACE_NAME, STREET_NAME, title) { can.user.isMobile && can.isCmdMode() && can.onappend.style(can, html.OUTPUT)
|
||||
var PLACE_TYPE = PLACE_NAME.replace("_name", "_type")
|
||||
can.isCmdMode() && (can.db.hash = can.misc.SearchHash(can))
|
||||
can.sup.current = can.sup.current||{}
|
||||
@ -23,16 +24,15 @@ Volcanos(chat.ONIMPORT, {
|
||||
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) {
|
||||
can.page.Append(can, can.ui.myplace, [{view: html.TITLE, list: [{text: can.user.trans(can, "My "+can.base.capital(PLACE_NAME.replace("_name", "")), title)}], _init: function(target) {
|
||||
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)
|
||||
}}])
|
||||
}}])
|
||||
debugger
|
||||
msg.Table(function(value) { var key = "_trans.value."+PLACE_NAME.replace("_name", "_type")+".icons."
|
||||
msg.Push(mdb.ICONS, can.Conf(key+value[PLACE_TYPE])||can.Conf(key+"office"))
|
||||
})
|
||||
var uid = can.onimport.myPlace(can, msg, can.ui.myplace, PLACE_UID, PLACE_NAME)
|
||||
var uid = can.onimport.myPlace(can, msg, can.ui.myplace, PLACE_UID, PLACE_NAME, STREET_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 < 1; i++) { can.onimport.myIndex(can, msg, can.ui.myindex, PLACE_UID) }
|
||||
@ -43,12 +43,12 @@ Volcanos(chat.ONIMPORT, {
|
||||
can.onimport.myData(can, msg, can._output, PLACE_UID, PLACE_NAME)
|
||||
}
|
||||
},
|
||||
myPlace: function(can, msg, target, PLACE_UID, PLACE_NAME) { var place_uid
|
||||
myPlace: function(can, msg, target, PLACE_UID, PLACE_NAME, STREET_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]), can.sup.current = value)
|
||||
value._uid = value[PLACE_UID]
|
||||
return can.onimport.itemcard(can, value, can.onimport.myValue(can, value), function(event) {
|
||||
return can.onimport.itemcard(can, value, can.onimport.myValue(can, value, PLACE_UID, PLACE_NAME, STREET_NAME), 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)
|
||||
|
@ -14,8 +14,6 @@
|
||||
"reject": "驳回",
|
||||
"approve": "通过",
|
||||
"icons": {
|
||||
"scanQRCode": "bi bi-qr-code-scan",
|
||||
"placeCreate": "bi bi-plus-square-dotted",
|
||||
"qrcode": "https://img.icons8.com/officel/80/qr-code.png",
|
||||
"apply": "https://img.icons8.com/officel/80/edit-property.png",
|
||||
"order": "https://img.icons8.com/officel/80/receipt-approved.png",
|
||||
|
@ -2,25 +2,17 @@ package gonganxitong
|
||||
|
||||
import (
|
||||
"shylinux.com/x/ice"
|
||||
kit "shylinux.com/x/toolkits"
|
||||
|
||||
"shylinux.com/x/community/src/gonganxitong/model"
|
||||
)
|
||||
|
||||
type qrcode struct {
|
||||
portal portal
|
||||
userPlace userPlace
|
||||
list string `name:"list place_uid auto" role:"void"`
|
||||
}
|
||||
type qrcode struct{ Tables }
|
||||
|
||||
func (s qrcode) Init(m *ice.Message, arg ...string) {
|
||||
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()
|
||||
kit.For([]string{model.CITY_NAME, model.STREET_NAME, model.PLACE_NAME, model.PLACE_ADDRESS}, func(key string) { m.Push(key, msg.Append(key)) })
|
||||
m.EchoQRCode(s.portal.Link(m, arg[0], m.Prefix("apply")))
|
||||
m.Cmdy(s.UserPlace, m.Option(model.USER_UID), arg[0]).Cut(model.CITY_NAME, s.Keys(s.Street, model.NAME), s.Keys(s.Place, model.NAME))
|
||||
m.EchoQRCode(s.Link(m, arg[0]))
|
||||
}
|
||||
|
||||
func init() { ice.TeamCtxCmd(qrcode{}) }
|
||||
func init() {
|
||||
ice.TeamCtxCmd(qrcode{Tables: Tables{Table: Table{UserPlace: userPlace{}, Place: place{}, Street: street{}}}})
|
||||
}
|
||||
|
@ -29,11 +29,11 @@ func (s user) Create(m *ice.Message, arg ...string) {
|
||||
func (s user) Email(m *ice.Message, arg ...string) {
|
||||
s.Table.Update(m, kit.Dict(m.OptionSimple(model.EMAIL)), model.UID, m.Option(model.USER_UID))
|
||||
}
|
||||
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),
|
||||
func (s user) SendTemplate(m *ice.Message, arg ...string) { // from uid url type name hash
|
||||
msg := s.Select(m, model.UID, arg[1])
|
||||
m.Cmdy("web.chat.wx.template", "", m.Config("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(m.Option(ice.MSG_USERNICK), arg, 0),
|
||||
)
|
||||
}
|
||||
|
||||
|
@ -14,12 +14,16 @@ type userPlace struct {
|
||||
}
|
||||
|
||||
func (s userPlace) List(m *ice.Message, arg ...string) {
|
||||
s.Tables(m, s.place, s.street, s.city).Fields(m,
|
||||
s.Key(s, model.CREATED_AT),
|
||||
s.Tables(m, s.place, s.street, s.city).FieldsWithCreatedAT(m, s,
|
||||
model.PLACE_NAME, model.PLACE_TYPE, model.USER_PLACE_ROLE,
|
||||
model.CITY_NAME, model.STREET_NAME, model.PLACE_ADDRESS,
|
||||
model.USER_UID, model.PLACE_UID,
|
||||
).Orders(m, s.Desc(model.CREATED_AT)).Select(m, model.USER_UID, arg[0])
|
||||
model.PLACE_UID,
|
||||
)
|
||||
if len(arg) == 1 {
|
||||
s.Select(m, model.USER_UID, arg[0])
|
||||
} else if len(arg) == 2 {
|
||||
s.Select(m.FieldsSetDetail(), model.USER_UID, arg[0], model.PLACE_UID, arg[1])
|
||||
}
|
||||
s.RewriteAppend(m)
|
||||
}
|
||||
|
||||
@ -33,18 +37,18 @@ type UserPlaceRole int
|
||||
|
||||
const (
|
||||
UserPlaceCreator UserPlaceRole = iota
|
||||
UserPlaceVisitor
|
||||
UserPlaceLandlord
|
||||
UserPlaceTenant
|
||||
UserPlaceAdmin
|
||||
UserPlaceVisitor
|
||||
)
|
||||
|
||||
var UserPlaceRoleList = map[UserPlaceRole]string{
|
||||
UserPlaceCreator: "creator",
|
||||
UserPlaceVisitor: "visitor",
|
||||
UserPlaceLandlord: "landlord",
|
||||
UserPlaceTenant: "tenant",
|
||||
UserPlaceAdmin: "admin",
|
||||
UserPlaceVisitor: "visitor",
|
||||
}
|
||||
|
||||
func (s UserPlaceRole) String() string { return UserPlaceRoleList[s] }
|
||||
|
@ -7,13 +7,13 @@
|
||||
"name": "申请单",
|
||||
"order": "2",
|
||||
"role": "visitor,tenant",
|
||||
"time": "2024-08-02 17:16:31.610"
|
||||
"time": "2024-08-04 01:26:56.140"
|
||||
}
|
||||
},
|
||||
"3c12d065a7b2fb9a8a09f47d87bd5bef": {
|
||||
"meta": {
|
||||
"index": "web.team.gonganxitong.express.express",
|
||||
"time": "2024-08-02 22:10:41.621"
|
||||
"time": "2024-08-03 19:43:29.173"
|
||||
}
|
||||
},
|
||||
"58724bdcc3cae3e26700cb3199e0602c": {
|
||||
@ -22,15 +22,9 @@
|
||||
"icons": "https://img.icons8.com/officel/80/person-at-home.png",
|
||||
"index": "web.team.gonganxitong.placeUser",
|
||||
"name": "场所用户",
|
||||
"order": "4",
|
||||
"order": "6",
|
||||
"role": "creator,landlord",
|
||||
"time": "2024-08-02 17:16:31.610"
|
||||
}
|
||||
},
|
||||
"6154e70009651fcae3e9be1b53580db1": {
|
||||
"meta": {
|
||||
"index": "web.team.express.express",
|
||||
"time": "2024-08-02 13:22:54.776"
|
||||
"time": "2024-08-04 01:26:32.086"
|
||||
}
|
||||
},
|
||||
"91dd0e9590d3021944f14f3ec8653beb": {
|
||||
@ -41,7 +35,7 @@
|
||||
"name": "审批单",
|
||||
"order": "3",
|
||||
"role": "creator,landlord",
|
||||
"time": "2024-08-02 17:07:48.171"
|
||||
"time": "2024-08-04 00:20:22.265"
|
||||
}
|
||||
},
|
||||
"ad574b9493741774ef8cb3fd5efd8026": {
|
||||
@ -56,12 +50,13 @@
|
||||
},
|
||||
"bdec92d5849b2a60a8811cff494f2391": {
|
||||
"meta": {
|
||||
"enable": "false",
|
||||
"enable": "true",
|
||||
"icons": "https://img.icons8.com/officel/80/property-with-timer.png",
|
||||
"index": "web.team.gonganxitong.event",
|
||||
"name": "事件流",
|
||||
"order": "4",
|
||||
"role": "creator",
|
||||
"time": "2024-08-02 17:16:31.613"
|
||||
"time": "2024-08-04 01:26:32.087"
|
||||
}
|
||||
},
|
||||
"e2117b53c036a72fe7e4885449488a6f": {
|
||||
@ -71,7 +66,7 @@
|
||||
"index": "web.team.gonganxitong.qrcode",
|
||||
"name": "场所码",
|
||||
"order": "1",
|
||||
"time": "2024-08-02 16:32:26.372"
|
||||
"time": "2024-08-04 00:43:23.253"
|
||||
}
|
||||
},
|
||||
"fd86aad80a667152781bb188fb1249a2": {
|
||||
@ -81,7 +76,7 @@
|
||||
"index": "web.team.gonganxitong.email",
|
||||
"name": "邮箱配置",
|
||||
"role": "creator",
|
||||
"time": "2024-08-02 17:16:31.613"
|
||||
"time": "2024-08-04 00:45:57.464"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user