This commit is contained in:
jingganjiaoyu 2024-09-01 23:44:29 +08:00
parent 54130a5be2
commit b841e63f13
54 changed files with 727 additions and 534 deletions

View File

@ -10,31 +10,33 @@ import (
type allow struct {
Table
user user
event event
apply apply
order string `data:"93"`
event event
portal Portal
order string `data:"92"`
role string `data:"creator"`
create string `name:"create user_uid* apply_uid* status*"`
create string `name:"create apply_uid* place_uid* user_uid* status*"`
reject string `name:"reject" role:"void"`
approve string `name:"approve" role:"void"`
}
func (s allow) Create(m *ice.Message, arg ...string) {
s.Table.Create(m, arg...)
m.Options(m.Cmd(s.Prefix(m, s.portal), s.portal.SelectCommand, m.PrefixKey()).AppendSimple(model.COMMAND_UID))
s.SendMessage(m, m.Option(model.FROM_USER_UID), m.Option(model.USER_UID))
s.sendTemplate(m, m.Trans("role order create", "权限审批 请处理"))
s.sendTemplate(m, m.Trans("please process role allow", "请处理 权限审批"))
}
func (s allow) List(m *ice.Message, arg ...string) {
s.Tables(m, s.apply, "left join users on applies.user_uid = users.uid").FieldsWithCreatedAT(m, s.apply,
model.USER_AVATAR, model.USER_NAME,
model.PLACE_UID, s.AS(s.Key(s.apply, model.ROLE), s.Keys(s.UserPlace, model.ROLE)), model.ALLOW_STATUS,
s.Key(s, model.PLACE_UID), s.AS(s.Key(s.apply, model.ROLE), s.Keys(s.UserPlace, model.ROLE)), model.ALLOW_STATUS,
model.BEGIN_TIME, model.END_TIME, s.AS(s.Key(s, model.UID), model.ALLOW_UID),
)
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.ALLOW_STATUS, model.CREATED_AT), []string{AllowCreate.String(), AllowApproved.String(), AllowRejected.String()}, ice.STR_R)
s.Table.Select(m, s.Key(s, model.USER_UID), m.Option(model.USER_UID), s.Key(s, model.PLACE_UID), arg[0])
kit.If(m.Length() == 0, func() { m.Echo(m.Trans("wait apply", "等待申请")) })
} else if len(arg) == 2 {
s.Table.SelectDetail(m, s.Key(s, model.USER_UID), m.Option(model.USER_UID), model.PLACE_UID, arg[0], s.Key(s.apply, model.UID), arg[1])
s.Table.SelectDetail(m, s.Key(s, model.USER_UID), m.Option(model.USER_UID), s.Key(s, model.PLACE_UID), arg[0], s.Key(s.apply, model.UID), arg[1])
} else {
return
}
@ -43,27 +45,26 @@ func (s allow) List(m *ice.Message, arg ...string) {
if AllowStatus(kit.Int(value[model.ALLOW_STATUS])) == AllowCreate {
m.PushButton(s.Reject, s.Approve)
} else {
s.DoneMessage(m)
m.PushButton()
s.DoneMessage(m)
}
}).Action()
s.DisplayBase(m, "")
}
func (s allow) Reject(m *ice.Message, arg ...string) {
s.process(m, AllowCreate, AllowRejected, m.Trans("role order rejected", "权限审批 已驳回"))
s.process(m, AllowCreate, AllowRejected, "❌", m.Trans("rejected role allow", "已驳回 权限审批"))
}
func (s allow) Approve(m *ice.Message, arg ...string) {
s.process(m, AllowCreate, AllowApproved, m.Trans("role allow approved", "权限审批 已通过"))
s.process(m, AllowCreate, AllowApproved, "✅", m.Trans("approved role allow", "已通过 权限审批"))
}
func (s allow) process(m *ice.Message, from, to AllowStatus, title string) {
func (s allow) process(m *ice.Message, from, to AllowStatus, icon string, title string) {
defer m.ToastProcess()()
if s.changeStatus(m, from, to); m.IsErr() {
return
}
m.Cmdy(m.Prefix("apply"), m.ActionKey(), m.Option(model.UID)).ProcessRefresh()
s.RecordEvent(m, "", kit.JoinWord("✅", title, kit.Cut(m.Option(model.UID), 6), s.TransRole(m), m.Option(model.USER_NAME)), m.Option(model.UID))
m.Cmdy(s.Prefix(m, s.apply), m.ActionKey(), m.Option(model.UID)).ProcessRefresh()
s.RecordEvent(m, kit.JoinWord(icon, title, kit.Cut(m.Option(model.UID), 6), s.TransRole(m), m.Option(model.USER_NAME)), m.Option(model.UID))
s.DoneMessage(m)
// s.sendTemplate(m, title)
}
func init() { ice.TeamCtxCmd(allow{Table: newTable()}) }

View File

@ -3,10 +3,8 @@ Volcanos(chat.ONIMPORT, {
var PLACE_NAME = msg.Option("_place_name"), PLACE_TYPE = msg.Option("_place_type")
var USER_PLACE_ROLE = msg.Option("_user_place_role"), STREET_NAME = msg.Option("_street_name"), ALLOW_STATUS = "allow_status"
can.onimport.itemcards(can, msg, function(value) { var status = value[ALLOW_STATUS]; return [
{view: html.TITLE, list: [value.user_name, can.onimport.textView(can, value, USER_PLACE_ROLE, aaa.ROLE)]},
{view: html.STATUS, list: [value.uid.slice(0, 6), can.base.TimeTrim(value.created_at),
{text: [can.user.transValue(can, value, ALLOW_STATUS)+" "+(status == "create" || status == "submit"? "🕑": status == "rejected"? "❌": "✅"), "", mdb.STATUS]},
]},
{view: html.TITLE, list: [value.user_name, can.onimport.textView(can, value, USER_PLACE_ROLE)]},
{view: html.STATUS, list: [value.uid.slice(0, 6), can.base.TimeTrim(value.created_at), can.onimport.textView(can, value, ALLOW_STATUS)]},
{view: html.STATUS, list: [value.begin_time.split(" ")[0], value.end_time.split(" ")[0]]},
{view: html.STATUS, list: [value.city_name, value[STREET_NAME]]},
] })

View File

@ -11,7 +11,8 @@ type apply struct {
Table
user user
event event
order string `data:"92"`
portal Portal
order string `data:"91"`
role string `data:"creator"`
create string `name:"create user_place_role*:select begin_time:select@date end_time:select@date" role:"void"`
cancel string `name:"cancel" role:"void"`
@ -42,12 +43,12 @@ func (s apply) List(m *ice.Message, arg ...string) {
)
if len(arg) == 1 {
s.Table.Select(m, model.USER_UID, m.Option(model.USER_UID), model.PLACE_UID, arg[0])
kit.If(m.Length() == 0, func() { m.EchoInfoButton("", s.Create) })
kit.If(m.Length() == 0, func() { m.EchoInfoButton("") })
} else if len(arg) == 2 {
s.Table.SelectDetail(m, model.USER_UID, m.Option(model.USER_UID), model.PLACE_UID, arg[0], s.Key(s, model.UID), arg[1])
switch ApplyStatus(kit.Int(m.Append(model.APPLY_STATUS))) {
case ApplySubmit:
m.EchoQRCode(Portal{}.Link(m, arg[0], ice.GetTypeKey(allow{}), arg[1]))
m.EchoQRCode(s.portal.Link(m, arg[0], ice.GetTypeKey(allow{}), arg[1]))
case ApplyRejected, ApplyApproved:
s.DoneMessage(m)
}
@ -85,18 +86,18 @@ func (s apply) Submit(m *ice.Message, arg ...string) {
return
}
m.Option(model.FROM_USER_UID, m.Option(model.USER_UID))
m.Cmd(m.Prefix("allow"), s.Create, msg.AppendSimple(model.USER_UID), model.APPLY_UID, m.Option(model.UID), model.STATUS, AllowCreate)
s.RecordEvent(m, "", kit.Format("🕑 %s"+m.Trans(" apply submit", "权限申请提交"), s.TransRole(m)), m.Option(model.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)), msg.AppendSimple(model.USER_UID), model.STATUS, AllowCreate)
s.RecordEvent(m, kit.JoinWord("🕑", m.Trans("apply submit", "已提交 权限申请"), kit.Cut(m.Option(model.UID), 6), s.TransRole(m), m.Option(model.USER_NAME)), m.Option(model.UID))
s.SendMessage(m, msg.Append(model.USER_UID), m.Option(model.USER_UID))
}
func (s apply) Reject(m *ice.Message, arg ...string) {
msg := s.changeStatus(m, ApplySubmit, ApplyRejected)
s.sendTemplate(msg, m.Trans("role apply rejected", "权限申请 已驳回"))
s.sendTemplate(msg, m.Trans("rejected role apply", "已驳回 权限申请"))
}
func (s apply) Approve(m *ice.Message, arg ...string) {
msg := s.changeStatus(m, ApplySubmit, ApplyApproved)
m.Cmd(s.UserPlace, s.Create, msg.AppendSimple(model.USER_UID, model.ROLE), s.Keys(s.Place, model.UID), msg.Append(model.PLACE_UID))
s.sendTemplate(msg, m.Trans("role apply approved", "权限申请 已通过"))
s.sendTemplate(msg, m.Trans("approved role apply", "已通过 权限申请"))
}
func init() { ice.TeamCtxCmd(apply{Table: newTable()}) }

View File

@ -3,10 +3,8 @@ Volcanos(chat.ONIMPORT, {
var PLACE_NAME = msg.Option("_place_name"), PLACE_TYPE = msg.Option("_place_type")
var USER_PLACE_ROLE = msg.Option("_user_place_role"), STREET_NAME = msg.Option("_street_name"), APPLY_STATUS = "apply_status"
can.onimport.itemcards(can, msg, function(value) { var status = value[APPLY_STATUS]; return [
{view: html.TITLE, list: [value[PLACE_NAME], can.onimport.textView(can, value, PLACE_TYPE, mdb.TYPE), can.onimport.textView(can, value, USER_PLACE_ROLE, aaa.ROLE)]},
{view: html.STATUS, list: [value.uid.slice(0, 6), can.base.TimeTrim(value.created_at),
{text: [can.user.transValue(can, value, APPLY_STATUS)+" "+(status == "create" || status == "submit"? "🕑": status == "rejected"? "❌": "✅"), "", mdb.STATUS]},
]},
{view: html.TITLE, list: [value[PLACE_NAME], can.onimport.textView(can, value, PLACE_TYPE), can.onimport.textView(can, value, USER_PLACE_ROLE)]},
{view: html.STATUS, list: [value.uid.slice(0, 6), can.base.TimeTrim(value.created_at), can.onimport.textView(can,value, APPLY_STATUS)]},
{view: html.STATUS, list: [value.begin_time.split(" ")[0], value.end_time.split(" ")[0]]},
{view: html.STATUS, list: [value.city_name, value[STREET_NAME]]},
] })

View File

@ -8,8 +8,6 @@ import (
type city struct{ Table }
func init() { ice.TeamCtxCmd(city{}) }
func (s city) FindOrCreateByName(m *ice.Message, arg ...string) {
if msg := m.Cmd(s, s.Select, model.NAME, arg[1]); msg.Length() == 0 {
msg := m.Cmd(s, s.Create, model.NAME, arg[1])
@ -18,3 +16,5 @@ func (s city) FindOrCreateByName(m *ice.Message, arg ...string) {
arg[0], arg[1] = model.CITY_UID, msg.Append(model.UID)
}
}
func init() { ice.TeamCtxCmd(city{}) }

View File

@ -0,0 +1,24 @@
package gonganxitong
import (
"shylinux.com/x/ice"
kit "shylinux.com/x/toolkits"
"shylinux.com/x/community/src/gonganxitong/model"
)
type command struct {
Table
update string `name:"update service_uid icon name index"`
}
func (s command) Update(m *ice.Message, arg ...string) {
uid := kit.Hashs(m.Option(model.SERVICE_UID), m.Option(model.INDEX))
if s.Table.Select(m.Spawn(), model.UID, uid).Length() == 0 {
s.Table.Create(m, kit.Simple(model.UID, uid, m.OptionSimple(model.SERVICE_UID, model.INDEX))...)
}
s.Table.Update(m, kit.Dict(arg), model.UID, uid)
m.SetResult().Echo(uid)
}
func init() { ice.TeamCtxCmd(command{}) }

View File

@ -7,6 +7,7 @@ import (
"shylinux.com/x/ice"
icebergs "shylinux.com/x/icebergs"
"shylinux.com/x/icebergs/base/aaa"
"shylinux.com/x/icebergs/base/ctx"
"shylinux.com/x/icebergs/base/mdb"
"shylinux.com/x/icebergs/base/web"
@ -40,13 +41,8 @@ type Table struct {
list string `name:"list place_uid uid auto" role:"void"`
}
func (s Table) Init(m *ice.Message, arg ...string) {
s.Table.Init(m, arg...).GoSleep("3s", func() {
func (s Table) AfterMigrate(m *ice.Message, arg ...string) {
kit.If(m.GetCommand().Icon, func() { Portal{}.Show(m) })
})
}
func (s Table) Exit(m *ice.Message, arg ...string) {
s.Table.Exit(m, arg...)
}
func (s Table) Inputs(m *ice.Message, arg ...string) {
switch arg[0] {
@ -54,8 +50,6 @@ func (s Table) Inputs(m *ice.Message, arg ...string) {
s.InputsListRole(m, UserPlaceRoleList, arg...)
case model.PLACE_TYPE:
s.InputsList(m, PlaceTypeList, arg...)
case ctx.INDEX:
mdb.HashInputs(m.Message, arg)
default:
s.Table.Inputs(m, arg...)
}
@ -93,7 +87,7 @@ func (s Table) Create(m *ice.Message, arg ...string) {
s.Table.Create(m, arg...)
s.UserPlaceInit(m)
}
func (s Table) List(m *ice.Message, arg ...string) {
func (s Table) List(m *ice.Message, arg ...string) *ice.Message {
if m.IsTech() {
if len(arg) == 0 {
s.Select(m)
@ -101,24 +95,7 @@ func (s Table) List(m *ice.Message, arg ...string) {
s.SelectDetail(m, model.UID, arg[1])
}
}
}
func (s Table) TablesWithRole(m *ice.Message, arg []string, userPlace UserPlacer, place Placer, target Placer, fields ...ice.Any) *ice.Message {
s.Tables(m, kit.JoinWord("INNER JOIN", s.TableName(kit.TypeName(userPlace)),
"ON", s.Key(target, model.USER_UID), "=", s.Key(userPlace, model.USER_UID),
"AND", s.Key(target, s.Keys(place, model.UID)), "=", s.Key(userPlace, s.Keys(place, model.UID)),
"AND", s.Key(userPlace, model.DELETED_AT), "IS NULL",
)).FieldsWithCreatedAT(m, target, append([]ice.Any{s.Key(target, model.USER_UID), s.AS(s.Key(userPlace, model.ROLE), s.Keys(userPlace, model.ROLE))}, fields...)...)
if len(arg) == 1 {
s.Table.Select(m, s.Key(target, s.Keys(place, model.UID)), arg[0])
} else if len(arg) == 2 {
s.Table.SelectDetail(m, s.Key(target, s.Keys(place, model.UID)), arg[0], s.Key(target, model.UID), arg[1])
} else {
return m
}
return s.SelectJoinUser(m)
}
func (s Table) UpdateAuth(m *ice.Message, arg ...string) {
s.Update(m, kit.Dict(model.AUTH_UID, arg[0]), arg[1:]...)
}
func (s Table) Select(m *ice.Message, arg ...string) *ice.Message {
s.Table.Select(m, arg...)
@ -128,15 +105,20 @@ func (s Table) Select(m *ice.Message, arg ...string) *ice.Message {
func (s Table) SelectDetail(m *ice.Message, arg ...string) *ice.Message {
return s.Table.SelectDetail(m, arg...)
}
func (s Table) SelectJoinAuth(m *ice.Message) *ice.Message {
return s.SelectJoin(m, "web.team.renzhengshouquan.auth", model.STATUS)
}
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) SelectJoinAuth(m *ice.Message) *ice.Message {
if ice.Info.NodeName == "20240724-community" {
return s.SelectJoin(m, "web.team.renzhengshouquan.auth", model.STATUS)
} else {
defer m.Options(ice.MSG_USERROLE, aaa.TECH).Options(ice.MSG_USERROLE, aaa.VOID)
return s.SelectJoin(m, []string{web.SPACE, "ops.20240724-community", "web.team.renzhengshouquan.auth"}, model.STATUS)
}
}
func (s Table) RenameAppend(m *ice.Message, arg ...string) Table {
m.RenameAppend(arg...)
return s
@ -162,20 +144,27 @@ func (s Table) RewriteAppend(m *ice.Message, arg ...string) *ice.Message {
})
return m
}
func (s Table) CheckRole(m *ice.Message, arg ...string) {
m.ErrorNotImplement()
}
func (s Table) TransValue(m *ice.Message, key string, arg ...string) string {
if value := kit.Select(m.Option(key), arg, 0); m.IsEnglish() {
return value
func (s Table) TablesWithRole(m *ice.Message, arg []string, userPlace UserPlacer, place Placer, target Placer, fields ...ice.Any) *ice.Message {
s.Tables(m, kit.JoinWord("INNER JOIN", s.TableName(kit.TypeName(userPlace)),
"ON", s.Key(target, model.USER_UID), "=", s.Key(userPlace, model.USER_UID),
"AND", s.Key(target, s.Keys(place, model.UID)), "=", s.Key(userPlace, s.Keys(place, model.UID)),
"AND", s.Key(userPlace, model.DELETED_AT), "IS NULL",
)).FieldsWithCreatedAT(m, target, append([]ice.Any{s.Key(target, model.USER_UID), s.AS(s.Key(userPlace, model.ROLE), s.Keys(userPlace, model.ROLE))}, fields...)...)
if len(arg) == 1 {
s.Table.Select(m, s.Key(target, s.Keys(place, model.UID)), arg[0])
} else if len(arg) == 2 {
s.Table.SelectDetail(m, s.Key(target, s.Keys(place, model.UID)), arg[0], s.Key(target, model.UID), arg[1])
} else {
return kit.Select(value, kit.Value(m.Target().Commands[m.CommandKey()].Meta, "_trans.value."+key+"."+value))
return m
}
return s.SelectJoinUser(m)
}
func (s Table) TransRole(m *ice.Message, arg ...string) string {
value := kit.Select(m.Option(s.Keys(s.UserPlace, model.ROLE)), arg, 0)
role := s.Place.TransValue(m, s.Keys(s.UserPlace, model.ROLE), arg...)
return kit.Format(`<span class="role %s">%s</span>`, value, role)
func (s Table) Update(m *ice.Message, data ice.Map, arg ...string) {
data[model.OPERATOR] = m.Option(model.USER_UID)
s.Table.Update(m, data, arg...)
}
func (s Table) UpdateAuth(m *ice.Message, arg ...string) {
s.Update(m, kit.Dict(model.AUTH_UID, arg[0]), arg[1:]...)
}
func (s Table) ChangeStatus(m *ice.Message, uid string, from, to int, arg ...string) *ice.Message {
msg := s.Select(m.Spawn(), model.UID, uid)
@ -184,41 +173,41 @@ func (s Table) ChangeStatus(m *ice.Message, uid string, from, to int, arg ...str
}
return m
}
func (s Table) UserPlaceRole(m *ice.Message) int {
return kit.Int(m.Cmdx(s.Prefix(m, Portal{}), "userPlaceRole"))
}
func (s Table) CheckRole(m *ice.Message, arg ...string) {
m.ErrorNotImplement()
}
func (s Table) UserPlaceInit(m *ice.Message, arg ...string) {
if m.Option("place_init") == "" {
if m.Option(model.PLACE_INIT) == "" {
return
}
m.Cmd(m.Prefix("portal"), "placeCmd", "addCount", model.INIT, 1, m.Option("place_uid"), m.Option("place_init"))
m.Cmd(s.Prefix(m, Portal{}), "placeCmd", "addCount", model.INIT, 1, m.Option(model.PLACE_UID), m.Option(model.PLACE_INIT))
}
func (s Table) Update(m *ice.Message, data ice.Map, arg ...string) {
data[model.OPERATOR] = m.Option(model.USER_UID)
s.Table.Update(m, data, arg...)
func (s Table) RecordEvent(m *ice.Message, info string, arg ...string) {
m.Cmd(s.Prefix(m, Portal{}), s.RecordEvent, info, arg)
}
func (s Table) RecordEvent(m *ice.Message, place_uid, info string, arg ...string) {
event{}.Record(m.Spawn(kit.Dict(model.PLACE_UID, place_uid)), info, arg...)
}
func (s Table) RecordEventWithName(m *ice.Message, place_uid, info string, arg ...string) {
func (s Table) RecordEventWithName(m *ice.Message, info string, arg ...string) {
uid := kit.Select(m.Result(), m.Option(model.UID))
kit.If(info == "", func() {
info = m.ActionCmdTitle()
switch m.ActionKey() {
case mdb.CREATE, "placeCreate":
switch info = m.ActionCmdTitle(); m.ActionKey() {
case "placeCreate", mdb.CREATE:
info = "✅ " + info
case mdb.REMOVE, "placeRemove":
case "placeRemove", mdb.REMOVE:
info = "❌ " + info
case "placeAuth":
info = "🕑 " + info
}
})
s.RecordEvent(m, place_uid, kit.JoinWord(info, kit.Cut(uid, 6), kit.Select(m.Option(model.TITLE), m.Option(model.NAME))), uid)
s.RecordEvent(m, kit.JoinWord(info, kit.Cut(uid, 6), kit.Select(m.Option(model.TITLE), m.Option(model.NAME))), uid)
}
func (s Table) AddRecent(m *ice.Message, arg ...string) {
cmd := m.GetCommand()
m.Cmd(recent{}, s.Create, mdb.NAME, cmd.Help+" "+ice.Info.Title(), mdb.ICON, m.Resource(kit.Select(ice.Info.NodeIcon, cmd.Icon)), web.SPACE, m.Option(ice.MSG_USERPOD), ctx.INDEX, m.PrefixKey(), ctx.ARGS, kit.Join(arg))
func (s Table) GetCommands(m *ice.Message, key string, arg ...string) []string {
kit.If(len(arg) == 0, func() { arg = append(arg, m.Option(s.Keys(s.Place, model.UID)), m.Option(model.UID)) })
return kit.Simple(m.OptionSimple(key), ctx.ARGS, kit.Join(arg), m.OptionSimple(model.CITY_NAME, model.STREET_NAME, model.PLACE_NAME))
}
func (s Table) SendMessage(m *ice.Message, from_user_uid, to_user_uid string, arg ...string) {
cmd := m.GetCommand()
kit.If(len(arg) == 0, func() { arg = append(arg, m.Option(s.Keys(s.Place, model.UID)), m.Option(model.UID)) })
m.Spawn(ice.Maps{db.DB: ""}).Cmd(message{}, s.Create, model.FROM_USER_UID, from_user_uid, model.TO_USER_UID, to_user_uid, model.PLACE_NAME, m.Option(model.PLACE_NAME),
mdb.NAME, cmd.Help, mdb.ICON, cmd.Icon, web.SPACE, m.Option(ice.MSG_USERPOD), ctx.INDEX, m.PrefixKey(), ctx.ARGS, kit.Join(arg))
m.Spawn(ice.Maps{db.DB: ""}).Cmd(message{}, s.Create, model.FROM_USER_UID, from_user_uid, model.TO_USER_UID, to_user_uid, s.GetCommands(m, model.COMMAND_UID, arg...))
}
func (s Table) DoneMessage(m *ice.Message, arg ...string) {
if m.Option(model.MESSAGE_UID) != "" {
@ -268,6 +257,32 @@ func (s Table) Display(m *ice.Message, file string) *ice.Message {
return file
})))
}
func (s Table) TransValue(m *ice.Message, key string, arg ...string) string {
if value := kit.Select(m.Option(key), arg, 0); m.IsEnglish() {
return value
} else {
return kit.Select(value, kit.Value(m.Target().Commands[m.CommandKey()].Meta, "_trans.value."+key+"."+value))
}
}
func (s Table) TransRole(m *ice.Message, arg ...string) string {
value := kit.Select(m.Option(s.Keys(s.UserPlace, model.ROLE)), arg, 0)
role := s.Place.TransValue(m, s.Keys(s.UserPlace, model.ROLE), arg...)
return kit.Format(`<span class="role %s">%s</span>`, value, role)
}
func (s Table) Prefix(m *ice.Message, target ice.Any) string {
return m.Prefix(kit.TypeName(target))
}
func (s Table) PrefixPortal(m *ice.Message) string {
return m.Prefix(kit.TypeName(Portal{}))
}
func (s Table) SpaceCmd(m *ice.Message, space string, arg ...ice.Any) *ice.Message {
if space == ice.Info.NodeName {
return m.Cmd(arg...)
} else {
return m.Cmd(append([]ice.Any{web.SPACE, kit.Keys(ice.OPS, space)}, arg...)...)
}
}
func (s Table) Link(m *ice.Message, arg ...string) string {
return Portal{}.Link(m, arg...)
}
@ -276,12 +291,8 @@ type Tables struct{ Table }
func (s Tables) BeforeMigrate(m *ice.Message, arg ...string) {}
func newTable() Table {
return Table{UserPlace: userPlace{}, Place: place{}, Street: street{}}
}
func newTables() Tables {
return Tables{Table: newTable()}
}
func newTable() Table { return Table{UserPlace: userPlace{}, Place: place{}, Street: street{}} }
func newTables() Tables { return Tables{Table: newTable()} }
func NewTable(userPlace UserPlacer, place Placer, street Container) Table {
return Table{UserPlace: userPlace, Place: place, Street: street}
}
@ -291,9 +302,7 @@ func NewTables(userPlace UserPlacer, place Placer, street Container) Tables {
func NewPortal(userPlace UserPlacer, place Placer, street Container) Portal {
return Portal{Table: Table{UserPlace: userPlace, Place: place, Street: street}}
}
func (s Portal) getTable() Table {
return s.Table
}
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))
@ -315,7 +324,7 @@ func PortalCmd(portal ice.Any) {
cmd("apply", apply{Table: table})
cmd("allow", allow{Table: table})
cmd("member", placeUser{Tables: Tables{Table: table}})
cmd("message", Message{})
cmd("message", message{})
cmd("recent", recent{})
cmd("service", service{Table: table})
cmd("support", support{})

View File

@ -4,7 +4,7 @@ Volcanos(chat.ONIMPORT, {
PLACE_TYPE || can.core.List(msg.append, function(key) { can.base.endWith(key, "_type") && (PLACE_TYPE = key), can.base.endWith(key, "_role") && (USER_PLACE_ROLE = key) })
can.onimport.itemcards(can, msg, function(value) { return [
{view: html.TITLE, list:[value.title||value.name||value.user_name,
can.onimport.textView(can, value, PLACE_TYPE, mdb.TYPE), can.onimport.textView(can, value, USER_PLACE_ROLE, aaa.ROLE),
can.onimport.textView(can, value, PLACE_TYPE), can.onimport.textView(can, value, USER_PLACE_ROLE),
]},
{view: html.STATUS, list: [value.city_name, value.street_name, value.company_name]},
{view: html.STATUS, list: [value.uid && value.uid.slice(0, 6), can.base.TimeTrim(value.created_at||value.updated_at)]},

View File

@ -11,13 +11,17 @@ import (
type event struct {
Table
user user
order string `data:"91"`
command command
service service
order string `data:"93"`
role string `data:"creator"`
}
func (s event) List(m *ice.Message, arg ...string) {
s.Tables(m, s.user).FieldsWithCreatedAT(m, s, model.USER_AVATAR, model.USER_NAME,
ctx.INDEX, model.OPERATE, ctx.ARGS, model.INFO,
s.Tables(m, s.user, s.command, s.service).FieldsWithCreatedAT(m, s,
model.USER_AVATAR, model.USER_NAME, model.INFO,
s.Key(s, model.CITY_NAME), s.Key(s, model.STREET_NAME), s.Key(s, model.PLACE_NAME),
model.SERVICE_NAME,
)
if len(arg) == 1 {
s.Select(m, model.PLACE_UID, arg[0]).Action()
@ -32,5 +36,6 @@ func (s event) List(m *ice.Message, arg ...string) {
func init() { ice.TeamCtxCmd(event{Table: newTable()}) }
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, ","))
m.Cmd(s.Prefix(m, s), s.Create, m.OptionSimple(model.COMMAND_UID, model.PLACE_UID, model.USER_UID), model.INFO, info,
m.OptionSimple(model.CITY_NAME, model.STREET_NAME, model.PLACE_NAME), model.OPERATE, m.ActionKey(), ctx.ARGS, kit.Join(arg, ","))
}

View File

@ -1,8 +1,8 @@
Volcanos(chat.ONIMPORT, {
_init: function(can, msg) { can.onimport.shareTitle(can, msg)
can.onimport.itemcards(can, msg, function(value) { return [
{view: html.TITLE, list: [value.user_name]},
{view: html.STATUS, list: [value.uid.slice(0, 6), can.base.TimeTrim(value.created_at)]},
{view: html.TITLE, list: [value.user_name, can.onimport.timeView(can, value)]},
// {view: html.STATUS, list: [value.city_name, value.street_name, value.service_name]},
{view: html.OUTPUT, list: [value.info]},
] })
},

View File

@ -3,59 +3,84 @@ package gonganxitong
import (
"shylinux.com/x/ice"
"shylinux.com/x/icebergs/base/ctx"
"shylinux.com/x/icebergs/base/web"
"shylinux.com/x/icebergs/base/web/html"
kit "shylinux.com/x/toolkits"
"shylinux.com/x/community/src/gonganxitong/model"
)
type Message struct {
type message struct {
Table
command command
service service
order string `data:"100"`
domain string `data:"gonganxitong"`
read string `name:"read" role:"void"`
done string `name:"done" role:"void"`
sticky string `name:"sticky" role:"void"`
unSticky string `name:"unSticky" role:"void"`
}
func (s Message) Create(m *ice.Message, arg ...string) {
s.Table.Create(m, kit.Simple(arg)...)
}
func (s Message) List(m *ice.Message, arg ...string) {
func (s message) List(m *ice.Message, arg ...string) {
s.Tables(m, s.command, s.service).FieldsWithCreatedAT(m, s,
model.FROM_USER_UID, s.Key(s, model.PLACE_NAME), s.Key(s.command, model.NAME), model.SCORE, model.MESSAGE_STATUS,
s.AS(model.NODENAME, model.SPACE), s.Key(s.command, model.INDEX), model.OPERATE, model.ARGS,
s.Key(s, model.CITY_NAME), s.Key(s, model.STREET_NAME), model.SERVICE_NAME,
)
if len(arg) < 2 {
s.Select(m, model.TO_USER_UID, m.Option(model.USER_UID))
} else if len(arg) == 2 {
msg := s.SelectDetail(m.Spawn(), model.TO_USER_UID, m.Option(model.USER_UID), model.UID, arg[1])
m.ProcessField(msg.Append(ctx.INDEX), kit.Split(msg.Append(ctx.ARGS)))
m.Push(ctx.STYLE, html.OUTPUT)
m.Option("field.option", kit.Format(kit.Dict(model.MESSAGE_UID, arg[1])))
if m.Option(model.MESSAGE_STATUS) == MessageCreate.String() {
s.Update(m, kit.Dict(model.STATUS, MessageRead), kit.Simple(model.TO_USER_UID, m.Option(model.USER_UID), model.UID, arg[1], model.STATUS, MessageCreate)...)
}
s.Orders(m, s.Desc(model.SCORE), s.Desc(model.CREATED_AT))
s.Select(m, model.TO_USER_UID, m.Option(model.USER_UID)).Table(func(value ice.Maps) {
button := []ice.Any{}
if value[model.SCORE] == "0" {
button = append(button, s.Sticky)
} else {
return
button = append(button, s.UnSticky)
}
m.Table(func(value ice.Maps) {
switch MessageStatus(kit.Int(value[model.STATUS])) {
switch MessageStatus(kit.Int(value[model.MESSAGE_STATUS])) {
case MessageCreate:
m.PushButton(s.Read, s.Done)
button = append(button, s.Read)
case MessageRead:
m.PushButton(s.Done)
button = append(button, s.Done)
default:
m.PushButton()
button = append(button, s.Remove)
}
m.PushButton(button...)
}).Action()
m.RenameAppend(model.FROM_USER_UID, model.USER_UID, model.STATUS, model.MESSAGE_STATUS)
m.RenameAppend(model.FROM_USER_UID, model.USER_UID)
s.SelectJoinUser(m)
s.DisplayBase(m, "")
} else if len(arg) == 2 {
msg := s.SelectDetail(m.Spawn(), model.TO_USER_UID, m.Option(model.USER_UID), s.Key(s, model.UID), arg[1])
m.ProcessPodCmd(msg.Append(web.SPACE), msg.Append(ctx.INDEX), kit.Split(msg.Append(ctx.ARGS)))
m.RewriteAppend(func(value, key string, index int) string {
kit.If(key == ctx.STYLE, func() { value = html.OUTPUT })
kit.If(key == web.SPACE, func() { value = m.Appendv("_space")[index] })
return value
})
if m.Append(web.SPACE) != "" {
m.Optionv(ice.FIELD_PREFIX, ctx.ACTION, ctx.RUN, kit.Join(kit.Slice(kit.Split(msg.Append(ctx.INDEX), "."), 0, -1), ".")+".portal", ctx.ACTION, ctx.RUN, msg.Append(ctx.INDEX))
}
m.Option("field.option", kit.Format(kit.Dict(model.MESSAGE_UID, arg[1])))
if m.Option(model.MESSAGE_STATUS) == MessageCreate.String() {
s.update(m.Spawn(kit.Dict(model.UID, arg[1])), kit.Dict(model.STATUS, MessageRead), model.STATUS, MessageCreate)
}
}
}
func (s Message) Read(m *ice.Message, arg ...string) {
s.Table.Update(m, kit.Dict(model.STATUS, MessageRead), kit.Simple(model.TO_USER_UID, m.Option(model.USER_UID), m.OptionSimple(model.UID), model.STATUS, MessageCreate)...)
func (s message) Read(m *ice.Message, arg ...string) {
s.update(m, kit.Dict(model.STATUS, MessageRead), model.STATUS, MessageCreate)
}
func (s Message) Done(m *ice.Message, arg ...string) {
s.Table.Update(m, kit.Dict(model.STATUS, MessageDone), kit.Simple(model.TO_USER_UID, m.Option(model.USER_UID), m.OptionSimple(model.UID), model.STATUS, MessageRead)...)
func (s message) Done(m *ice.Message, arg ...string) {
s.update(m, kit.Dict(model.STATUS, MessageDone), model.STATUS, MessageRead)
}
func (s message) Sticky(m *ice.Message, arg ...string) {
s.update(m, ice.Map{model.SCORE: 100})
}
func (s message) UnSticky(m *ice.Message, arg ...string) {
s.update(m, ice.Map{model.SCORE: 0})
}
func (s message) update(m *ice.Message, data ice.Map, arg ...ice.Any) {
s.Table.Update(m, data, kit.Simple(model.TO_USER_UID, m.Option(model.USER_UID), m.OptionSimple(model.UID), arg)...)
}
type message struct{ Message }
func init() { ice.TeamCtxCmd(message{}) }

View File

@ -1,12 +1,12 @@
Volcanos(chat.ONIMPORT, {
_init: function(can, msg) {
if (msg.IsDetail()) { var value = msg.TableDetail(); msg.Option("_share_title", value.place_name+" "+value.name) }
can.onimport.itemcards(can, msg, function(value) {
value.icons = value.user_avatar||value.icon
var args = can.core.Split(value.args)
can.onimport.itemcards(can, msg, function(value) { var args = can.core.Split(value.args)
value.icons = value.user_avatar||value.icon; if (value.score > 0) { value._style = ["sticky"] }
return [
{view: html.TITLE, list: [value.place_name, value.name, (args[1]||"").slice(0, 6), value.message_status != "done" && can.onimport.textView(can, value, "message_status", mdb.STATUS)]},
{view: html.STATUS, list: [value.uid.slice(0, 6), can.base.TimeTrim(value.created_at), value.user_name]},
{view: html.STATUS, list: [value.city_name, value.street_name, value.service_name]},
{view: html.STATUS, list: [can.base.TimeTrim(value.created_at), value.user_name]},
value.info && {view: html.OUTPUT, list: [value.info]},
]
}, function(event, value) { var args = can.core.Split(value.args)[1]||""

View File

@ -12,12 +12,11 @@ const (
STATUS = "status"
TITLE = "title"
CONTENT = "content"
OPERATOR = "operator"
CREATOR = "creator"
OPERATOR = "operator"
CREATED_AT = "created_at"
UPDATED_AT = "updated_at"
DELETED_AT = "deleted_at"
OPEN_ID = "open_id"
USER_UID = "user_uid"
USER_NAME = "user_name"
USER_AVATAR = "user_avatar"
@ -25,6 +24,7 @@ const (
PLACE_UID = "place_uid"
PLACE_NAME = "place_name"
PLACE_TYPE = "place_type"
PLACE_INIT = "place_init"
PLACE_ADDRESS = "place_address"
STREET_UID = "street_uid"
STREET_NAME = "street_name"
@ -32,45 +32,55 @@ const (
CITY_UID = "city_uid"
CITY_NAME = "city_name"
AUTH_UID = "auth_uid"
AUTH_TYPE = "auth_type"
AUTH_NAME = "auth_name"
AUTH_TYPE = "auth_type"
AUTH_STATUS = "auth_status"
EVENT_UID = "event_uid"
QRCODE_TYPE = "qrcode_type"
APPLY_UID = "apply_uid"
APPLY_STATUS = "apply_status"
FROM_UID = "from_uid"
ALLOW_UID = "allow_uid"
ALLOW_STATUS = "allow_status"
EVENT_UID = "event_uid"
COMMAND_UID = "command_uid"
MESSAGE_UID = "message_uid"
SERVICE_TYPE = "service_type"
MESSAGE_STATUS = "message_status"
SERVICE_UID = "service_uid"
SERVICE_ICON = "service_icon"
SERVICE_NAME = "service_name"
SERVICE_TYPE = "service_type"
SERVICE_STATUS = "service_status"
QRCODE_TYPE = "qrcode_type"
FROM_UID = "from_uid"
FROM_USER_UID = "from_user_uid"
TO_USER_UID = "to_user_uid"
BEGIN_TIME = "begin_time"
END_TIME = "end_time"
OPERATE = "operate"
TABLES = "tables"
OPEN_ID = "open_id"
EMAIL = "email"
AVATAR = "avatar"
ADDRESS = "address"
TABLES = "tables"
SCORE = "score"
NODE_NAME = "node_name"
NODENAME = "nodename"
SPACE = "space"
OPERATE = "operate"
INDEX = "index"
ARGS = "args"
INIT = "init"
)
type Sess struct {
db.ModelWithUID
UserUID string `gorm:"type:char(32);index"`
IP string `gorm:"type:char(16)"`
Agent string `gorm:"type:varchar(255)"`
IP string `gorm:"type:varchar(16)"`
}
type User struct {
db.ModelWithAuth
OpenID string `gorm:"type:char(32);index"`
Email string `gorm:"type:varchar(64)"`
Name string `gorm:"type:varchar(32)"`
Avatar string `gorm:"type:varchar(255)"`
Name string `gorm:"type:varchar(32)"`
Email string `gorm:"type:varchar(64)"`
}
type UserPlace struct {
db.ModelUserPlace
@ -91,20 +101,10 @@ type City struct {
Name string `gorm:"type:varchar(64);index"`
}
type Event struct {
db.ModelWithUID
PlaceUID string `gorm:"type:char(32);index:idx_place"`
UserUID string `gorm:"type:char(32);index:idx_place"`
Index string `gorm:"type:varchar(64)"`
Operate string `gorm:"type:varchar(32)"`
Args string `gorm:"type:varchar(128)"`
Info string `gorm:"type:varchar(255)"`
}
type Apply struct {
db.ModelWithUID
PlaceUID string `gorm:"type:char(32);index:idx_place"`
UserUID string `gorm:"type:char(32);index:idx_place"`
Tables string `gorm:"type:varchar(32)"`
Status uint8 `gorm:default:0`
Role uint8 `gorm:default:0`
BeginTime db.Time
@ -112,30 +112,39 @@ type Apply struct {
}
type Allow struct {
db.ModelWithUID
ApplyUID string `gorm:"type:char(32);index"`
UserUID string `gorm:"type:char(32)"`
ApplyUID string `gorm:"type:char(32)"`
PlaceUID string `gorm:"type:char(32);index:idx_place"`
UserUID string `gorm:"type:char(32);index:idx_place"`
Status uint8 `gorm:"default:0"`
}
type Event struct {
db.ModelCommand
CommandUID string `gorm:"type:char(32)"`
PlaceUID string `gorm:"type:char(32);index"`
UserUID string `gorm:"type:char(32)"`
Info string `gorm:"type:varchar(255)"`
}
type Message struct {
db.ModelWithUID
FromUserUID string `gorm:"type:char(32);index"`
db.ModelCommand
CommandUID string `gorm:"type:char(32)"`
FromUserUID string `gorm:"type:char(32)"`
ToUserUID string `gorm:"type:char(32);index"`
PlaceName string `gorm:"type:varchar(32)"`
Name string `gorm:"type:varchar(32)"`
Icon string `gorm:"type:varchar(128)"`
Space string `gorm:"type:varchar(32)"`
Index string `gorm:"type:varchar(64)"`
Args string `gorm:"type:varchar(128)"`
Status uint `gorm:"default:0"`
Score uint `gorm:"default:0"`
}
type Recent struct {
db.ModelWithUID
db.ModelCommand
UserUID string `gorm:"type:char(32);index"`
Icon string `gorm:"type:varchar(128)"`
ServiceUID string `gorm:"type:char(32)"`
AuthStatus uint8 `gorm:"default:0"`
Score uint8 `gorm:"default:0"`
}
type Command struct {
db.ModelWithUID
ServiceUID string `gorm:"type:char(32);index:idx_service"`
Index string `gorm:"type:varchar(64);index:idx_service"`
Name string `gorm:"type:varchar(32)"`
Space string `gorm:"type:varchar(32)"`
Index string `gorm:"type:varchar(64)"`
Args string `gorm:"type:varchar(128)"`
Icon string `gorm:"type:varchar(128)"`
}
type Service struct {
db.ModelWithUID
@ -155,12 +164,13 @@ type Support struct {
db.ModelWithUID
FromUserUID string `gorm:"type:char(32);index"`
ToUserUID string `gorm:"type:char(32);index"`
Title string `gorm:"type:varchar(64)"`
Content string
}
func init() {
db.CmdModels("",
&Sess{}, &User{}, &UserPlace{}, &Place{}, &Street{}, &City{},
Event{}, Apply{}, Allow{}, Message{}, Recent{}, Service{}, Support{},
&Apply{}, &Allow{}, &Event{}, &Message{}, &Recent{}, &Command{}, &Service{}, &Support{},
)
}

View File

@ -1,8 +1,12 @@
$output { background-color:var(--plugin-bg-color); }
$output div.item.card { margin-bottom:2px; }
$output div.item.card div.status span { word-break:break-all; }
$output div.item.card>div.output>div { width:100%; }
$output div.item.card div.title { width:100%; display:flex; align-items:center; }
$output div.item.card div.title span.auth { font-size:14px; }
$output div.item.card div.title span.time { position:absolute; right:0; font-size:12px; color:gray; }
$output div.item.card div.status span { word-break:break-all; }
$output div.item.card img { border-radius:5px; padding:0; margin:0; margin-right:10px; height:48px; width:48px; }
$output div.item.card.sticky>div.output { background-color:var(--plugin-bg-color); color:var(--notice-bg-color); }
$output>div>div.list { border-radius:10px; background-color:var(--output-bg-color); padding:10px; margin:10px; }
$output>div>div.list>div.title { font-weight:bold; display:flex; align-items:center; }
$output>div>div.list>div.title span:first-child { flex-grow:1; }

View File

@ -16,9 +16,14 @@ type Portal struct {
Table
user user
city city
event event
message message
recent recent
command command
service service
export string `data:"true"`
short string `data:"index"`
field string `data:"time,index,name,icons,order,enable,type,role,view,init"`
field string `data:"time,icons,name,index,order,enable,init,type,role,view,command_uid"`
create string `name:"create index name icons"`
list string `name:"list place_uid index uid auto" role:"void"`
placeCreate string `name:"placeCreate city_name* street_name* place_type*:select place_name* address*" icon:"bi bi-plus-square-dotted" role:"void"`
@ -26,7 +31,6 @@ type Portal struct {
placeAuth string `name:"placeAuth" role:"void"`
placeSearch string `name:"placeSearch" icon:"bi bi-search" role:"void"`
scanQRCode string `name:"scanQRCode type text" icon:"bi bi-qr-code-scan" role:"void"`
setIcons string `name:"setIcons icons" icon:"bi bi-info-square"`
}
func (s Portal) Init(m *ice.Message, arg ...string) {
@ -39,14 +43,11 @@ func (s Portal) Exit(m *ice.Message, arg ...string) {
func (s Portal) BeforeMigrate(m *ice.Message, arg ...string) {
}
func (s Portal) AfterMigrate(m *ice.Message, arg ...string) {
cmd := m.GetCommand()
name := kit.Select("", kit.Split(m.PrefixKey(), "."), -2)
if !m.Exists("src/" + name) {
if name := kit.Select("", kit.Split(m.PrefixKey(), "."), -2); !m.Exists("src/" + name) {
return
}
m.GoSleep("30ms", func() {
m.Cmdy(service{}, s.Table.Update, ctx.INDEX, m.PrefixKey(), mdb.NAME, cmd.Help+" "+ice.Info.Title(), mdb.ICON, m.Resource(kit.Select(ice.Info.NodeIcon, cmd.Icon)))
})
cmd := m.GetCommand()
m.Cmdy(s.Prefix(m, s.service), s.Table.Update, ctx.INDEX, m.PrefixKey(), mdb.NAME, cmd.Help+" "+ice.Info.Title(), mdb.ICON, m.Resource(kit.Select(ice.Info.NodeIcon, cmd.Icon)))
}
func (s Portal) Inputs(m *ice.Message, arg ...string) {
m.Cmdy(s.Place, m.ActionKey(), arg)
@ -64,6 +65,7 @@ func (s Portal) Run(m *ice.Message, arg ...string) {
sub, role = arg[1], action.Role
}
}
m.Info("what %v", role)
if kit.IsIn(role, "", aaa.VOID) {
kit.If(!ctx.PodCmd(m.Message, arg) && aaa.Right(m.Message, arg), func() { m.Cmdy(arg) })
} else {
@ -98,33 +100,34 @@ func (s Portal) List(m *ice.Message, arg ...string) {
kit.If(!m.IsErr() && m.Length() == 0, func() { m.EchoInfoButton("", s.PlaceCreate, s.ScanQRCode, s.PlaceSearch) })
} else if len(arg) == 1 {
if arg[0] != "" {
m.Option("_user_place_role", s.Keys(s.UserPlace, model.ROLE))
m.Option("_street_name", s.Keys(s.Street, model.NAME))
msg := s.PlaceListOption(m, arg...)
m.Option(model.PLACE_NAME, msg.Append(s.Keys(s.Place, model.NAME)))
m.Option(model.STREET_NAME, msg.Append(s.Keys(s.Street, model.NAME)))
s.AddRecent(msg, arg[0])
}
s.Hash.List(m).SortInt(mdb.ORDER)
} else if len(arg) == 2 {
s.PlaceListOption(m, arg...)
m.Option(model.COMMAND_UID, s.Hash.List(m.Spawn(), arg[1]).Append(model.COMMAND_UID))
m.Cmdy(ctx.COMMAND, arg[1]).Push(ctx.ARGS, arg[0])
} else {
m.FieldsSetDetail().Cmdy(arg[1], mdb.SELECT, model.UID, arg[2]).Action()
}
s.Place.RewriteAppend(m)
s.DisplayBase(m, "").DisplayCSS("")
}
func (s Portal) PlaceListOption(m *ice.Message, arg ...string) *ice.Message {
msg := m.Cmd(m.PrefixKey(), s.PlaceList, m.Option(model.USER_UID), arg[0])
if msg.Length() == 0 {
msg = m.Cmd(s.Place, s.Table.Select, model.UID, arg[0])
msg.Push(s.Keys(s.UserPlace, model.ROLE), "0")
msg.RenameAppend(model.NAME, s.Keys(s.Place, model.NAME), model.TYPE, s.Keys(s.Place, model.TYPE))
s.SelectJoin(msg, s.Street, model.NAME, model.CITY_UID)
s.SelectJoin(msg, s.city)
s.SelectJoinCity(msg)
}
s.UserPlace.RewriteAppend(msg)
m.Options(msg.AppendSimple(
s.Keys(s.Place, model.NAME), s.Keys(s.Place, model.TYPE), s.Keys(s.UserPlace, model.ROLE),
s.Keys(s.Street, model.NAME), model.CITY_NAME,
))
s.AddRecent(msg, arg[0], msg.Append(s.Keys(s.Place, model.NAME)), msg.Append(mdb.ICONS))
}
s.Hash.List(m).SortInt(mdb.ORDER)
} else if len(arg) == 2 {
msg := m.Cmd(s.Place, s.Table.Select, model.UID, arg[0])
m.Option(s.Keys(s.Place, model.NAME), msg.Append(model.NAME))
m.Cmdy(ctx.COMMAND, arg[1]).Push(ctx.ARGS, arg[0])
} else {
m.FieldsSetDetail().Cmdy(arg[1], mdb.SELECT, model.UID, arg[2]).PushAction().Action()
}
s.Place.RewriteAppend(m)
s.DisplayBase(m, "portal.js").DisplayCSS("")
s.Place.RewriteAppend(msg)
m.Options(msg.AppendSimple(model.AUTH_STATUS, s.Keys(s.Place, model.NAME), s.Keys(s.Place, model.TYPE), s.Keys(s.UserPlace, model.ROLE), s.Keys(s.Street, model.NAME), model.CITY_NAME))
return msg
}
func (s Portal) PlaceCreate(m *ice.Message, arg ...string) {
defer m.ToastProcess()()
@ -139,9 +142,8 @@ func (s Portal) PlaceCreate(m *ice.Message, arg ...string) {
if m.Cmdy(s.Place, s.Create, arg[2:]).IsErr() {
return
}
s.RecordEventWithName(m.Options(mdb.NAME, name), m.Result(), "")
m.Option(s.Keys(s.Place, model.UID), m.Result())
args := kit.Simple(s.Keys(s.Place, model.UID), m.Result(), m.OptionSimple(model.USER_UID), model.ROLE, UserPlaceCreator)
s.RecordEventWithName(m.Options(mdb.NAME, name, s.Keys(s.Place, model.UID), m.Result()), "")
args := kit.Simple(m.OptionSimple(s.Keys(s.Place, model.UID), model.USER_UID), model.ROLE, UserPlaceCreator)
m.SetResult().Cmdy(s.UserPlace, s.Create, args)
}
func (s Portal) PlaceRemove(m *ice.Message, arg ...string) {
@ -149,9 +151,9 @@ func (s Portal) PlaceRemove(m *ice.Message, arg ...string) {
m.Cmdy(s.UserPlace, s.Delete, m.OptionSimple(model.USER_UID, model.UID))
}
func (s Portal) PlaceList(m *ice.Message, arg ...string) *ice.Message {
s.Tables(m, s.Place).FieldsWithCreatedAT(m, s.UserPlace,
s.Tables(m, s.Place).FieldsWithCreatedAT(m, s.UserPlace, model.AUTH_UID, model.INIT,
s.Keys(s.Place, model.NAME), s.Keys(s.Place, model.TYPE), s.Keys(s.UserPlace, model.ROLE),
model.INIT, model.AUTH_UID, s.Keys(s.Place, model.UID), s.Keys(s.Street, model.UID),
s.Keys(s.Place, model.UID), s.Keys(s.Street, model.UID),
)
if len(arg) == 1 {
m.Cmdy(s.UserPlace, s.Table.Select, model.USER_UID, arg[0])
@ -167,20 +169,23 @@ func (s Portal) PlaceList(m *ice.Message, arg ...string) *ice.Message {
}
func (s Portal) PlaceAuth(m *ice.Message, arg ...string) {
if m.Option(model.AUTH_UID) == "" {
place_uid := m.Option(s.Keys(s.Place, model.UID))
place_name := m.Option(s.Keys(s.Place, model.NAME))
m.Option(model.COMPANY_NAME, m.Option(s.Keys(s.Street, model.NAME)))
msg := m.Cmd("web.team.renzhengshouquan.portal", s.PlaceCreate, m.OptionSimple(model.CITY_NAME, model.COMPANY_NAME),
model.AUTH_TYPE, AuthType, model.AUTH_NAME, m.Option(s.Keys(s.Place, model.NAME)), model.FROM_UID, ice.AUTO)
msg := s.SpaceCmd(m, "20240724-community", "web.team.renzhengshouquan.portal", "placeCreate", m.OptionSimple(model.CITY_NAME, model.COMPANY_NAME),
model.AUTH_TYPE, ice.AUTO, model.AUTH_NAME, place_name, model.FROM_UID, ice.AUTO)
if msg.IsErr() {
m.Copy(msg)
return
}
m.Cmd(s.Place, s.UpdateAuth, msg.Option(model.AUTH_UID), model.UID, m.Option(s.Keys(s.Place, model.UID)))
m.Cmd(s.Place, s.UpdateAuth, msg.Option(model.AUTH_UID), model.UID, place_uid)
s.RecordEventWithName(m.Options(model.NAME, place_name, model.UID, place_uid), "")
} else {
m.ProcessHold()
}
}
func (s Portal) PlaceSearch(m *ice.Message, arg ...string) {
m.ProcessRewrite(model.INDEX, m.Prefix("search"))
m.ProcessRewrite(model.INDEX, s.Prefix(m, search{}))
}
func (s Portal) ScanQRCode(m *ice.Message, arg ...string) {
defer m.ToastProcess()()
@ -188,22 +193,44 @@ func (s Portal) ScanQRCode(m *ice.Message, arg ...string) {
m.Cmdy(s.UserPlace, s.Create, s.Key(s.Place, model.UID), m.Option(mdb.TEXT), m.OptionSimple(model.USER_UID), model.ROLE, UserPlaceVisitor)
} else if m.Option(mdb.TYPE) == web.LINK {
args := m.ParseURL(m.Option(mdb.TEXT))
if len(args) > 1 && args[1] == m.Prefix("apply") {
if len(args) > 1 && args[1] == s.Prefix(m, apply{}) {
m.Cmdy(s.UserPlace, s.Create, s.Keys(s.Place, model.UID), args[0], m.OptionSimple(model.USER_UID), model.ROLE, UserPlaceVisitor)
}
}
}
func (s Portal) UserPlaceRole(m *ice.Message, arg ...string) {
m.Echo(m.Cmd(s.UserPlace, s.Table.Select, m.OptionSimple(s.Keys(s.Place, model.UID), model.USER_UID)).Append(model.ROLE))
}
func (s Portal) UserPlaceCmd(m *ice.Message, arg ...string) {
m.Cmdy(s.UserPlace, arg)
}
func (s Portal) PlaceCmd(m *ice.Message, arg ...string) {
m.Cmdy(s.Place, arg)
}
var AuthType int
func (s Portal) RecordEvent(m *ice.Message, arg ...string) {
s.event.Record(m.Spawn(kit.Dict(model.PLACE_UID, m.Option(s.Keys(s.Place, model.UID)))), arg[0], arg[1:]...)
}
func (s Portal) AddRecent(m *ice.Message, arg ...string) {
m.Options(m.ConfigSimple(model.SERVICE_UID))
if kit.IsIn(m.Append(model.AUTH_STATUS), "2", "issued") {
m.Cmd(s.Prefix(m, s.recent), s.Create, s.GetCommands(m, model.SERVICE_UID, arg...), model.AUTH_STATUS, "2")
} else {
m.Cmd(s.Prefix(m, s.recent), s.Create, s.GetCommands(m, model.SERVICE_UID, arg...))
}
}
func init() { ice.TeamCtxCmd(Portal{Table: newTable()}) }
func (s Portal) UpdateCommand(m *ice.Message, arg ...string) {
m.Config(model.SERVICE_UID, arg[0])
s.Hash.Select(m.Spawn()).Table(func(value ice.Maps) {
uid := m.Cmdx(s.command, s.Table.Update, model.SERVICE_UID, arg[0], mdb.ICON, value[mdb.ICONS], model.NAME, value[model.NAME], model.INDEX, value[model.INDEX])
s.Hash.Modify(m, ctx.INDEX, value[ctx.INDEX], model.COMMAND_UID, uid)
})
}
func (s Portal) SelectCommand(m *ice.Message, arg ...string) {
s.Hash.Select(m, arg...)
}
func (s Portal) Create(m *ice.Message, arg ...string) {
args := []string{ctx.INDEX, m.Option(ctx.INDEX)}
msg := s.Hash.Select(m.Spawn(), m.Option(ctx.INDEX))
@ -218,10 +245,10 @@ func (s Portal) Create(m *ice.Message, arg ...string) {
s.Hash.Create(m, args...)
}
func (s Portal) Show(m *ice.Message, arg ...string) {
m.Cmd(m.Prefix(web.PORTAL), s.Create, ctx.INDEX, m.PrefixKey())
m.Cmd(s.Prefix(m, s), s.Create, ctx.INDEX, m.PrefixKey())
}
func (s Portal) Link(m *ice.Message, arg ...string) string {
return m.MergePodCmd("", m.Prefix(web.PORTAL)) + "#" + kit.TrimSuffix(kit.Join([]string{arg[0], kit.Select(m.Prefix("apply"), arg, 1), kit.Select("", arg, 2)}, ":"), ":")
return m.MergePodCmd("", s.Prefix(m, s)) + "#" + kit.TrimSuffix(kit.Join([]string{arg[0], kit.Select(s.Prefix(m, apply{}), arg, 1), kit.Select("", arg, 2)}, ":"), ":")
}
func init() { ice.TeamCtxCmd(Portal{Table: newTable()}) }

View File

@ -10,6 +10,10 @@ Volcanos(chat.ONIMPORT, {
},
typeStyle: function(can, value, key) { return can.Conf("_trans.value."+key+".style."+value[key])||"" },
roleStyle: function(can, value, key) { return can.Conf("_trans.value."+key+".style."+value[key])||"" },
timeView: function(can, value) { return {text: [can.base.TimeTrim(value.updated_at||value.created_at), "", "time"]} },
authView: function(can, value) {
return can.base.isIn(value.auth_status, "issued", "2") && {view: ["auth", html.SPAN], list: [{icon: "bi bi-patch-check-fill", style: {color: "var(--notice-bg-color)"}}]}
},
myValue: function(can, value) { return [
{view: html.TITLE, list: [value._name,
can.base.isIn(value.auth_status, "issued", "2") && {view: ["auth", html.SPAN], list: [{icon: "bi bi-patch-check-fill", style: {color: "var(--notice-bg-color)"}}]},
@ -46,6 +50,7 @@ Volcanos(chat.ONIMPORT, {
var _msg = can.request({}, {_user_place_role: msg.Option("_user_place_role"), _street_name: msg.Option("_street_name")}); _msg.Push(kit.Dict(
UID, "", PLACE_UID, can.Option(PLACE_UID), PLACE_NAME, msg.Option(PLACE_NAME), PLACE_TYPE, msg.Option(PLACE_TYPE), USER_PLACE_ROLE, msg.Option(USER_PLACE_ROLE),
STREET_NAME, msg.Option(STREET_NAME), CITY_NAME, msg.Option(CITY_NAME),
"auth_status", msg.Option("auth_status"),
))
_msg.Option(ice.MSG_ACTION, msg.Option(USER_PLACE_ROLE) == "visitor"? '["placeSearch"]': '["placeCreate","scanQRCode","placeSearch"]')
can.onimport.myPlace(can, _msg, can.ui.myplace, PLACE_UID, PLACE_NAME, PLACE_TYPE)
@ -53,7 +58,7 @@ Volcanos(chat.ONIMPORT, {
can.onimport.myAllow(can, msg, can.ui.myallow, PLACE_UID, USER_PLACE_ROLE)
can.onimport.myOrder(can, msg, can.ui.myorder, PLACE_UID, USER_PLACE_ROLE)
} else {
can.onimport.story(can, msg, can._output, PLACE_UID, PLACE_NAME)
can.onimport.story(can, msg, can._output, PLACE_UID, PLACE_NAME, STREET_NAME)
}
},
myTrans: function(can, value, PLACE_UID, PLACE_NAME, PLACE_TYPE, USER_PLACE_ROLE, STREET_NAME) {
@ -107,7 +112,7 @@ Volcanos(chat.ONIMPORT, {
},
myList: function(can, msg, target, PLACE_UID, USER_PLACE_ROLE) {
var width = (can.ConfWidth()-40)/parseInt((can.ConfWidth()-40)/100); can.user.isMobile && !can.user.isLandscape() && (width = (can.ConfWidth()-40)/4)
can.page.Append(can, target, msg.Table(function(value) { if (value.order < 100 && value.enable != ice.TRUE) { return }
can.page.Append(can, target, msg.Table(function(value) { if (value.enable == ice.FALSE) { return }
return {view: [[html.ITEM, ctx.INDEX].concat(
value.type? [mdb.TYPE]: [], can.core.Split(value.type||""),
value.role? [aaa.ROLE]: [], can.core.Split(value.role||""),
@ -157,7 +162,7 @@ Volcanos(chat.ONIMPORT, {
}
})
},
story: function(can, msg, target, PLACE_UID, PLACE_NAME) {
story: function(can, msg, target, PLACE_UID, PLACE_NAME, STREET_NAME) {
msg.Table(function(value) { function goback() {} function reload() {}
var list = [can.page.button(can, can.user.trans(can, "goback", "返回"), function(event) { goback() }), can.page.button(can, can.user.trans(can, "reload", "刷新"), function(event) { reload() })]
var ui = can.page.Append(can, can._output, [{view: html.ACTION}])
@ -169,7 +174,12 @@ Volcanos(chat.ONIMPORT, {
})
can.onexport.title(can, sub.Conf(PLACE_NAME, msg.Option(PLACE_NAME)), value.help)
sub.onexport.title = function(sub) { can.onexport.title.apply(can.onexport, [can].concat(can.core.List(arguments).slice(1))) }
var run = sub.run; sub.run = function(event, cmds, cb) { run(can.request(event, {place_name: sub.Conf(PLACE_NAME)}), cmds, cb) }
var run = sub.run; sub.run = function(event, cmds, cb) {
run(can.request(event, {
city_name: msg.Option(CITY_NAME), street_name: msg.Option(STREET_NAME), place_name: msg.Option(PLACE_NAME),
command_uid: msg.Option("command_uid"), portal_name: can.ConfHelp(),
}), cmds, cb)
}
can.page.Appends(can, ui.action, list)
goback = function() { can.page.ClassList.add(can, can._fields, "_back")
can.onexport.hash(can, ""), can.Option(PLACE_UID, ""), can.Option(ctx.INDEX, ""), can.Update()

View File

@ -1,13 +1,12 @@
{
"portal": "用户场景",
"placeCreate": "创建", "placeRemove": "删除",
"placeCreate": "创建", "placeRemove": "删除", "placeAuth": "认证",
"placeSearch": "搜索", "scanQRCode": "扫码",
"placeAuth": "认证",
"qrcode": "场景码", "event": "事件流", "apply": "权限申请", "allow": "权限审批",
"email": "邮箱配置", "member": "场景成员", "placeUser": "场景成员",
"message": "消息待办", "recent": "最近访问", "service": "服务发现", "support": "客服支持",
"cancel": "取消", "submit": "提交", "finish": "完成", "reject": "驳回", "approve": "通过",
"read": "已读", "done": "完成",
"read": "已读", "done": "完成", "sticky": "置顶", "unSticky": "取消置顶",
"autogen": "生成", "compile": "编译", "oauth": "授权", "project": "项目",
"icons": {
"qrcode": "https://img.icons8.com/officel/80/qr-code.png",
@ -55,22 +54,16 @@
},
"value": {
"apply_status": {
"create": "待提交",
"cancel": "已取消",
"submit": "已提交",
"rejected": "已驳回",
"approved": "已通过",
"style": {
"rejected": "danger"
}
"create": "待提交 🕑",
"cancel": "已取消 ❌",
"submit": "已提交 🕑",
"rejected": "已驳回 ❌",
"approved": "已通过 ✅"
},
"allow_status": {
"create": "待审批",
"rejected": "已驳回",
"approved": "已通过",
"style": {
"rejected": "danger"
}
"create": "待审批 🕑",
"rejected": "已驳回 ❌",
"approved": "已通过 ✅"
},
"user_place_role": {
"visitor": "访客",

View File

@ -9,3 +9,40 @@ field web.chat.wx.menu
field web.code.mysql.client
field web.code.mysql.query args `mysql gonganxitong`
field web.code.db.models
order `
sess.go
user.go
userPlace.go
placeUser.go
place.go
street.go
city.go
qrcode.go
apply.go
apply.js
allow.go
allow.js
event.go
event.js
common.go
common.js
portal.css
portal.go
portal.js
portal.json
portal.shy
message.go
message.js
recent.go
recent.js
search.go
search.js
command.go
service.go
service.js
support.go
email.go
`

View File

@ -21,11 +21,12 @@ func (s qrcode) Apply(m *ice.Message, arg ...string) {
}
func (s qrcode) List(m *ice.Message, arg ...string) {
s.info(m, arg[0], "portal")
m.EchoQRCode(m.MergePodCmd("", m.Prefix("portal"), s.Keys(s.Place, model.UID), arg[0]))
}
func (s qrcode) info(m *ice.Message, place_uid, typ string) {
m.Cmdy(m.Prefix("portal"), s.portal.PlaceList, m.Option(model.USER_UID), place_uid).Cut(model.CITY_NAME, s.Keys(s.Street, model.NAME), s.Keys(s.Place, model.NAME))
m.Push(model.QRCODE_TYPE, typ).Action(s.Apply)
m.EchoQRCode(m.MergePodCmd("", s.Prefix(m, s.portal), s.Keys(s.Place, model.UID), arg[0]))
}
func init() { ice.TeamCtxCmd(qrcode{Tables: newTables()}) }
func (s qrcode) info(m *ice.Message, place_uid, typ string) {
m.Cmdy(s.Prefix(m, s.portal), s.portal.PlaceList, m.Option(model.USER_UID), place_uid).Cut(model.CITY_NAME, s.Keys(s.Street, model.NAME), s.Keys(s.Place, model.NAME))
m.Push(model.QRCODE_TYPE, typ).Action(s.Apply)
}

View File

@ -11,34 +11,55 @@ import (
type recent struct {
Table
service service
order string `data:"101"`
create string `name:"create name icon space index args"`
create string `name:"create service_uid args"`
remove string `name:"remove" role:"void"`
open string `name:"open" role:"void"`
sticky string `name:"sticky" role:"void"`
unSticky string `name:"unSticky" role:"void"`
}
func (s recent) Create(m *ice.Message, arg ...string) {
if s.Table.Select(m, m.OptionSimple(model.USER_UID, web.SPACE, ctx.INDEX, ctx.ARGS)...).Length() == 0 {
if args := m.OptionSimple(model.USER_UID, model.SERVICE_UID, ctx.ARGS); s.Table.Select(m, args...).Length() == 0 {
s.Table.Create(m, kit.Simple(arg, model.UPDATED_AT, m.Time(), m.OptionSimple(model.USER_UID))...)
} else {
s.Table.Update(m, kit.Dict(), m.OptionSimple(model.USER_UID, web.SPACE, ctx.INDEX, ctx.ARGS)...)
s.Table.Update(m, kit.Dict(m.OptionSimple(model.AUTH_STATUS)), args...)
}
}
func (s recent) Remove(m *ice.Message, arg ...string) {
s.Table.Delete(m, m.OptionSimple(model.USER_UID, model.UID)...)
}
func (s recent) List(m *ice.Message, arg ...string) {
s.Orders(m, s.Desc(model.UPDATED_AT))
if len(arg) < 2 {
s.Tables(m, s.service).Fields(m,
model.SERVICE_ICON, model.SERVICE_NAME,
s.AS(model.NODENAME, model.SPACE), model.INDEX, model.ARGS, s.Key(s, model.AUTH_STATUS), model.SCORE,
s.Key(s, model.UID), s.Key(s, model.UPDATED_AT),
s.Key(s, model.CITY_NAME), s.Key(s, model.STREET_NAME), s.Key(s, model.PLACE_NAME),
)
s.Orders(m, s.Desc(model.SCORE), s.Desc(model.UPDATED_AT))
s.Select(m, model.USER_UID, m.Option(model.USER_UID))
} else if len(arg) == 2 {
s.SelectDetail(m, model.USER_UID, m.Option(model.USER_UID), model.UID, arg[1])
}
m.PushAction(s.Open, s.Remove).Action()
m.Table(func(value ice.Maps) {
if value[model.SCORE] == "0" {
m.PushButton(s.Sticky, s.Remove)
} else {
m.PushButton(s.UnSticky, s.Remove)
}
}).Action()
s.DisplayBase(m, "")
}
func (s recent) Open(m *ice.Message, arg ...string) {
m.ProcessOpen(web.S(m.Option(web.SPACE)) + web.C(m.Option(ctx.INDEX)) + "#" + kit.Join(kit.Split(m.Option(ctx.ARGS)), ":"))
}
func (s recent) Sticky(m *ice.Message, arg ...string) {
s.Table.Update(m, ice.Map{model.SCORE: 100}, m.OptionSimple(model.USER_UID, model.UID)...)
}
func (s recent) UnSticky(m *ice.Message, arg ...string) {
s.Table.Update(m, ice.Map{model.SCORE: 0}, m.OptionSimple(model.USER_UID, model.UID)...)
}
func init() { ice.TeamCtxCmd(recent{}) }

View File

@ -1,14 +1,14 @@
Volcanos(chat.ONIMPORT, {
_init: function(can, msg) { can.onimport.shareTitle(can, msg)
can.onimport.itemcards(can, msg, function(value) { var args = can.core.Split(value.args)
var sub = can._root.Action._plugins[[value.space, value.index, args[0]].join(".")]
value.icons = can.misc.Resource(can, value.service_icon, value.space); if (value.score > 0) { value._style = ["sticky"] }
var sub = can._root.Action._plugins[[value.space, value.index, args[0]].join(",")]
return [
{view: html.TITLE, list: [[args[1]].join(" "), sub? {text: ["load", "", mdb.STATUS]}: ""]},
{view: html.STATUS, list: [value.uid.slice(0, 6), can.base.TimeTrim(value.updated_at), value.name]},
{view: html.TITLE, list: [value.place_name, can.onimport.authView(can, value), sub? {text: ["load", "", mdb.STATUS]}: "", can.onimport.timeView(can, value)]},
{view: html.STATUS, list: [value.city_name, value.street_name, value.service_name]},
]
}, function(event, value) { var args = can.core.Split(value.args)
can.onaction._goback(can)
can.onimport.plugin(can, {_title: args[1], space: value.space, index: value.index, args: [args[0]]})
}, function(event, value) { var args = can.core.Split(value.args); can.onaction._goback(can)
can.onimport.plugin(can, {_title: value.place_name, space: value.space, index: value.index, args: [args[0]]})
})
},
})

View File

@ -6,10 +6,7 @@ import (
"shylinux.com/x/community/src/gonganxitong/model"
)
type search struct {
Tables
visitor string `name:"visitor" role:"void"`
}
type search struct{ Tables }
func (s search) List(m *ice.Message, arg ...string) {
if len(arg) < 2 {
@ -17,12 +14,11 @@ func (s search) List(m *ice.Message, arg ...string) {
} else if len(arg) == 2 {
m.FieldsSetDetail().Cmdy(s.Place, s.Select, model.UID, arg[1]).Action()
}
m.RenameAppend(model.TYPE, s.Keys(s.Place, model.TYPE))
m.RenameAppend(model.TYPE, s.Keys(s.Place, model.TYPE), model.CREATOR, model.USER_UID)
s.SelectJoin(m, s.Street, model.NAME, model.CITY_UID)
s.SelectJoinCity(m)
m.RenameAppend(model.CREATOR, model.USER_UID)
s.SelectJoinUser(m)
m.Display("")
s.Display(m, "")
}
func init() { ice.TeamCtxCmd(search{Tables: newTables()}) }

View File

@ -30,17 +30,15 @@ type service struct {
func (s service) Update(m *ice.Message, arg ...string) {
uid := kit.Hashs(ice.Info.Hostname, ice.Info.Pwd, m.Option(ctx.INDEX))
if s.Table.Select(m.Spawn(), model.UID, uid).Length() == 0 {
s.Table.Create(m, kit.Simple(model.UID, uid,
m.OptionSimple(ctx.INDEX), m.OptionSimple(mdb.NAME, mdb.ICON),
tcp.HOSTNAME, ice.Info.Hostname, nfs.PATHNAME, ice.Info.Pwd,
)...)
m.Cmd(m.Prefix(web.PORTAL)).Table(func(value ice.Maps) { m.Cmd(m.Prefix(web.PORTAL), mdb.MODIFY, value[ctx.INDEX], mdb.ENABLE, ice.TRUE) })
s.Table.Create(m, kit.Simple(model.UID, uid, m.OptionSimple(mdb.ICON, mdb.NAME, ctx.INDEX), nfs.PATHNAME, ice.Info.Pwd, tcp.HOSTNAME, ice.Info.Hostname)...)
m.Cmd(s.PrefixPortal(m)).Table(func(value ice.Maps) { m.Cmd(s.PrefixPortal(m), mdb.MODIFY, value[ctx.INDEX], mdb.ENABLE, ice.TRUE) })
}
s.Table.Update(m, kit.Dict(arg, m.OptionSimple(mdb.NAME, mdb.ICON),
nfs.MODULE, ice.Info.Make.Module, nfs.VERSION, ice.Info.Make.Versions(),
tcp.NODENAME, ice.Info.NodeName, tcp.NODETYPE, ice.Info.NodeType,
web.DOMAIN, ice.Info.Make.Domain, web.PORTAL, ctx.GetCmdFile(m.Message, m.Prefix(web.PORTAL)),
), model.UID, uid)
m.Cmd(s.PrefixPortal(m), "updateCommand", uid)
}
func (s service) Autogen(m *ice.Message, arg ...string) {
m.Option("CLASS", strings.ToUpper(m.Option(mdb.CLASS)))

View File

@ -1,13 +1,12 @@
Volcanos(chat.ONIMPORT, {
_init: function(can, msg) {
can.onimport.itemcards(can, msg, function(value) { return [
{view: html.TITLE, list: [value.name, can.onimport.textView(can, value, "service_type", mdb.TYPE), can.onimport.textView(can, value, "service_status", mdb.STATUS)]},
{view: html.STATUS, list: [value.uid.slice(0, 6), can.base.TimeTrim(value.updated_at)]},
{view: html.TITLE, list: [value.name, can.onimport.textView(can, value, "service_type"), can.onimport.textView(can, value, "service_status")]},
// {view: html.STATUS, list: [value.uid.slice(0, 6), can.base.TimeTrim(value.updated_at)]},
{view: html.STATUS, list: [value.index]},
{view: html.STATUS, list: [value.module, value.version]},
{view: html.STATUS, list: [value.domain.split("?")[0]]},
] }, function(event, value) {
can.onaction._goback(can)
// {view: html.STATUS, list: [value.domain.split("?")[0]]},
] }, function(event, value) { can.onaction._goback(can)
can.onimport.plugin(can, {space: value.space||value.nodename, index: value.index})
})
},

View File

@ -16,7 +16,7 @@ type sess struct {
}
func (s sess) Create(m *ice.Message, arg ...string) {
s.Table.Create(m, model.USER_UID, m.Option(model.USER_UID), aaa.IP, m.Option(ice.MSG_USERIP), web.AGENT, m.Option(ice.MSG_USERUA))
s.Table.Create(m, model.USER_UID, m.Option(model.USER_UID), web.AGENT, m.Option(ice.MSG_USERUA), aaa.IP, m.Option(ice.MSG_USERIP))
m.ProcessCookie(ice.MSG_SESSID, kit.JoinWord(web.SPACE, m.Option(ice.MSG_USERPOD), m.PrefixKey(), aaa.CHECK, m.Result()), "-2")
}
func (s sess) Check(m *ice.Message, arg ...string) {

View File

@ -40,12 +40,6 @@ func (s Table) CheckRole(m *ice.Message, arg ...string) *ice.Message {
m.WarnNotRight(!kit.IsIn(role.String(), append(arg, User{{.Option "Class"}}Creator.String())...), role.String())
return m
}
func (s Table) recordEvent(m *ice.Message, info string, arg ...string) {
s.Table.RecordEvent(m, m.Option(model.{{.Option "CLASS"}}_UID), info, kit.Select(m.Option(model.UID), arg, 0))
}
func (s Table) recordEventWithName(m *ice.Message, info string, arg ...string) {
s.Table.RecordEventWithName(m, m.Option(model.{{.Option "CLASS"}}_UID), info)
}
type Tables struct { Table }

View File

@ -16,7 +16,7 @@ type {{.Option "table"}} struct {
func (s {{.Option "table"}}) Create(m *ice.Message, arg ...string) {
s.Table.Create(m, kit.Simple(arg, m.OptionSimple(model.USER_UID, model.{{.Option "CLASS"}}_UID))...)
s.recordEventWithName(m, "")
s.RecordEventWithName(m, "")
}
func (s {{.Option "table"}}) List(m *ice.Message, arg ...string) {
s.TablesWithRole(m, arg, s.user{{.Option "Class"}}, s.{{.Option "class"}}, s, model.TITLE, model.CONTENT).Display("")

View File

@ -23,10 +23,9 @@
}
},
"{{.Option "class"}}_type": {
"term": "学期制",
"weekly": "周期性",
"step": "阶段性",
"free": "自由式"
"RD": "研发群",
"OP": "运维群",
"HR": "人力群"
}
}
}

View File

@ -31,8 +31,7 @@ func (s user) Create(m *ice.Message, arg ...string) {
}
func (s user) List(m *ice.Message, arg ...string) {
if m.IsTech() {
s.Table.List(m, arg...)
m.Table(func(value ice.Maps) {
s.Table.List(m, arg...).Table(func(value ice.Maps) {
if value[model.UID] != m.Option(model.USER_UID) {
m.PushButton(s.SetCookie)
} else {

View File

@ -16,7 +16,7 @@ type activity struct {
func (s activity) Create(m *ice.Message, arg ...string) {
s.Table.Create(m, kit.Simple(arg, m.OptionSimple(model.USER_UID, model.GROUP_UID))...)
s.recordEventWithName(m, "")
s.RecordEventWithName(m, "")
}
func (s activity) List(m *ice.Message, arg ...string) {
s.TablesWithRole(m, arg, s.userGroup, s.group, s, model.TITLE, model.CONTENT).Display("")

View File

@ -35,17 +35,6 @@ func (s Table) RewriteAppend(m *ice.Message, arg ...string) *ice.Message {
})
return s.Table.RewriteAppend(m)
}
func (s Table) CheckRole(m *ice.Message, arg ...string) *ice.Message {
role := UserGroupRole(kit.Int(m.Cmd(userGroup{}, s.Select, m.OptionSimple(model.GROUP_UID, model.USER_UID)).Append(model.ROLE)))
m.WarnNotRight(!kit.IsIn(role.String(), append(arg, UserGroupCreator.String())...), role.String())
return m
}
func (s Table) recordEvent(m *ice.Message, info string, arg ...string) {
s.Table.RecordEvent(m, m.Option(model.GROUP_UID), info, kit.Select(m.Option(model.UID), arg, 0))
}
func (s Table) recordEventWithName(m *ice.Message, info string, arg ...string) {
s.Table.RecordEventWithName(m, m.Option(model.GROUP_UID), info)
}
type Tables struct{ Table }

View File

@ -15,8 +15,8 @@
"user_group_role": {
"visitor": "访客",
"creator": "创建人",
"leader": "组长",
"worker": "成员",
"leader": "管理人员",
"worker": "组织成员",
"server": "服务人员",
"style": {
"creator": "danger",
@ -24,10 +24,9 @@
}
},
"group_type": {
"term": "学期制",
"weekly": "周期性",
"step": "阶段性",
"free": "自由式"
"RD": "研发群",
"OP": "运维群",
"HR": "人力群"
}
}
}

View File

@ -1,27 +1,16 @@
package huodongzuzhi
import "shylinux.com/x/ice"
import (
"shylinux.com/x/ice"
"shylinux.com/x/enterprise/src/guanlixitong"
)
type userGroup struct{ Table }
func init() { ice.TeamCtxCmd(userGroup{}) }
type UserGroupRole int
type UserGroupRole = guanlixitong.UserGroupRole
const (
UserGroupVisitor UserGroupRole = iota
UserGroupCreator
UserGroupLeader
UserGroupWorker
UserGroupServer
)
var UserGroupRoleList = map[UserGroupRole]string{
UserGroupVisitor: "visitor",
UserGroupCreator: "creator",
UserGroupLeader: "leader",
UserGroupWorker: "worker",
UserGroupServer: "server",
}
func (s UserGroupRole) String() string { return UserGroupRoleList[s] }
var UserGroupCreator = guanlixitong.UserGroupCreator
var UserGroupRoleList = guanlixitong.UserGroupRoleList

View File

@ -4,7 +4,6 @@ import (
"shylinux.com/x/ice"
kit "shylinux.com/x/toolkits"
"shylinux.com/x/community/src/gonganxitong"
"shylinux.com/x/community/src/renzhengshouquan/model"
)
@ -40,7 +39,7 @@ func (s auth) CertList(m *ice.Message, arg ...string) {
kit.If(m.Length() == 0, func() { m.Echo("没有上传证件") })
}
func (s auth) MemberList(m *ice.Message, arg ...string) {
// m.Cmdy(userAuth{}, userAuth{}.User, arg[0]).Action()
m.Cmdy(m.Prefix("member"), arg[0])
}
func (s auth) Issue(m *ice.Message, arg ...string) {
msg := m.Cmd(userAuth{}, m.Option(model.USER_UID), m.Option(model.AUTH_UID))
@ -71,23 +70,25 @@ type AuthType int
const (
AuthRoot AuthType = iota
AuthCity
AuthCompany
AuthService
AuthPersonal
AuthService
AuthCompany
AuthSchool
AuthStreet
)
var AuthTypeList = map[AuthType]string{
AuthRoot: "root",
AuthCity: "city",
AuthCompany: "company",
AuthService: "service",
AuthPersonal: "personal",
AuthService: "service",
AuthCompany: "company",
AuthSchool: "school",
AuthStreet: "street",
}
func (s AuthType) String() string { return AuthTypeList[s] }
func init() { gonganxitong.AuthType = int(AuthService) }
type AuthStatus int
const (

View File

@ -16,7 +16,7 @@ type cert struct {
func (s cert) Create(m *ice.Message, arg ...string) {
s.Table.Create(m, kit.Simple(arg, m.OptionSimple(model.USER_UID, model.AUTH_UID))...)
s.recordEventWithName(m, "")
s.RecordEventWithName(m, "")
}
func (s cert) List(m *ice.Message, arg ...string) {
s.TablesWithRole(m, arg, s.userAuth, s.auth, s, model.TITLE, model.CONTENT).Display("")

View File

@ -60,17 +60,6 @@ func (s Table) RewriteAppend(m *ice.Message, arg ...string) *ice.Message {
})
return s.Table.RewriteAppend(m)
}
func (s Table) CheckRole(m *ice.Message, arg ...string) *ice.Message {
role := UserAuthRole(kit.Int(m.Cmd(userAuth{}, s.Select, m.OptionSimple(model.AUTH_UID, model.USER_UID)).Append(model.ROLE)))
m.WarnNotRight(!kit.IsIn(role.String(), append(arg, UserAuthCreator.String())...), role.String())
return m
}
func (s Table) recordEvent(m *ice.Message, info string, arg ...string) {
s.Table.RecordEvent(m, m.Option(model.AUTH_UID), info, kit.Select(m.Option(model.UID), arg, 0))
}
func (s Table) recordEventWithName(m *ice.Message, info string, arg ...string) {
s.Table.RecordEventWithName(m, m.Option(model.AUTH_UID), info)
}
type Tables struct{ Table }

View File

@ -11,7 +11,7 @@ import (
type Portal struct {
gonganxitong.Portal
placeCreate string `name:"placeCreate city_name* company_name* auth_type*:select auth_name* from_uid*:select" role:"void"`
placeCreate string `name:"placeCreate city_name* company_name* auth_type*:select auth_name*" role:"void"`
}
func (s Portal) List(m *ice.Message, arg ...string) {
@ -19,26 +19,26 @@ func (s Portal) List(m *ice.Message, arg ...string) {
kit.If(len(arg) == 0 && m.Length() > 0, func() { m.PushAction(s.PlaceRemove) })
}
func (s Portal) PlaceCreate(m *ice.Message, arg ...string) {
if m.Option(model.FROM_UID) == "auto" {
if m.Option(model.AUTH_TYPE) == ice.AUTO {
arg = append(arg, model.AUTH_TYPE, m.Option(model.AUTH_TYPE, AuthService))
}
from := ""
switch AuthType(kit.Int(m.Option(model.AUTH_TYPE))) {
case AuthRoot:
from = "root"
case AuthCity:
from = s.findAuthFrom(m, AuthRoot)
case AuthCompany, AuthPersonal:
from = s.findAuthFrom(m, AuthCity, model.NAME, m.Option(model.CITY_NAME))
case AuthService:
city_uid := s.findAuthFrom(m, AuthCity, model.NAME, m.Option(model.CITY_NAME))
if city_uid == "" {
return
}
if city_uid := s.findAuthFrom(m, AuthCity, model.NAME, m.Option(model.CITY_NAME)); city_uid != "" {
from = s.findAuthFrom(m, AuthCompany, model.NAME, m.Option(model.COMPANY_NAME), model.FROM_UID, city_uid)
}
}
if from == "" {
return
}
arg = append(arg, model.FROM_UID, m.Option(model.FROM_UID, from))
}
if m.WarnNotRight(AuthType(kit.Int(m.Option(model.AUTH_TYPE))) == AuthRoot && !m.IsTech()) {
return
}
@ -49,8 +49,7 @@ func (s Portal) PlaceCreate(m *ice.Message, arg ...string) {
}
func (s Portal) PlaceList(m *ice.Message, arg ...string) *ice.Message {
s.Tables(m, "left join auths on user_auths.auth_uid = auths.uid").FieldsWithCreatedAT(m, s.UserPlace,
s.Keys(s.Place, model.NAME), s.Keys(s.Place, model.TYPE), s.Keys(s.UserPlace, model.ROLE),
s.Keys(s.Place, model.STATUS),
s.Keys(s.Place, model.NAME), s.Keys(s.Place, model.TYPE), s.Keys(s.Place, model.STATUS), s.Keys(s.UserPlace, model.ROLE),
s.AS(s.Key(s.Place, model.UID), s.Keys(s.Place, model.UID)), s.Keys(s.Street, model.UID),
)
if len(arg) == 1 {

View File

@ -1,11 +1,8 @@
{
"portal": "认证授权",
"cert": "上传证件",
"auth": "认证授权",
"certList": "证件",
"memberList": "成员",
"issue": "认证",
"revoke": "吊销",
"cert": "上传证件", "auth": "认证授权",
"certList": "证件", "memberList": "成员",
"issue": "认证", "revoke": "吊销",
"style": {
"revoke": "danger"
},
@ -16,10 +13,11 @@
"input": {
"My Auth": "我的认证",
"user_auth_role": "用户角色",
"from_uid": "认证机构",
"auth_uid": "认证",
"auth_name": "主体名称",
"auth_type": "主体类型",
"auth_status": "认证状态"
"auth_status": "认证状态",
"from_uid": "认证机构"
},
"value": {
"user_auth_role": {
@ -36,9 +34,11 @@
"auth_type": {
"root": "官方",
"city": "城市",
"company": "公司",
"service": "服务",
"personal": "个人",
"service": "服务",
"company": "公司",
"school": "学校",
"street": "街道",
"style": {
"root": "danger",
"city": "danger"

View File

@ -1,27 +1,16 @@
package renzhengshouquan
import "shylinux.com/x/ice"
import (
"shylinux.com/x/ice"
"shylinux.com/x/enterprise/src/guanlixitong"
)
type userAuth struct{ Table }
func init() { ice.TeamCtxCmd(userAuth{}) }
type UserAuthRole int
type UserAuthRole = guanlixitong.UserGroupRole
const (
UserAuthVisitor UserAuthRole = iota
UserAuthCreator
UserAuthLeader
UserAuthWorker
UserAuthServer
)
var UserAuthRoleList = map[UserAuthRole]string{
UserAuthVisitor: "visitor",
UserAuthCreator: "creator",
UserAuthLeader: "leader",
UserAuthWorker: "worker",
UserAuthServer: "server",
}
func (s UserAuthRole) String() string { return UserAuthRoleList[s] }
var UserAuthCreator = guanlixitong.UserGroupCreator
var UserAuthRoleList = guanlixitong.UserGroupRoleList

View File

@ -1,4 +1,4 @@
package ludengguanli
package gonganxitong
import "shylinux.com/x/ice"

View File

@ -37,22 +37,9 @@ func (s Table) RewriteAppend(m *ice.Message, arg ...string) *ice.Message {
})
return s.Table.RewriteAppend(m)
}
func (s Table) CheckRole(m *ice.Message, arg ...string) *ice.Message {
role := UserQueueRole(kit.Int(m.Cmd(userQueue{}, s.Select, m.OptionSimple(model.QUEUE_UID, model.USER_UID)).Append(model.ROLE)))
m.WarnNotRight(!kit.IsIn(role.String(), append(arg, UserQueueCreator.String())...), role.String())
return m
}
func (s Table) recordEvent(m *ice.Message, info string, arg ...string) {
s.Table.RecordEvent(m, m.Option(model.QUEUE_UID), info, kit.Select(m.Option(model.UID), arg, 0))
}
func (s Table) recordEventWithName(m *ice.Message, info string) {
s.Table.RecordEventWithName(m, m.Option(model.QUEUE_UID), info)
}
type Tables struct{ Table }
func (s Tables) BeforeMigrate(m *ice.Message, arg ...string) {}
func newTable() Table {
return Table{Table: guanlixitong.NewTable(userQueue{}, queue{})}
}
func newTable() Table { return Table{Table: guanlixitong.NewTable(userQueue{}, queue{})} }

View File

@ -9,9 +9,9 @@ import (
type open struct {
Tables
volume volume
create string `name:"plan reception_uid*:select amount* begin_time*:select@date end_time*:select@date" role:"manager"`
list string `name:"list queue_uid uid auto" role:"manager"`
volume Volume
create string `name:"plan reception_uid*:select amount* begin_time*:select@date end_time*:select@date" role:"leader"`
list string `name:"list queue_uid uid auto" role:"leader"`
}
func (s open) Create(m *ice.Message, arg ...string) {

View File

@ -1,26 +1,18 @@
{
"portal": "约号系统",
"queueUser": "服务人员",
"reception": "服务场所",
"volume": "服务计划",
"schedule": "订单数据",
"history": "我的订单",
"open": "放号",
"plan": "约号",
"take": "取号",
"call": "叫号",
"expire": "过号",
"finish": "完成",
"open": "放号", "plan": "约号", "take": "取号", "call": "叫号",
"reception": "服务场所", "volume": "服务计划", "schedule": "订单数据", "history": "我的订单", "queueUser": "服务人员",
"expire": "过号", "finish": "完成",
"icons": {
"queueUser": "https://img.icons8.com/officel/80/person-at-home.png",
"open": "https://img.icons8.com/officel/80/open-sign.png",
"plan": "https://img.icons8.com/officel/80/calendar-plus.png",
"take": "https://img.icons8.com/officel/80/receipt.png",
"call": "https://img.icons8.com/officel/80/calling.png",
"reception": "https://img.icons8.com/officel/80/meeting-room.png",
"volume": "https://img.icons8.com/officel/80/combo-chart.png",
"schedule": "https://img.icons8.com/officel/80/List-of-parts.png",
"history": "https://img.icons8.com/officel/80/order-history.png",
"open": "https://img.icons8.com/officel/80/open-sign.png",
"plan": "https://img.icons8.com/officel/80/calendar-plus.png",
"take": "https://img.icons8.com/officel/80/receipt.png",
"call": "https://img.icons8.com/officel/80/calling.png"
"queueUser": "https://img.icons8.com/officel/80/person-at-home.png"
},
"style": {
"expire": "danger"
@ -49,12 +41,12 @@
"user_queue_role": {
"visitor": "访客",
"creator": "创建人",
"manager": "管理员",
"worker": "工作员",
"waiter": "接待员",
"leader": "管理人员",
"worker": "工作员",
"server": "服务人员",
"style": {
"creator": "danger",
"manager": "danger"
"leader": "danger"
}
},
"queue_type": {

View File

@ -2,3 +2,23 @@ chapter "约号系统"
field web.code.mysql.client
field web.code.mysql.query args `mysql yuehaoxitong`
field web.code.db.models
order `
userQueue.go
queue.go
reception.go
volume.go
volume.js
schedule.go
schedule.js
history.go
plan.go
take.go
call.go
open.go
common.go
portal.go
portal.json
portal.shy
model
`

View File

@ -9,22 +9,22 @@ import (
type reception struct {
Table
create string `name:"create name*" role:"manager"`
rename string `name:"rename name*" role:"manager"`
remove string `name:"remove" role:"manager"`
create string `name:"create name*" role:"leader"`
rename string `name:"rename name*" role:"leader"`
remove string `name:"remove" role:"leader"`
}
func (s reception) Create(m *ice.Message, arg ...string) {
s.Table.Create(m, append(arg, m.OptionSimple(model.QUEUE_UID)...)...)
s.recordEventWithName(m, "")
s.RecordEventWithName(m, "")
}
func (s reception) Remove(m *ice.Message, arg ...string) {
s.Table.Delete(m, m.OptionSimple(model.QUEUE_UID, model.UID)...)
s.recordEventWithName(m, "")
s.RecordEventWithName(m, "")
}
func (s reception) Rename(m *ice.Message, arg ...string) {
s.Table.Rename(m, m.OptionSimple(model.QUEUE_UID, model.UID)...)
s.recordEventWithName(m, "")
s.RecordEventWithName(m, "")
}
func (s reception) List(m *ice.Message, arg ...string) {
s.Table.Fields(m, model.UID, model.NAME, model.CREATED_AT)

View File

@ -13,7 +13,7 @@ type Schedule struct {
queue queue
userQueue userQueue
reception reception
volume volume
volume Volume
models string `data:"schedule"`
plan string `name:"plan begin_time@date end_time@date"`
}
@ -55,11 +55,14 @@ func (s Schedule) List(m *ice.Message, arg ...string) {
model.CANCEL_TIME, model.TAKE_TIME, model.CALL_TIME, model.EXPIRE_TIME, model.FINISH_TIME,
s.Key(s, model.CALL_UID), s.Key(s, model.RECEPTION_UID), model.USER_UID, model.VOLUME_UID,
)
if role == UserQueueCreator || role == UserQueueManager {
if role == UserQueueCreator || role == UserQueueLeader {
if len(arg) == 1 {
s.Select(m, s.Key(s, model.QUEUE_UID), arg[0])
} else if len(arg) == 2 {
s.SelectDetail(m, s.Key(s, model.QUEUE_UID), arg[0], s.Key(s, model.UID), arg[1])
if ScheduleStatus(kit.Int(m.Append(model.SCHEDULE_STATUS))) == ScheduleFinish {
s.DoneMessage(m)
}
}
m.Table(func(value ice.Maps) {
switch ScheduleStatus(kit.Int(value[model.SCHEDULE_STATUS])) {
@ -76,6 +79,9 @@ func (s Schedule) List(m *ice.Message, arg ...string) {
s.Select(m, s.Key(s, model.QUEUE_UID), arg[0], model.CALL_UID, m.Option(model.USER_UID))
} else if len(arg) == 2 {
s.SelectDetail(m, s.Key(s, model.QUEUE_UID), arg[0], model.CALL_UID, m.Option(model.USER_UID), s.Key(s, model.UID), arg[1])
if ScheduleStatus(kit.Int(m.Append(model.SCHEDULE_STATUS))) == ScheduleFinish {
s.DoneMessage(m)
}
}
m.Table(func(value ice.Maps) {
switch ScheduleStatus(kit.Int(value[model.SCHEDULE_STATUS])) {

View File

@ -1,23 +1,21 @@
Volcanos(chat.ONIMPORT, {
_init: function(can, msg) {
can.onimport.itemcards(can, msg, function(value) {
var time = {view: html.STATUS, list: [{text: can.user.trans(can, "begin_time:", "开始时间:")}, {text: value.begin_time}]}
var time = {view: html.STATUS, list: [can.user.trans(can, "begin_time:", "开始时间:"), value.begin_time]}
if (value.finish_time) {
time = {view: html.STATUS, list: [{text: can.user.trans(can, "finish_time:", "完成时间:")}, {text: value.finish_time}]}
time = {view: html.STATUS, list: [can.user.trans(can, "finish_time:", "完成时间:"), value.finish_time]}
} else if (value.expire_time) {
time = {view: html.STATUS, list: [{text: can.user.trans(can, "expired_time:", "过号时间:")}, {text: value.expire_time}]}
time = {view: html.STATUS, list: [can.user.trans(can, "expired_time:", "过号时间:"), value.expire_time]}
} else if (value.call_time) {
time = {view: html.STATUS, list: [{text: can.user.trans(can, "call_time:", "叫号时间:")}, {text: value.call_time}]}
time = {view: html.STATUS, list: [can.user.trans(can, "call_time:", "叫号时间:"), value.call_time]}
} else if (value.take_time) {
time = {view: html.STATUS, list: [{text: can.user.trans(can, "take_time:", "取号时间:")}, {text: value.take_time}]}
time = {view: html.STATUS, list: [can.user.trans(can, "take_time:", "取号时间:"), value.take_time]}
} else {
var _time = {view: html.STATUS, list: [{text: can.user.trans(can, "finish_time:", "结束时间:")}, {text: value.end_time}]}
var _time = {view: html.STATUS, list: [can.user.trans(can, "finish_time:", "结束时间:"), value.end_time]}
}
return [
{view: html.TITLE, list:[{text: [value.name||value.user_name]}, {text: value.reception_name},
value.schedule_status != "finish" && can.onimport.textView(can, value, "schedule_status", mdb.STATUS)
]},
{view: html.STATUS, list: [value.uid && {text: value.uid.slice(0, 6)}, {text: can.base.TimeTrim(value.created_at||value.updated_at)}]},
{view: html.TITLE, list:[value.name||value.user_name, value.reception_name, value.schedule_status != "finish" && can.onimport.textView(can, value, "schedule_status")]},
{view: html.STATUS, list: [value.uid && value.uid.slice(0, 6), can.base.TimeTrim(value.created_at||value.updated_at)]},
time, _time,
]
})

View File

@ -1,27 +1,18 @@
package yuehaoxitong
import "shylinux.com/x/ice"
import (
"shylinux.com/x/ice"
"shylinux.com/x/enterprise/src/guanlixitong"
)
type userQueue struct{ Table }
func init() { ice.TeamCtxCmd(userQueue{}) }
type UserQueueRole int
type UserQueueRole = guanlixitong.UserGroupRole
const (
UserQueueVisitor UserQueueRole = iota
UserQueueCreator
UserQueueManager
UserQueueWorker
UserQueueWaiter
)
var UserQueueRoleList = map[UserQueueRole]string{
UserQueueVisitor: "visitor",
UserQueueCreator: "creator",
UserQueueManager: "manager",
UserQueueWorker: "worker",
UserQueueWaiter: "waiter",
}
func (s UserQueueRole) String() string { return UserQueueRoleList[s] }
var UserQueueCreator = guanlixitong.UserGroupCreator
var UserQueueLeader = guanlixitong.UserGroupLeader
var UserQueueWorker = guanlixitong.UserGroupWorker
var UserQueueRoleList = guanlixitong.UserGroupRoleList

View File

@ -6,12 +6,12 @@ import (
"shylinux.com/x/community/src/yuehaoxitong/model"
)
type volume struct {
type Volume struct {
Table
reception reception
}
func (s volume) List(m *ice.Message, arg ...string) {
func (s Volume) List(m *ice.Message, arg ...string) {
if len(arg) == 0 {
if m.Option(model.RECEPTION_UID) != "" {
s.Fields(m, model.UID, model.BEGIN_TIME, model.END_TIME, model.AMOUNT, model.COUNT)
@ -31,4 +31,4 @@ func (s volume) List(m *ice.Message, arg ...string) {
}
}
func init() { ice.TeamCtxCmd(volume{}) }
func init() { ice.TeamCtxCmd(Volume{}) }

View File

@ -2,8 +2,9 @@
"153c93456004ec2ca692d3bac2223167": {
"meta": {
"_target": [
"d21f8cd636d4b90986a476e4746c1b25"
"1ea42eae74cf53fef09cb97072c7ef3f"
],
"command_uid": "83d4efad4f2b72919b65029666765614",
"enable": "true",
"icons": "https://img.icons8.com/officel/80/activity-grid.png",
"index": "web.team.gonganxitong.service",
@ -15,13 +16,14 @@
"27c6988eeb07c78cbb49aa15c577cfa4": {
"meta": {
"_target": [
"d21f8cd636d4b90986a476e4746c1b25"
"1ea42eae74cf53fef09cb97072c7ef3f"
],
"command_uid": "11575389a2e0f7117cef75efa0009ab2",
"enable": "true",
"icons": "https://img.icons8.com/officel/80/edit-property.png",
"index": "web.team.gonganxitong.apply",
"name": "权限申请",
"order": "92",
"order": "91",
"role": "creator",
"time": "2024-08-06 18:49:10.193"
}
@ -29,13 +31,14 @@
"58724bdcc3cae3e26700cb3199e0602c": {
"meta": {
"_target": [
"d21f8cd636d4b90986a476e4746c1b25"
"1ea42eae74cf53fef09cb97072c7ef3f"
],
"command_uid": "cbe13c448ddc4165cc83b39d18403d2e",
"enable": "true",
"icons": "https://img.icons8.com/officel/80/person-at-home.png",
"index": "web.team.gonganxitong.placeUser",
"name": "场景成员",
"order": "5",
"order": "80",
"role": "creator,landlord",
"time": "2024-08-07 19:32:54.758"
}
@ -43,19 +46,24 @@
"8ce4dfb877e04e3be5144253fdd5d8ff": {
"meta": {
"_target": [
"d21f8cd636d4b90986a476e4746c1b25"
"1ea42eae74cf53fef09cb97072c7ef3f"
],
"command_uid": "bc8b6dfb0ec2da2bc6c2f8e9dda44a2b",
"enable": "true",
"icons": "https://img.icons8.com/officel/80/receipt-approved.png",
"index": "web.team.gonganxitong.allow",
"name": "权限审批",
"order": "93",
"order": "92",
"role": "creator,landlord",
"time": "2024-08-16 10:29:07.314"
}
},
"a89a7c09e326295aaa7e7ea3d66fb28a": {
"meta": {
"_target": [
"1ea42eae74cf53fef09cb97072c7ef3f"
],
"command_uid": "99210db7e0aba72bdbc5b02c883a5fc4",
"enable": "true",
"icons": "https://img.icons8.com/officel/80/customer-support.png",
"index": "web.team.gonganxitong.support",
@ -67,19 +75,24 @@
"bdec92d5849b2a60a8811cff494f2391": {
"meta": {
"_target": [
"d21f8cd636d4b90986a476e4746c1b25"
"1ea42eae74cf53fef09cb97072c7ef3f"
],
"command_uid": "30cb4371dcc29e54179f490e28bfa703",
"enable": "true",
"icons": "https://img.icons8.com/officel/80/property-with-timer.png",
"index": "web.team.gonganxitong.event",
"name": "事件流",
"order": "91",
"order": "93",
"role": "creator,landlord",
"time": "2024-08-06 18:45:35.911"
}
},
"be08ca65be90feca325df128a06e440f": {
"meta": {
"_target": [
"1ea42eae74cf53fef09cb97072c7ef3f"
],
"command_uid": "4de281dfb9bc5a133a71fd35e54c232d",
"enable": "true",
"icons": "https://img.icons8.com/officel/80/multiple-smartphones.png",
"index": "web.team.gonganxitong.recent",
@ -91,8 +104,9 @@
"e2117b53c036a72fe7e4885449488a6f": {
"meta": {
"_target": [
"d21f8cd636d4b90986a476e4746c1b25"
"1ea42eae74cf53fef09cb97072c7ef3f"
],
"command_uid": "2a4e3bbca1c1cd08b8b8490feb8d66ca",
"enable": "true",
"icons": "https://img.icons8.com/officel/80/qr-code.png",
"index": "web.team.gonganxitong.qrcode",
@ -104,6 +118,10 @@
},
"fd1884bbeb1f1a83f4e12f857bfe5b15": {
"meta": {
"_target": [
"1ea42eae74cf53fef09cb97072c7ef3f"
],
"command_uid": "f7cc070fc70fa9e5d9f4b02f40b7bd5b",
"enable": "true",
"icons": "https://img.icons8.com/officel/80/test-partial-passed.png",
"index": "web.team.gonganxitong.message",
@ -115,8 +133,10 @@
"fd86aad80a667152781bb188fb1249a2": {
"meta": {
"_target": [
"d21f8cd636d4b90986a476e4746c1b25"
"1ea42eae74cf53fef09cb97072c7ef3f"
],
"command_uid": "c019bb1f404c5b324f88356b77254705",
"disable": "false",
"enable": "false",
"icons": "https://img.icons8.com/officel/80/reading-confirmation.png",
"index": "web.team.gonganxitong.email",

View File

@ -2,7 +2,7 @@
"030e2a53ca3561a0d0d123c133a88b59": {
"meta": {
"_target": [
"d21f8cd636d4b90986a476e4746c1b25"
"1ea42eae74cf53fef09cb97072c7ef3f"
],
"icons": "https://img.icons8.com/officel/80/qr-code.png",
"index": "web.team.guanlixitong.qrcode",
@ -15,7 +15,7 @@
"057616b7366e1930ef4e4a921fe45f1f": {
"meta": {
"_target": [
"306ed30ecb65122a0ccbad22ba1de6f9"
"1ea42eae74cf53fef09cb97072c7ef3f"
],
"icons": "https://img.icons8.com/officel/80/activity-grid.png",
"index": "web.team.guanlixitong.service",
@ -28,7 +28,7 @@
"30bfa47cab4cd689901fd2e1b87eb235": {
"meta": {
"_target": [
"d21f8cd636d4b90986a476e4746c1b25"
"1ea42eae74cf53fef09cb97072c7ef3f"
],
"icons": "https://img.icons8.com/officel/80/receipt-approved.png",
"index": "web.team.guanlixitong.allow",
@ -41,7 +41,7 @@
"5695d50b28872804a01d7c923ee91cd1": {
"meta": {
"_target": [
"d21f8cd636d4b90986a476e4746c1b25"
"1ea42eae74cf53fef09cb97072c7ef3f"
],
"icons": "https://img.icons8.com/officel/80/person-at-home.png",
"index": "web.team.guanlixitong.member",
@ -59,7 +59,7 @@
"9c18032c5bc252f2986e1b20e7e77db7": {
"meta": {
"_target": [
"d21f8cd636d4b90986a476e4746c1b25"
"1ea42eae74cf53fef09cb97072c7ef3f"
],
"icons": "https://img.icons8.com/officel/80/property-with-timer.png",
"index": "web.team.guanlixitong.event",
@ -71,6 +71,9 @@
},
"9fffbe375e2d2a1a8e6cb1f341e35b55": {
"meta": {
"_target": [
"1ea42eae74cf53fef09cb97072c7ef3f"
],
"icons": "https://img.icons8.com/officel/80/multiple-smartphones.png",
"index": "web.team.guanlixitong.recent",
"name": "最近访问",
@ -99,6 +102,9 @@
},
"c27ad1df8aa9059d6018fb5add5ee546": {
"meta": {
"_target": [
"1ea42eae74cf53fef09cb97072c7ef3f"
],
"icons": "https://img.icons8.com/officel/80/customer-support.png",
"index": "web.team.guanlixitong.support",
"name": "客服支持",
@ -109,7 +115,7 @@
"c36d47e2611b0d1e7a14088bc3293d04": {
"meta": {
"_target": [
"d21f8cd636d4b90986a476e4746c1b25"
"1ea42eae74cf53fef09cb97072c7ef3f"
],
"icons": "https://img.icons8.com/officel/80/edit-property.png",
"index": "web.team.guanlixitong.apply",
@ -121,6 +127,9 @@
},
"d25f3f88261ead2a0079415a26aa6853": {
"meta": {
"_target": [
"1ea42eae74cf53fef09cb97072c7ef3f"
],
"icons": "https://img.icons8.com/officel/80/test-partial-passed.png",
"index": "web.team.guanlixitong.message",
"name": "消息待办",

View File

@ -1,6 +1,10 @@
{
"3229a1bc7aa326822c4f4f267e038185": {
"meta": {
"_target": [
"1ea42eae74cf53fef09cb97072c7ef3f"
],
"command_uid": "4ee52ea2c41ba393f98da5ebc07b573e",
"enable": "true",
"icons": "https://img.icons8.com/officel/80/person-at-home.png",
"index": "web.team.huodongzuzhi.member",
@ -11,6 +15,10 @@
},
"595eb34d7ebe62e160c02ed5b127d637": {
"meta": {
"_target": [
"1ea42eae74cf53fef09cb97072c7ef3f"
],
"command_uid": "846e5a7a23ef17577c97816ff420f079",
"enable": "true",
"icons": "https://img.icons8.com/officel/80/test-partial-passed.png",
"index": "web.team.huodongzuzhi.message",
@ -21,6 +29,10 @@
},
"780939d4c095806dba8711d8753cbdf7": {
"meta": {
"_target": [
"1ea42eae74cf53fef09cb97072c7ef3f"
],
"command_uid": "53cb8e90834b66404cc753fb8409c47f",
"enable": "true",
"icons": "https://img.icons8.com/officel/80/customer-support.png",
"index": "web.team.huodongzuzhi.support",
@ -31,6 +43,10 @@
},
"7a7da5c5e42a9aa1d88109fa8620d465": {
"meta": {
"_target": [
"1ea42eae74cf53fef09cb97072c7ef3f"
],
"command_uid": "e87ea0c194eb29a8a90f2287dc8af5ee",
"enable": "true",
"icons": "https://img.icons8.com/officel/80/property-with-timer.png",
"index": "web.team.huodongzuzhi.event",
@ -42,6 +58,10 @@
},
"94996b048561b144e2a47ff6cc2a9e5c": {
"meta": {
"_target": [
"1ea42eae74cf53fef09cb97072c7ef3f"
],
"command_uid": "e53c9f8bb8ce14b2721dc58477ed4ada",
"enable": "true",
"icons": "https://img.icons8.com/officel/80/activity-grid.png",
"index": "web.team.huodongzuzhi.service",
@ -52,6 +72,10 @@
},
"a59f36877482d1aef49c1dfb61516602": {
"meta": {
"_target": [
"1ea42eae74cf53fef09cb97072c7ef3f"
],
"command_uid": "60997764934f1161a37a3e122390347d",
"enable": "true",
"icons": "https://img.icons8.com/officel/80/activity-grid.png",
"index": "web.team.huodongzuzhi.activity",
@ -62,6 +86,10 @@
},
"baec1db59218f2da9d560fa719c6a12f": {
"meta": {
"_target": [
"1ea42eae74cf53fef09cb97072c7ef3f"
],
"command_uid": "c305e063446b6847eb82b1613cf54c5b",
"enable": "true",
"icons": "https://img.icons8.com/officel/80/edit-property.png",
"index": "web.team.huodongzuzhi.apply",
@ -73,6 +101,10 @@
},
"c3fbb2049e914eda48f3f7d32c207679": {
"meta": {
"_target": [
"1ea42eae74cf53fef09cb97072c7ef3f"
],
"command_uid": "7281225a2ac4c155bc9c517e5a3b80ab",
"enable": "true",
"icons": "https://img.icons8.com/officel/80/qr-code.png",
"index": "web.team.huodongzuzhi.qrcode",
@ -84,6 +116,10 @@
},
"dae66500cd381d400f15cd4c9efc05b1": {
"meta": {
"_target": [
"1ea42eae74cf53fef09cb97072c7ef3f"
],
"command_uid": "66479946e5e3276c85de92bf56773bf0",
"enable": "true",
"icons": "https://img.icons8.com/officel/80/receipt-approved.png",
"index": "web.team.huodongzuzhi.allow",
@ -95,6 +131,10 @@
},
"f77a8f8d7dfe49f8e82ecd8d0b99f233": {
"meta": {
"_target": [
"1ea42eae74cf53fef09cb97072c7ef3f"
],
"command_uid": "0adc32902ddcdfdeaa85701326c7221b",
"enable": "true",
"icons": "https://img.icons8.com/officel/80/multiple-smartphones.png",
"index": "web.team.huodongzuzhi.recent",

View File

@ -2,8 +2,9 @@
"03dd65a55edd011c4dee41bd0d834070": {
"meta": {
"_target": [
"d21f8cd636d4b90986a476e4746c1b25"
"1ea42eae74cf53fef09cb97072c7ef3f"
],
"command_uid": "f1cc8c346fe24391a70c5a87da6f9a65",
"enable": "true",
"icons": "https://img.icons8.com/officel/80/receipt.png",
"index": "web.team.yuehaoxitong.take",
@ -15,20 +16,25 @@
"1931ecf1d36391b72df54d374a91c8ed": {
"meta": {
"_target": [
"d21f8cd636d4b90986a476e4746c1b25"
"1ea42eae74cf53fef09cb97072c7ef3f"
],
"command_uid": "06bc6d3fed2c04d7d9fd297bf31ccf9f",
"enable": "true",
"icons": "https://img.icons8.com/officel/80/meeting-room.png",
"index": "web.team.yuehaoxitong.reception",
"init": "1",
"name": "服务场所",
"order": "20",
"role": "creator,manager",
"role": "creator,leader",
"time": "2024-08-11 09:30:00.536"
}
},
"377f3c0dae9dbf423a8e188bfd245b7a": {
"meta": {
"_target": [
"1ea42eae74cf53fef09cb97072c7ef3f"
],
"command_uid": "875c8177dc96b0e7f252abe1298fa2b1",
"enable": "true",
"icons": "https://img.icons8.com/officel/80/multiple-smartphones.png",
"index": "web.team.yuehaoxitong.recent",
@ -40,61 +46,69 @@
"3b6da44aaf19fdb06c84fe352569359f": {
"meta": {
"_target": [
"d21f8cd636d4b90986a476e4746c1b25"
"1ea42eae74cf53fef09cb97072c7ef3f"
],
"command_uid": "6647858949f2b36364d72856ac0321fb",
"enable": "true",
"icons": "https://img.icons8.com/officel/80/qr-code.png",
"index": "web.team.yuehaoxitong.qrcode",
"name": "场景码",
"order": "90",
"role": "creator,manager",
"role": "creator,leader",
"time": "2024-08-11 09:30:00.550"
}
},
"46f2ba39a0620f04aab46a999c359a2b": {
"meta": {
"_target": [
"d21f8cd636d4b90986a476e4746c1b25"
"1ea42eae74cf53fef09cb97072c7ef3f"
],
"command_uid": "f0bf560b63dab022f4b14b4a70949d29",
"enable": "true",
"icons": "https://img.icons8.com/officel/80/receipt-approved.png",
"index": "web.team.yuehaoxitong.allow",
"name": "权限审批",
"order": "93",
"role": "creator,manager",
"role": "creator,leader",
"time": "2024-08-16 10:29:53.817"
}
},
"75c5c1863c1bdaf0bcbd3065b661528d": {
"meta": {
"_target": [
"d21f8cd636d4b90986a476e4746c1b25"
"1ea42eae74cf53fef09cb97072c7ef3f"
],
"command_uid": "dfa3d796f18710e67b42af8e8db198a1",
"enable": "true",
"icons": "https://img.icons8.com/officel/80/calling.png",
"index": "web.team.yuehaoxitong.call",
"name": "叫号",
"order": "13",
"role": "creator,manager,worker",
"role": "creator,leader,worker",
"time": "2024-08-11 09:30:00.541"
}
},
"7792f1a5145ab9d894a1681f13729778": {
"meta": {
"_target": [
"d21f8cd636d4b90986a476e4746c1b25"
"1ea42eae74cf53fef09cb97072c7ef3f"
],
"command_uid": "533d41a5b85b87e96b4fee6f960e8de1",
"enable": "true",
"icons": "https://img.icons8.com/officel/80/List-of-parts.png",
"index": "web.team.yuehaoxitong.schedule",
"name": "订单数据",
"order": "22",
"role": "creator,manager",
"role": "creator,leader",
"time": "2024-08-11 09:30:00.538"
}
},
"98d6d53a44113b33a82c4e914cb23489": {
"meta": {
"_target": [
"1ea42eae74cf53fef09cb97072c7ef3f"
],
"command_uid": "da2e0f2520ed808de772a50eb15b919e",
"enable": "true",
"icons": "https://img.icons8.com/officel/80/test-partial-passed.png",
"index": "web.team.yuehaoxitong.message",
@ -106,33 +120,39 @@
"a56cb18131ff45616849e4555e29d35d": {
"meta": {
"_target": [
"d21f8cd636d4b90986a476e4746c1b25"
"1ea42eae74cf53fef09cb97072c7ef3f"
],
"command_uid": "4fcab130ad621b3fd6d4539c9ca19339",
"enable": "true",
"icons": "https://img.icons8.com/officel/80/edit-property.png",
"index": "web.team.yuehaoxitong.apply",
"name": "权限申请",
"order": "92",
"role": "creator,manager",
"role": "creator,leader",
"time": "2024-08-11 09:30:00.552"
}
},
"a947b7294674c071e22eac02d14508bc": {
"meta": {
"_target": [
"d21f8cd636d4b90986a476e4746c1b25"
"1ea42eae74cf53fef09cb97072c7ef3f"
],
"command_uid": "3cb25dd83edaad5efae77a9f48348878",
"enable": "true",
"icons": "https://img.icons8.com/officel/80/combo-chart.png",
"index": "web.team.yuehaoxitong.volume",
"name": "服务计划",
"order": "21",
"role": "creator,manager",
"role": "creator,leader",
"time": "2024-08-11 09:30:00.509"
}
},
"b811b4ed8b1b372958bbb4bb1b2709b8": {
"meta": {
"_target": [
"1ea42eae74cf53fef09cb97072c7ef3f"
],
"command_uid": "7f546479fc3939b16b33e6741fb0997e",
"enable": "true",
"icons": "https://img.icons8.com/officel/80/customer-support.png",
"index": "web.team.yuehaoxitong.support",
@ -144,23 +164,25 @@
"ba468c870a9645a8a162c31c4d860fbd": {
"meta": {
"_target": [
"d21f8cd636d4b90986a476e4746c1b25"
"1ea42eae74cf53fef09cb97072c7ef3f"
],
"command_uid": "1fef277f68667d8006f1607b1adc38e8",
"enable": "true",
"icons": "https://img.icons8.com/officel/80/open-sign.png",
"index": "web.team.yuehaoxitong.open",
"init": "2",
"name": "放号",
"order": "10",
"role": "creator,manager",
"role": "creator,leader",
"time": "2024-08-11 09:30:00.511"
}
},
"bb1119fef63479943de59398943c3580": {
"meta": {
"_target": [
"d21f8cd636d4b90986a476e4746c1b25"
"1ea42eae74cf53fef09cb97072c7ef3f"
],
"command_uid": "84c706501dac6af53271e313d0a80e12",
"enable": "true",
"icons": "https://img.icons8.com/officel/80/order-history.png",
"index": "web.team.yuehaoxitong.history",
@ -172,22 +194,24 @@
"c14a5a400c933fe799ed10b069990865": {
"meta": {
"_target": [
"d21f8cd636d4b90986a476e4746c1b25"
"1ea42eae74cf53fef09cb97072c7ef3f"
],
"command_uid": "3e5e588780da3a6099110a277453246d",
"enable": "true",
"icons": "https://img.icons8.com/officel/80/person-at-home.png",
"index": "web.team.yuehaoxitong.member",
"name": "场景成员",
"order": "80",
"role": "creator,manager",
"role": "creator,leader",
"time": "2024-08-12 08:56:10.816"
}
},
"d1e03d214890c9a4b9557d3f6a36c7e9": {
"meta": {
"_target": [
"306ed30ecb65122a0ccbad22ba1de6f9"
"1ea42eae74cf53fef09cb97072c7ef3f"
],
"command_uid": "bc8ca9d13536017b05ad62f939642983",
"enable": "true",
"icons": "https://img.icons8.com/officel/80/activity-grid.png",
"index": "web.team.yuehaoxitong.service",
@ -199,8 +223,9 @@
"de85331c7182b286624303d7aca70618": {
"meta": {
"_target": [
"d21f8cd636d4b90986a476e4746c1b25"
"1ea42eae74cf53fef09cb97072c7ef3f"
],
"command_uid": "7fd5bd253e5bd8cb87861ff687be6cc3",
"enable": "true",
"icons": "https://img.icons8.com/officel/80/calendar-plus.png",
"index": "web.team.yuehaoxitong.plan",
@ -212,14 +237,15 @@
"fa4365d6c914365e4b047c9266e9a02f": {
"meta": {
"_target": [
"d21f8cd636d4b90986a476e4746c1b25"
"1ea42eae74cf53fef09cb97072c7ef3f"
],
"command_uid": "273f71d061c24fc09b751b7968c7c48a",
"enable": "true",
"icons": "https://img.icons8.com/officel/80/property-with-timer.png",
"index": "web.team.yuehaoxitong.event",
"name": "事件流",
"order": "91",
"role": "creator,manager",
"role": "creator,leader",
"time": "2024-08-11 09:30:00.518"
}
}