This commit is contained in:
IT 老营长 @云轩领航-创始人 2024-08-11 02:04:22 +08:00
parent e7b7d7bb0a
commit f305919245
34 changed files with 541 additions and 366 deletions

View File

@ -32,7 +32,6 @@ func (s apply) Create(m *ice.Message, arg ...string) {
USER_PLACE_ROLE := s.Keys(s.UserPlace, model.ROLE)
arg = kit.TransArgKeys(arg, PLACE_UID, model.PLACE_UID)
arg = kit.TransArgKeys(arg, USER_PLACE_ROLE, model.ROLE)
arg = kit.TransArgValueTime(arg, model.BEGIN_TIME, model.END_TIME)
s.Table.Create(m, kit.Simple(model.PLACE_UID, m.Option(PLACE_UID), arg, m.OptionSimple(model.USER_UID), model.TABLES, PLACE_UID, model.STATUS, ApplyCreate)...)
}
func (s apply) List(m *ice.Message, arg ...string) {
@ -45,13 +44,6 @@ func (s apply) List(m *ice.Message, arg ...string) {
m.EchoInfoButton(m.Trans("please create apply", "请创建权限申请"), s.Create)
return
}
defer m.Sort("apply_status,created_at", []string{
ApplyCreate.String(),
ApplySubmit.String(),
ApplyApproved.String(),
ApplyRejected.String(),
ApplyCancel.String(),
}, ice.STR_R)
} else 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])
if ApplyStatus(kit.Int(m.Append(model.APPLY_STATUS))) == ApplySubmit {
@ -72,11 +64,11 @@ func (s apply) List(m *ice.Message, arg ...string) {
s.Display(m, "")
}
func (s apply) Cancel(m *ice.Message, arg ...string) {
msg := s.status(m, ApplyCreate, ApplyCancel)
s.SendTemplate(m, "", msg.Append(model.USER_UID), m.Trans("role apply canceled", "权限申请 已取消"))
msg := s.changeStatus(m, ApplyCreate, ApplyCancel)
s.sendTemplate(msg, m.Trans("role apply canceled", "权限申请 已取消"))
}
func (s apply) Submit(m *ice.Message, arg ...string) {
msg := s.status(m, ApplyCreate, ApplySubmit)
msg := s.changeStatus(m, ApplyCreate, ApplySubmit)
if m.WarnNotValid(msg.IsErr()) {
return
}
@ -92,24 +84,23 @@ func (s apply) Submit(m *ice.Message, arg ...string) {
if m.WarnNotFound(msg.Length() == 0, role.String()) {
return
}
m.Cmd(order{}, s.Create, msg.AppendSimple(model.USER_UID), model.APPLY_UID, m.Option(model.UID), model.STATUS, OrderCreate)
admin := m.Cmd(s.user, s.Select, model.UID, msg.Append(model.USER_UID)).Append(model.NAME)
s.event.Record(m, kit.Format("🕑 %s"+m.Trans(" apply submit", "权限申请提交"), s.TransRole(m)), m.Option(model.UID))
s.SendTemplate(m, admin, m.Option(model.USER_UID), m.Trans("role apply submited", "权限申请 已提交"))
m.Cmd(m.Prefix("order"), s.Create, msg.AppendSimple(model.USER_UID), model.APPLY_UID, m.Option(model.UID), model.STATUS, OrderCreate)
s.RecordEvent(m, "", kit.Format("🕑 %s"+m.Trans(" apply submit", "权限申请提交"), s.TransRole(m)), m.Option(model.UID))
s.sendTemplate(m, m.Trans("role apply submited", "权限申请 已提交"))
}
func (s apply) Reject(m *ice.Message, arg ...string) {
msg := s.status(m, ApplySubmit, ApplyRejected)
s.SendTemplate(m, "", msg.Append(model.USER_UID), m.Trans("role apply rejected", "权限申请 已驳回"))
msg := s.changeStatus(m, ApplySubmit, ApplyRejected)
s.sendTemplate(msg, m.Trans("role apply rejected", "权限申请 已驳回"))
}
func (s apply) Approve(m *ice.Message, arg ...string) {
msg := s.status(m, ApplySubmit, ApplyApproved)
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(m, "", msg.Append(model.USER_UID), m.Trans("role apply approved", "权限申请 已通过"))
s.sendTemplate(msg, m.Trans("role apply approved", "权限申请 已通过"))
}
func init() { ice.TeamCtxCmd(apply{Table: newTable()}) }
func (s apply) status(m *ice.Message, from, todo ApplyStatus, arg ...string) *ice.Message {
func (s apply) changeStatus(m *ice.Message, from, todo ApplyStatus, arg ...string) *ice.Message {
msg := s.Table.Select(m.Spawn(), m.OptionSimple(model.UID)...)
if !m.WarnNotFound(msg.Length() == 0, m.Option(model.UID)) {
if status := ApplyStatus(kit.Int(msg.Append(model.STATUS))); !m.WarnNotValid(status != from, status.String()) {
@ -118,6 +109,10 @@ func (s apply) status(m *ice.Message, from, todo ApplyStatus, arg ...string) *ic
}
return msg
}
func (s apply) sendTemplate(m *ice.Message, info string) *ice.Message {
s.Table.SendTemplate(m, "", m.Append(model.USER_UID), info)
return m
}
type ApplyStatus int

View File

@ -2,13 +2,12 @@ Volcanos(chat.ONIMPORT, {
_init: function(can, msg) {
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"
if (msg.IsDetail()) { can.onexport.share_title(can, msg, USER_PLACE_ROLE); return msg.Show(can) }
can.onimport.itemcards(can, msg, function(value) { value._style = [value[PLACE_TYPE], value[USER_PLACE_ROLE], value[APPLY_STATUS]]
var status = value[APPLY_STATUS]
return [
{view: html.TITLE, list: [{text: value[PLACE_NAME]},
{text: [can.user.transValue(can, value, PLACE_TYPE), "", mdb.TYPE]},
{text: [can.user.transValue(can, value, USER_PLACE_ROLE), "", [aaa.ROLE, value[USER_PLACE_ROLE]]]},
{text: [can.user.transValue(can, value, PLACE_TYPE), "", [mdb.TYPE, value[PLACE_TYPE], can.onimport.typeStyle(can, value, PLACE_TYPE)]]},
{text: [can.user.transValue(can, value, USER_PLACE_ROLE), "", [aaa.ROLE, value[USER_PLACE_ROLE], can.onimport.roleStyle(can, value, USER_PLACE_ROLE)]]},
]},
{view: html.STATUS, list: [{text: value.uid.slice(0, 6)}, {text: can.base.TimeTrim(value.created_at)},
{text: [can.user.transValue(can, value, APPLY_STATUS)+" "+(status == "create" || status == "submit"? "🕑": status == "rejected"? "❌": "✅"), "", mdb.STATUS]},

View File

@ -62,7 +62,7 @@ func (s Table) List(m *ice.Message, arg ...string) *ice.Message {
if len(arg) == 0 {
s.Select(m)
} else if len(arg) == 2 {
s.SelectDetail(m, model.UID, arg[1])
s.Select(m, model.UID, arg[1])
}
}
return m
@ -85,12 +85,10 @@ func (s Table) TablesWithRole(m *ice.Message, arg []string, target, userPlace, p
}
func (s Table) Select(m *ice.Message, arg ...string) *ice.Message {
defer s.Display(m, "")
defer m.PushAction(s.Delete)
return s.Table.Select(m, arg...)
}
func (s Table) SelectDetail(m *ice.Message, arg ...string) *ice.Message {
defer s.Display(m, "")
defer m.PushAction(s.Delete)
return s.Table.SelectDetail(m, arg...)
}
func (s Table) SelectJoinUser(m *ice.Message) *ice.Message {
@ -99,13 +97,6 @@ func (s Table) SelectJoinUser(m *ice.Message) *ice.Message {
func (s Table) SelectJoinCity(m *ice.Message) *ice.Message {
return s.SelectJoin(m, city{}, model.NAME)
}
func (s Table) ChangeStatus(m *ice.Message, uid string, from, to int, arg ...string) *ice.Message {
msg := s.Select(m.Spawn(), model.UID, uid)
if !m.WarnNotValid(kit.Int(msg.Append(mdb.STATUS)) != int(from)) {
s.Update(m, kit.Dict(mdb.STATUS, to, arg), model.UID, uid)
}
return m
}
func (s Table) RewriteAppend(m *ice.Message, arg ...string) *ice.Message {
m.RewriteAppend(func(value, key string, index int) string {
kit.If(key == model.PLACE_TYPE, func() { value = PlaceType(kit.Int(value)).String() })
@ -132,14 +123,39 @@ func (s Table) TransRole(m *ice.Message, arg ...string) string {
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) ChangeStatus(m *ice.Message, uid string, from, to int, arg ...string) *ice.Message {
msg := s.Select(m.Spawn(), model.UID, uid)
if !m.WarnNotValid(kit.Int(msg.Append(mdb.STATUS)) != int(from)) {
s.Update(m, kit.Dict(mdb.STATUS, to, arg), model.UID, uid)
}
return m
}
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, uid, info string, arg ...string) {
event{}.Record(m.Spawn(kit.Dict(model.PLACE_UID, uid)), info, arg...)
}
func (s Table) SendTemplate(m *ice.Message, from, user_uid, title string) {
if !m.IsErr() {
m.Cmd(user{}, s.SendTemplate, from, user_uid, Portal{}.Link(m, m.Option(s.Keys(s.Place, model.UID)), m.PrefixKey(), m.Option(model.UID)),
title, m.Option(s.Keys(s.Place, model.NAME))+" "+s.Place.TransValue(m, s.Keys(s.UserPlace, model.ROLE)), kit.Cut(m.Option(model.UID), 6))
func (s Table) SendTemplate(m *ice.Message, from, user_uid, title string, arg ...string) {
if m.IsErr() {
return
}
name := kit.Select("", arg, 0)
m.Info("what %v", name)
if name == "" {
m.Info("what %v", name)
name = m.Option(s.Keys(s.Place, model.NAME)) + " " + s.Place.TransValue(m, s.Keys(s.UserPlace, model.ROLE))
m.Info("what %v", s.Keys(s.Place, model.NAME))
}
m.Info("what %v", name)
uid := kit.Select(m.Option(model.UID), arg, 1)
place_uid := kit.Select("", arg, 2)
if place_uid == "" {
place_uid = m.Option(s.Keys(s.Place, model.UID))
}
link := Portal{}.Link(m, place_uid, m.PrefixKey(), uid)
m.Cmd(user{}, s.SendTemplate, from, user_uid, link, title, name, kit.Cut(uid, 6))
}
func (s Table) Display(m *ice.Message, file string) *ice.Message {
if s.Place != nil {
@ -181,20 +197,21 @@ func (s Tables) Link(m *ice.Message, arg ...string) string {
return s.Portal.Link(m, arg...)
}
func (s Tables) BeforeMigrate(m *ice.Message, arg ...string) {
}
func newTables() Tables {
return Tables{Table: newTable()}
}
func newTable() Table {
return Table{UserPlace: userPlace{}, Place: place{}, Street: street{}}
}
func NewTables(userPlace, place Tabler, street Container) Tables {
return Tables{Table: NewTable(userPlace, place, street)}
func newTables() Tables {
return Tables{Table: newTable()}
}
func NewTable(userPlace, place Tabler, street Container) Table {
return Table{UserPlace: userPlace, Place: place, Street: street}
}
func NewTables(userPlace, place Tabler, street Container) Tables {
return Tables{Table: NewTable(userPlace, place, street)}
}
func NewPortal(userPlace, place Tabler, street Container) Portal {
return Portal{Table: Table{UserPlace: userPlace, Place: place, Street: street}}
}

View File

@ -4,8 +4,8 @@ Volcanos(chat.ONIMPORT, {
can.onimport.itemcards(can, msg, function(value) { value._style = [value[PLACE_TYPE]||"", value[USER_PLACE_ROLE]||""]
return [
{view: html.TITLE, list:[{text: [value.name||value.user_name]},
value[PLACE_TYPE] && {text: [value[PLACE_TYPE]||"", "", [mdb.TYPE, value[PLACE_TYPE]||""]]},
value[USER_PLACE_ROLE] && {text: [value[USER_PLACE_ROLE]||"", "", [aaa.ROLE, value[UESR_PLACE_ROLE]||""]]},
value[PLACE_TYPE] && {text: [can.user.transValue(can, value, PLACE_TYPE), "", [mdb.TYPE, value[PLACE_TYPE], can.onimport.typeStyle(can, value, PLACE_TYPE)]]},
value[USER_PLACE_ROLE] && {text: [can.user.transValue(can, value, USER_PLACE_ROLE), "", [aaa.ROLE, value[USER_PLACE_ROLE], can.onimport.roleStyle(can, value, USER_PLACE_ROLE)]]},
]},
{view: html.STATUS, list: [value.uid && {text: value.uid.slice(0, 6)}, {text: can.base.TimeTrim(value.created_at||value.updated_at)}]},
]

View File

@ -16,18 +16,16 @@ type event struct {
}
func (s event) List(m *ice.Message, arg ...string) {
s.Tables(m, s.user).FieldsWithCreatedAT(m, s,
model.USER_AVATAR, model.USER_NAME,
s.Tables(m, s.user).FieldsWithCreatedAT(m, s, model.USER_AVATAR, model.USER_NAME,
ctx.INDEX, model.OPERATE, ctx.ARGS, model.INFO,
)
if len(arg) == 1 {
s.Select(m, model.PLACE_UID, arg[0])
s.Select(m, model.PLACE_UID, arg[0]).Action()
} else if len(arg) == 2 {
s.SelectDetail(m, model.PLACE_UID, arg[0], s.Key(s, model.UID), arg[1])
} else {
return
}
m.PushAction().Action()
s.Display(m, "")
}

View File

@ -2,7 +2,6 @@ Volcanos(chat.ONIMPORT, {
_init: function(can, msg) {
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"), ORDER_STATUS = "order_status"
if (msg.IsDetail()) { can.onexport.share_title(can, msg, USER_PLACE_ROLE); return msg.Show(can) }
can.onimport.itemcards(can, msg, function(value) {
return [
{view: html.TITLE, list: [{text: value.user_name}]},

View File

@ -11,8 +11,8 @@ const (
ROLE = "role"
STATUS = "status"
TABLES = "tables"
ADDRESS = "address"
CONTENT = "content"
ADDRESS = "address"
EMAIL = "email"
AVATAR = "avatar"
OPERATE = "operate"
@ -43,16 +43,16 @@ const (
type Sess struct {
db.ModelWithUID
UserUID string `gorm:"type:char(32)"`
UserUID string `gorm:"type:char(32);index"`
IP string `gorm:"type:char(16)"`
Agent string `gorm:"type:varchar(256)"`
Agent string `gorm:"type:varchar(255)"`
}
type User struct {
db.ModelWithUID
OpenID string `gorm:"type:char(32);index"`
Email string `gorm:"type:char(32)"`
Email string `gorm:"type:char(64)"`
Name string `gorm:"type:char(32)"`
Avatar string `gorm:"type:varchar(256)"`
Avatar string `gorm:"type:varchar(255)"`
}
type UserPlace struct {
db.ModelWithUID
@ -64,15 +64,15 @@ type UserPlace struct {
}
type Place struct {
db.ModelWithUID
StreetUID string `gorm:"type:char(32)"`
Name string `gorm:"type:char(32)"`
Address string `gorm:"type:varchar(256)"`
StreetUID string `gorm:"type:char(32);index"`
Name string `gorm:"type:char(64)"`
Address string `gorm:"type:varchar(255)"`
Type uint8
}
type Street struct {
db.ModelWithUID
CityUID string `gorm:"type:char(32);index"`
Name string `gorm:"type:char(32);index"`
Name string `gorm:"type:char(64);index"`
Info string
}
type City struct {
@ -82,8 +82,8 @@ type City struct {
type Event struct {
db.ModelWithUID
PlaceUID string `gorm:"type:char(32);index"`
UserUID string `gorm:"type:char(32);index"`
PlaceUID string `gorm:"type:char(32);index"`
Index string `gorm:"type:char(32)"`
Operate string `gorm:"type:char(32)"`
Args string `gorm:"type:char(32)"`

View File

@ -21,27 +21,8 @@ type order struct {
func (s order) Create(m *ice.Message, arg ...string) {
s.Table.Create(m, arg...)
s.SendTemplate(m, "", m.Option(model.USER_UID), m.Trans("role order create", "权限审批 请处理"))
}
func (s order) Reject(m *ice.Message, arg ...string) {
defer m.ToastProcess()()
if s.status(m, OrderCreate, OrderRejected); m.IsErr() {
return
}
m.Cmd(s.apply, s.apply.Reject, m.Option(model.UID))
s.event.Record(m, kit.JoinWord("❌", m.Trans("order rejected", "审批驳回"), s.TransRole(m), m.Option(model.USER_NAME)), m.Option(model.UID))
s.SendTemplate(m, m.Option(model.USER_NAME), m.Option(model.USER_UID), m.Trans("role order rejected", "权限审批 已驳回"))
m.ProcessRefresh()
}
func (s order) Approve(m *ice.Message, arg ...string) {
defer m.ToastProcess()()
if s.status(m, OrderCreate, OrderApproved); m.IsErr() {
return
}
m.Cmd(s.apply, s.apply.Approve, m.Option(model.UID))
s.event.Record(m, kit.JoinWord("✅", m.Trans("order approved", "审批通过"), s.TransRole(m), m.Option(model.USER_NAME)), m.Option(model.UID))
s.SendTemplate(m, m.Option(model.USER_NAME), m.Option(model.USER_UID), m.Trans("role order approved", "权限审批 已通过"))
m.ProcessRefresh()
m.Info("what %v", m.FormatChain())
s.sendTemplate(m, m.Trans("role order create", "权限审批 请处理"))
}
func (s order) List(m *ice.Message, arg ...string) {
s.Tables(m, s.apply, "left join users on applies.user_uid = users.uid").FieldsWithCreatedAT(m, s.apply,
@ -68,10 +49,28 @@ func (s order) List(m *ice.Message, arg ...string) {
s.UserPlace.RewriteAppend(m)
s.Display(m, "")
}
func (s order) Reject(m *ice.Message, arg ...string) {
defer m.ToastProcess()()
if s.changeStatus(m, OrderCreate, OrderRejected); m.IsErr() {
return
}
m.Cmdy(m.Prefix("apply"), s.apply.Reject, m.Option(model.UID)).ProcessRefresh()
s.RecordEvent(m, kit.JoinWord("❌", m.Trans("order rejected", "审批驳回"), s.TransRole(m), m.Option(model.USER_NAME)), m.Option(model.UID))
s.sendTemplate(m, m.Trans("role order rejected", "权限审批 已驳回"))
}
func (s order) Approve(m *ice.Message, arg ...string) {
defer m.ToastProcess()()
if s.changeStatus(m, OrderCreate, OrderApproved); m.IsErr() {
return
}
m.Cmdy(m.Prefix("apply"), s.apply.Approve, m.Option(model.UID)).ProcessRefresh()
s.RecordEvent(m, "", kit.JoinWord("✅", m.Trans("order approved", "审批通过"), s.TransRole(m), m.Option(model.USER_NAME)), m.Option(model.UID))
s.sendTemplate(m, m.Trans("role order approved", "权限审批 已通过"))
}
func init() { ice.TeamCtxCmd(order{Table: newTable()}) }
func (s order) status(m *ice.Message, from, todo OrderStatus, arg ...string) *ice.Message {
func (s order) changeStatus(m *ice.Message, from, todo OrderStatus, arg ...string) *ice.Message {
msg := s.Table.Select(m.Spawn(), model.UID, m.Option(model.ORDER_UID), model.USER_UID, m.Option(model.USER_UID))
if !m.WarnNotFound(msg.Length() == 0, m.Option(model.UID)) {
if status := OrderStatus(kit.Int(msg.Append(model.STATUS))); !m.WarnNotValid(status != from, status.String()) {
@ -80,6 +79,10 @@ func (s order) status(m *ice.Message, from, todo OrderStatus, arg ...string) *ic
}
return msg
}
func (s order) sendTemplate(m *ice.Message, info string) *ice.Message {
s.Table.SendTemplate(m, m.Option(model.USER_NAME), m.Append(model.USER_UID), info)
return m
}
type OrderStatus int

View File

@ -2,12 +2,11 @@ Volcanos(chat.ONIMPORT, {
_init: function(can, msg) {
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"), ORDER_STATUS = "order_status"
if (msg.IsDetail()) { can.onexport.share_title(can, msg, USER_PLACE_ROLE); return msg.Show(can) }
can.onimport.itemcards(can, msg, function(value) { value._style = [value[PLACE_TYPE], value[USER_PLACE_ROLE], value[ORDER_STATUS]]
var status = value[ORDER_STATUS]
return [
{view: html.TITLE, list: [{text: value.user_name},
{text: [can.user.transValue(can, value, USER_PLACE_ROLE), "", [aaa.ROLE, value[USER_PLACE_ROLE]]]},
{text: [can.user.transValue(can, value, USER_PLACE_ROLE), "", [aaa.ROLE, value[USER_PLACE_ROLE], can.onimport.roleStyle(can, value, USER_PLACE_ROLE)]]},
]},
{view: html.STATUS, list: [{text: value.uid.slice(0, 6)}, {text: can.base.TimeTrim(value.created_at)},
{text: [can.user.transValue(can, value, ORDER_STATUS)+" "+(status == "create" || status == "submit"? "🕑": status == "rejected"? "❌": "✅"), "", mdb.STATUS]},

View File

@ -1,30 +1,12 @@
package gonganxitong
import (
"shylinux.com/x/ice"
"shylinux.com/x/community/src/gonganxitong/model"
)
import "shylinux.com/x/ice"
type place struct {
Table
user user
}
func (s place) User(m *ice.Message, arg ...string) {
userPlace := userPlace{}
s.Tables(m, "left join user_places on places.uid = user_places.place_uid", s.user).FieldsWithCreatedAT(m, userPlace,
model.USER_AVATAR, model.USER_NAME, model.USER_PLACE_ROLE, model.BEGIN_TIME, model.END_TIME,
)
if len(arg) == 1 {
s.Select(m, model.PLACE_UID, arg[0])
} else if len(arg) == 2 {
s.SelectDetail(m, model.PLACE_UID, arg[0], s.Key(userPlace, model.UID), arg[1])
} else {
return
}
s.RewriteAppend(m)
}
func init() { ice.TeamCtxCmd(place{}) }
type PlaceType int

View File

@ -4,11 +4,11 @@ import "shylinux.com/x/ice"
type placeUser struct {
Tables
place place
userPlace userPlace
}
func (s placeUser) List(m *ice.Message, arg ...string) {
m.Cmdy(s.place, s.place.User, arg).PushAction().Action().Display("")
m.Cmdy(s.userPlace, s.userPlace.User, arg).Action()
}
func init() { ice.TeamCtxCmd(placeUser{}) }

View File

@ -1,14 +0,0 @@
Volcanos(chat.ONIMPORT, {
_init: function(can, msg) { var USER_PLACE_ROLE = "user_place_role"
if (msg.IsDetail()) { can.onexport.share_title(can, msg, USER_PLACE_ROLE); return msg.Show(can) }
can.onimport.itemcards(can, msg, function(value) { value._style = [value[USER_PLACE_ROLE]]
return [
{view: html.TITLE, list: [{text: value.user_name},
{text: [can.user.transValue(can, value, USER_PLACE_ROLE), "", [aaa.ROLE, value[USER_PLACE_ROLE]]]},
]},
{view: html.STATUS, list: [{text: value.uid.slice(0, 6)}, {text: can.base.TimeTrim(value.created_at)}]},
{view: html.STATUS, list: [{text: value.begin_time.split(" ")[0]}, {text: value.end_time.split(" ")[0]}]},
]
})
},
})

View File

@ -22,11 +22,12 @@ $output>div.action div.item.button i { display:none; }
$output>div.action div.item.button span { display:none; }
$output>fieldset table.content td { box-shadow:none; }
$output span.role { border:var(--box-notice); color:var(--notice-bg-color); }
$output span.role.creator { border-color:var(--box-danger); color:var(--danger-bg-color); }
$output span.role.landlord { border-color:var(--box-danger); color:var(--danger-bg-color); }
$output span.role.teacher { border-color:var(--box-danger); color:var(--danger-bg-color); }
$output span.role.leader { border-color:var(--box-danger); color:var(--danger-bg-color); }
$output span.role.manager { border-color:var(--box-danger); color:var(--danger-bg-color); }
$output span.type { border:var(--box-notice); color:var(--notice-bg-color); }
// $output span.status { border:var(--box-notice); color:var(--notice-bg-color); }
$output span.type.danger { border-color:var(--box-danger); color:var(--danger-bg-color); }
$output span.role.danger { border-color:var(--box-danger); color:var(--danger-bg-color); }
$output span.status.danger { border-color:var(--box-danger); color:var(--danger-bg-color); }
$output span.status.expire { border-color:var(--box-danger); color:var(--danger-bg-color); }
$output table.content.detail tr.action input.icons { display:unset; }
$output table.content.detail tr.action i { display:none; }
$output table.content td.action i { display:none; }
@ -44,4 +45,4 @@ $output>fieldset.story { box-shadow:none; }
$output>fieldset.story>div.output { background-color:var(--plugin-bg-color); }
$output>fieldset.story>div.output div.item.card {}
$output>fieldset.story>div.output div.item.card>div.output { background-color:var(--output-bg-color); padding:10px; }
$output>fieldset.story>div.output div.item.card>div.output div.output { padding:10px 0; }
$output>fieldset.story>div.output div.item.card>div.output div.output { padding:10px 0; white-space:pre-line; }

View File

@ -21,7 +21,7 @@ type Portal struct {
field string `data:"time,name,icons,index,order,enable,type,role,view"`
list string `name:"list place_uid index uid auto" role:"void"`
create string `name:"create index name icons"`
placeCreate string `name:"placeCreate city_name* street_name* place_type*:select name* address*" icon:"bi bi-plus-square-dotted" role:"void"`
placeCreate string `name:"placeCreate city_name* street_name* place_type*:select place_name* address*" icon:"bi bi-plus-square-dotted" role:"void"`
placeRemove string `name:"placeRemove uid*" 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"`
@ -37,15 +37,12 @@ func (s Portal) BeforeMigrate(m *ice.Message, arg ...string) {
}
func (s Portal) AfterMigrate(m *ice.Message, arg ...string) {
m.GoSleep("30ms", func() {
m.Cmdy(s.service, s.Update, m.ConfigSimple(mdb.NAME), mdb.ICON, kit.Select(ice.Info.NodeIcon, m.Config(mdb.ICON)), ctx.INDEX, m.PrefixKey())
m.Cmdy(s.service, s.Table.Update, m.ConfigSimple(mdb.NAME), mdb.ICON, kit.Select(ice.Info.NodeIcon, m.Config(mdb.ICON)), ctx.INDEX, m.PrefixKey())
})
}
func (s Portal) Inputs(m *ice.Message, arg ...string) {
m.Cmdy(s.Place, m.ActionKey(), arg)
}
func (s Portal) SetIcons(m *ice.Message, arg ...string) {
s.Hash.Modify(m, arg...)
}
func (s Portal) List(m *ice.Message, arg ...string) {
if m.Option(mdb.VIEW) == mdb.TABLE {
s.Hash.List(m, arg...).PushAction(mdb.DETAIL, s.SetIcons, s.Remove).SortInt(mdb.ORDER)
@ -74,18 +71,21 @@ func (s Portal) PlaceCreate(m *ice.Message, arg ...string) {
} else if s.Street.FindOrCreateByName(m, arg...); m.IsErr() {
return
}
name := m.Option(model.NAME)
arg = kit.TransArgKeys(arg, s.Keys(s.Place, model.TYPE), model.TYPE)
arg = kit.TransArgKeys(arg, s.Keys(s.Place, model.NAME), model.NAME)
if m.Cmdy(s.Place, s.Create, arg[2:]).IsErr() {
return
}
s.RecordEvent(m, m.Result(), m.Trans("create place", "创建服务场景")+" "+name, m.Result())
args := kit.Simple(m.OptionSimple(model.USER_UID), s.Keys(s.Place, model.UID), m.Result(), model.ROLE, UserPlaceCreator)
m.Cmdy(s.UserPlace, s.Create, args).ProcessRefresh()
s.RecordEvent(m, m.Result(), kit.Format(m.Trans("create", "创建")), arg...)
m.SetResult().Cmdy(s.UserPlace, s.Create, args).ProcessRefresh()
m.Cmd(s.user, s.SendTemplate, "", "", s.Link(m, m.Result()), m.Trans("create place", "创建服务场景"), name, m.Result())
}
func (s Portal) PlaceRemove(m *ice.Message, arg ...string) {
defer m.ToastProcess()()
m.Cmdy(s.UserPlace, s.Delete, m.OptionSimple(model.UID))
m.ProcessRefresh()
m.Cmdy(s.UserPlace, s.Delete, m.OptionSimple(model.UID)).ProcessRefresh()
m.Cmd(s.user, s.SendTemplate, "", "", s.Link(m, m.Result()), m.Trans("remove place", "删除服务场景"), m.Option("_name"), m.Option(model.UID))
}
func (s Portal) ScanQRCode(m *ice.Message, arg ...string) {
defer m.ToastProcess()()
@ -100,6 +100,9 @@ func (s Portal) ScanQRCode(m *ice.Message, arg ...string) {
}
}
}
func (s Portal) SetIcons(m *ice.Message, arg ...string) {
s.Hash.Modify(m, arg...)
}
func init() { ice.TeamCtxCmd(Portal{Table: newTable()}) }

View File

@ -7,11 +7,11 @@ Volcanos(chat.ONIMPORT, {
myValue: function(can, value) {
return [
{view: html.TITLE, list: [{text: value._name},
{text: [value.__type, "", [mdb.TYPE, value._type]]},
value._role != "visitor" && {text: [value.__role, "", [aaa.ROLE, value._role]]},
{text: [value.__type, "", [mdb.TYPE, value._type, value._type_style]]},
value._role != "visitor" && {text: [value.__role, "", [aaa.ROLE, value._role, value._role_style]]},
]},
{view: html.STATUS, list: [
{text: value._uid.slice(0, 6)}, {text: value.city_name}, {text: value._street},
{text: value.uid.slice(0, 6)}, {text: value.city_name}, {text: value._street},
]},
]
},
@ -35,6 +35,12 @@ Volcanos(chat.ONIMPORT, {
can.onimport.myData(can, msg, can._output, PLACE_UID, PLACE_NAME)
}
},
typeStyle: function(can, value, key) {
return can.Conf("_lrans.value."+key+".style."+value[key])||""
},
roleStyle: function(can, value, key) {
return can.Conf("_trans.value."+key+".style."+value[key])||""
},
myPlace: function(can, msg, target, PLACE_UID, PLACE_NAME, PLACE_TYPE) { var place_uid
var USER_PLACE_ROLE = msg.Option("_user_place_role"), STREET_NAME = msg.Option("_street_name")
can.ui._target = can.page.Append(can, target||can._output, [html.OUTPUT])._target
@ -45,6 +51,8 @@ Volcanos(chat.ONIMPORT, {
value._type = value[PLACE_TYPE], value.__type = can.user.transValue(can, value, PLACE_TYPE)
value._role = value[USER_PLACE_ROLE], value.__role = can.user.transValue(can, value, USER_PLACE_ROLE)
value.icons = can.Conf(can.core.Keys("_trans.value", PLACE_TYPE, mdb.ICONS, value[PLACE_TYPE]))
value._type_style = can.onimport.typeStyle(can, value, PLACE_TYPE)
value._role_style = can.onimport.roleStyle(can, value, USER_PLACE_ROLE)
return can.onimport.itemcard(can, value, can.onimport.myValue(can, value, PLACE_UID, PLACE_NAME, STREET_NAME), function(event) {
can.onexport.value(can, value, PLACE_UID, PLACE_NAME)
})
@ -55,7 +63,8 @@ Volcanos(chat.ONIMPORT, {
myIndex: function(can, msg, target, PLACE_UID, USER_PLACE_ROLE) {
var width = (can.ConfWidth()-40)/parseInt((can.ConfWidth()-40)/100), height = width+20; can.user.isMobile && !can.user.isLandscape() && (width = (can.ConfWidth()-40)/4, height = width+20)
var role = can.page.Append(can, target, [{view: aaa.ROLE, list: can.core.Item(can.Conf("_trans.value."+USER_PLACE_ROLE), function(key, value) {
return {text: [value, "", key], onclick: function(event) {
if (key == "style") { return }
return {text: [can.user.trans(can, key, value), "", key], onclick: function(event) {
can.onimport.selectIndex(can, can.sup.current, key)
can.onmotion.select(can, role, html.SPAN, event.target)
}}
@ -94,7 +103,7 @@ Volcanos(chat.ONIMPORT, {
if (can.db.hash.length > 2 && can.db.hash[0] && can.db.hash[2]) { value.args = [can.db.hash[0], can.db.hash[2]] }
value.style = html.OUTPUT, value.height = can.ConfHeight()-html.ACTION_HEIGHT
can.onappend.plugin(can, value, function(sub) {
refresh = function() { sub.Update(), can.user.toastSuccess(can, "refresh") }
refresh = function() { sub.Update(), can.onmotion.delay(can, function() { can.user.toastSuccess(can, "refresh") }, 300) }
can.core.List(["_trans", "_icons", "_style", "_trans.input", "_trans.value"], function(key) {
var value = sub.Conf(key); value && can.core.Item(can.Conf(key), function(k, v) { value[k] = value[k]||v })
})

View File

@ -10,7 +10,7 @@
"order": "权限审批",
"event": "事件流",
"email": "邮箱配置",
"placeUser": "场景用户",
"placeUser": "服务人员",
"cancel": "取消",
"submit": "提交",
"finish": "完成",
@ -18,6 +18,7 @@
"approve": "通过",
"autogen": "生成",
"compile": "编译",
"create": "创建",
"project": "项目",
"oauth": "授权",
"icons": {
@ -42,7 +43,10 @@
"end_time": "结束时间",
"cancel_time": "取消时间",
"finish_time": "完成时间",
"created_at": "创建时间",
"operate": "操作",
"operator": "操作人",
"info": "详情",
"user_uid": "用户",
"user_name": "用户昵称",
"user_avatar": "用户头像",
@ -62,19 +66,29 @@
"cancel": "已取消",
"submit": "已提交",
"rejected": "已驳回",
"approved": "已通过"
"approved": "已通过",
"style": {
"rejected": "danger"
}
},
"order_status": {
"create": "待审批",
"rejected": "已驳回",
"approved": "已通过"
"approved": "已通过",
"style": {
"rejected": "danger"
}
},
"user_place_role": {
"creator": "创建人",
"visitor": "访客",
"landlord": "房东",
"tenant": "租客",
"admin": "管理员"
"admin": "管理员",
"style": {
"creator": "danger",
"landlord": "danger"
}
},
"place_type": {
"house": "住宅",

View File

@ -14,7 +14,7 @@ import (
type user struct {
Table
template string `data:"4b-Z_r8dZmm1pHdd2h4A10VVYX4OIHvemlLjsHKBj2s"`
create string `name:"create open_id* avatar nickname"`
create string `name:"create open_id* name usernick"`
email string `name:"email email*"`
}
@ -27,9 +27,6 @@ func (s user) Create(m *ice.Message, arg ...string) {
m.Option(model.USER_UID, m.Append(model.UID))
}
}
func (s user) Email(m *ice.Message, arg ...string) {
s.Table.Update(m, kit.Dict(m.OptionSimple(model.EMAIL)), model.UID, m.Option(model.USER_UID))
}
func (s user) List(m *ice.Message, arg ...string) {
s.Table.List(m, arg...).Table(func(value ice.Maps) {
if value[model.UID] != m.Option(model.USER_UID) {
@ -39,14 +36,17 @@ func (s user) List(m *ice.Message, arg ...string) {
}
})
}
func (s user) Email(m *ice.Message, arg ...string) {
s.Table.Update(m, kit.Dict(m.OptionSimple(model.EMAIL)), model.UID, m.Option(model.USER_UID))
}
func (s user) SetCookie(m *ice.Message, arg ...string) {
m.ProcessCookie(model.USER_UID, m.Option(model.UID))
}
func (s user) SendTemplate(m *ice.Message, arg ...string) { // from uid url type name hash
msg := s.Select(m, model.UID, arg[1])
msg := s.Select(m, model.UID, kit.Select(m.Option(model.USER_UID), arg, 1))
m.Cmdy("web.chat.wx.template", "", m.Config(nfs.TEMPLATE), msg.Append(model.OPEN_ID), kit.Select("", arg, 2),
"thing7", kit.Select("", arg, 3), "thing12", kit.Select("", arg, 4), "character_string2", kit.Cut(kit.Select("", arg, 5), 6),
"time11", time.Now().Format("2006年01月02日 15:04"), "thing18", kit.Select(m.Option(ice.MSG_USERNICK), arg, 0),
"time11", time.Now().Format("2006年01月02日 15:04"), "thing18", kit.Select(kit.Select(m.Option(ice.MSG_USERNAME), m.Option(ice.MSG_USERNICK)), arg, 0),
)
}

View File

@ -8,11 +8,25 @@ import (
type userPlace struct {
Table
user user
place place
street street
city city
}
func (s userPlace) User(m *ice.Message, arg ...string) {
s.Tables(m, s.user).FieldsWithCreatedAT(m, s,
model.USER_AVATAR, model.USER_NAME, model.USER_PLACE_ROLE, model.BEGIN_TIME, model.END_TIME,
)
if len(arg) == 1 {
s.Select(m, model.PLACE_UID, arg[0])
} else if len(arg) == 2 {
s.SelectDetail(m, model.PLACE_UID, arg[0], s.Key(s, model.UID), arg[1])
} else {
return
}
s.RewriteAppend(m)
}
func (s userPlace) List(m *ice.Message, arg ...string) {
s.Tables(m, s.place, s.street, s.city).FieldsWithCreatedAT(m, s,
model.PLACE_NAME, model.PLACE_TYPE, model.USER_PLACE_ROLE,
@ -28,7 +42,7 @@ func (s userPlace) List(m *ice.Message, arg ...string) {
s.RewriteAppend(m)
}
func init() { ice.TeamCtxCmd(userPlace{}) }
func init() { ice.TeamCtxCmd(userPlace{Table: newTable()}) }
type UserPlaceRole int

View File

@ -2,6 +2,7 @@ package yuehaoxitong
import (
"shylinux.com/x/ice"
"shylinux.com/x/icebergs/base/mdb"
kit "shylinux.com/x/toolkits"
"shylinux.com/x/community/src/yuehaoxitong/model"
@ -9,45 +10,32 @@ import (
type call struct {
Tables
queue queue
schedule schedule
reception reception
call string `name:"call" help:"叫号" role:"void"`
expire string `name:"expire" role:"void"`
finish string `name:"finish" role:"void"`
list string `name:"list queue_uid uid reception_uid auto"`
schedule schedule
call string `name:"call" help:"叫号" role:"void"`
list string `name:"list queue_uid uid reception_uid auto"`
expire string `name:"expire" role:"void"`
finish string `name:"finish" role:"void"`
}
func (s call) Call(m *ice.Message, arg ...string) {
if s.CheckRole(m, UserQueueCreator, UserQueueServer) {
m.Cmdy(s.schedule, s.schedule.Call).PushAction(s.Expire, s.Finish)
}
}
func (s call) Expire(m *ice.Message, arg ...string) {
if s.CheckRole(m, UserQueueCreator, UserQueueServer) {
m.Cmdy(s.schedule, s.schedule.Expire).ProcessRefresh()
}
}
func (s call) Finish(m *ice.Message, arg ...string) {
if s.CheckRole(m, UserQueueCreator, UserQueueServer) {
m.Cmdy(s.schedule, s.schedule.Finish).ProcessRefresh()
}
m.Cmdy(s.schedule, s.schedule.Call).Action(s.Call)
}
func (s call) List(m *ice.Message, arg ...string) {
if len(arg) == 1 {
m.Cmdy(s.schedule, s.schedule.SelectByStatus, arg[0], ScheduleTake).Action(s.Call)
kit.If(m.Length() == 0, func() { m.Echo(m.Trans("not found order", "没有等待")) })
m.Option(mdb.ORDER, model.TAKE_TIME)
m.Cmdy(s.schedule, s.schedule.SelectByStatus, arg[0], ScheduleTake)
kit.If(m.Length() == 0, func() { m.Echo(m.Trans("not found order", "没有等待")) }, func() { m.Action(s.Call) })
} else if len(arg) == 2 {
m.Cmdy(s.schedule, arg[0], arg[1]).Table(func(value ice.Maps) {
if value[model.SCHEDULE_STATUS] == ScheduleCall.String() {
m.PushButton(s.Expire, s.Finish)
} else {
m.PushButton()
}
}).Action(s.Call)
m.Cmdy(s.schedule, arg[0], arg[1]).Action(s.Call)
} else if len(arg) == 3 {
m.Cmdy(s.schedule, s.Select, model.QUEUE_UID, arg[0], model.RECEPTION_UID, arg[2], model.STATUS, ScheduleTake).PushAction().Action(s.Call)
m.Cmdy(s.schedule, s.Select, model.QUEUE_UID, arg[0], model.RECEPTION_UID, arg[2], model.STATUS, ScheduleTake).Action(s.Call)
}
}
func (s call) Expire(m *ice.Message, arg ...string) {
m.Cmdy(s.schedule, s.schedule.Expire)
}
func (s call) Finish(m *ice.Message, arg ...string) {
m.Cmdy(s.schedule, s.schedule.Finish)
}
func init() { ice.TeamCtxCmd(call{Tables: newTables()}) }
func init() { ice.TeamCtxCmd(call{}) }

View File

@ -8,24 +8,6 @@ import (
"shylinux.com/x/enterprise/src/guanlixitong"
)
type Tables struct {
guanlixitong.Tables
list string `name:"list queue_uid uid auto" role:"void"`
}
func (s Tables) CheckRole(m *ice.Message, arg ...UserQueueRole) bool {
return Table{}.CheckRole(m, arg...)
}
func (s Tables) RewriteAppend(m *ice.Message, arg ...string) *ice.Message {
return Table{}.RewriteAppend(m, arg...)
}
func newTables() Tables {
return Tables{Tables: guanlixitong.NewTables(userQueue{}, queue{})}
}
func newTable() Table {
return Table{Table: guanlixitong.NewTable(userQueue{}, queue{})}
}
type Table struct {
guanlixitong.Table
list string `name:"list queue_uid uid auto" role:"void"`
@ -49,17 +31,6 @@ func (s Table) Inputs(m *ice.Message, arg ...string) {
s.Table.Inputs(m, arg...)
}
}
func (s Table) CheckRole(m *ice.Message, arg ...UserQueueRole) bool {
kit.If(len(arg) == 0, func() { arg = append(arg, UserQueueCreator, UserQueueManager) })
role := UserQueueRole(kit.Int(m.Cmd(userQueue{}, s.Select, m.OptionSimple(model.QUEUE_UID, model.USER_UID)).Append(model.ROLE)))
for _, v := range arg {
if role == v {
return true
}
}
m.WarnNotRight(true, role.String())
return false
}
func (s Table) RewriteAppend(m *ice.Message, arg ...string) *ice.Message {
m.RewriteAppend(func(value, key string, index int) string {
kit.If(key == model.QUEUE_TYPE, func() { value = QueueType(kit.Int(value)).String() })
@ -67,6 +38,35 @@ func (s Table) RewriteAppend(m *ice.Message, arg ...string) *ice.Message {
kit.If(key == model.SCHEDULE_STATUS, func() { value = ScheduleStatus(kit.Int(value)).String() })
return value
})
s.Table.RewriteAppend(m)
return s.Table.RewriteAppend(m)
}
func (s Table) checkRole(m *ice.Message, arg ...UserQueueRole) bool {
kit.If(len(arg) == 0, func() { arg = append(arg, UserQueueManager) })
role := UserQueueRole(kit.Int(m.Cmd(userQueue{}, s.Select, m.OptionSimple(model.QUEUE_UID, model.USER_UID)).Append(model.ROLE)))
for _, v := range append(arg, UserQueueCreator) {
if role == v {
return true
}
}
return !m.WarnNotRight(true, role.String())
}
func (s Table) recordEvent(m *ice.Message, info string, arg ...string) *ice.Message {
s.Table.RecordEvent(m, m.Option(model.QUEUE_UID), info, kit.Select(m.Option(model.UID), arg, 0))
return m
}
type Tables struct {
Table
Portal Portal
portal string `data:"true"`
}
func (s Tables) Init(m *ice.Message, arg ...string) {
s.Portal.Show(m)
}
func (s Tables) BeforeMigrate(m *ice.Message, arg ...string) {
}
func newTable() Table {
return Table{Table: guanlixitong.NewTable(userQueue{}, queue{})}
}

View File

@ -10,6 +10,7 @@ const (
STATUS = "status"
CONTENT = "content"
CREATED_AT = "created_at"
OPERATOR = "operator"
USER_UID = "user_uid"
USER_QUEUE_ROLE = "user_queue_role"
QUEUE_UID = "queue_uid"
@ -27,8 +28,11 @@ const (
TAKE_TIME = "take_time"
CALL_TIME = "call_time"
FINISH_TIME = "finish_time"
EXPIRE_TIME = "expire_time"
AMOUNT = "amount"
COUNT = "count"
EXPIRE = "expire"
FINISH = "finish"
)
type UserQueue struct {
@ -40,22 +44,24 @@ type UserQueue struct {
type Queue struct {
db.ModelWithUID
CompanyUID string `gorm:"type:char(32);index"`
Name string `gorm:"type:varchar(255)"`
Name string `gorm:"type:varchar(64)"`
Type uint8
}
type Reception struct {
db.ModelWithUID
QueueUID string `gorm:"type:char(32);index"`
Name string `gorm:"type:varchar(255)"`
Name string `gorm:"type:varchar(64)"`
}
type Volume struct {
db.ModelWithUID
QueueUID string `gorm:"type:char(32);index"`
ReceptionUID string `gorm:"type:char(32)"`
QueueUID string `gorm:"type:char(32);index:idx_queue"`
ReceptionUID string `gorm:"type:char(32);index:idx_queue"`
BeginTime db.Time
EndTime db.Time
Amount int
Count int
Amount int `gorm:"default:0"`
Count int `gorm:"default:0"`
Expire int `gorm:"default:0"`
Finish int `gorm:"default:0"`
}
type Schedule struct {
db.ModelWithUID
@ -63,8 +69,6 @@ type Schedule struct {
ReceptionUID string `gorm:"type:char(32);index:idx_queue"`
VolumeUID string `gorm:"type:char(32);index:idx_queue"`
UserUID string `gorm:"type:char(32);index"`
BeginTime db.Time
EndTime db.Time
CancelTime db.Time
TakeTime db.Time
CallTime db.Time

View File

@ -2,6 +2,7 @@ package yuehaoxitong
import (
"shylinux.com/x/ice"
kit "shylinux.com/x/toolkits"
"shylinux.com/x/community/src/yuehaoxitong/model"
)
@ -9,16 +10,17 @@ import (
type open struct {
Tables
volume volume
create string `name:"plan reception_uid*:select amount* begin_time:select@date end_time:select@date" role:"void"`
create string `name:"plan reception_uid*:select amount* begin_time*:select@date end_time*:select@date" role:"void"`
}
func (s open) Create(m *ice.Message, arg ...string) {
if !m.WarnNotRight(!s.CheckRole(m)) {
m.Cmd(s.volume, s.Create, arg, m.OptionSimple(model.QUEUE_UID), model.COUNT, "0")
if s.checkRole(m) {
m.Cmdy(s.volume, s.Create, arg, m.OptionSimple(model.QUEUE_UID)).ProcessRefresh()
s.RecordEvent(m, m.Trans("create volume", "创建服务计划")+"\n"+s.joinKV(m, model.AMOUNT, model.BEGIN_TIME, model.END_TIME), m.Result())
}
}
func (s open) List(m *ice.Message, arg ...string) {
if !m.WarnNotRight(!s.CheckRole(m.Options(model.QUEUE_UID, arg[0]))) {
if s.checkRole(m.Options(model.QUEUE_UID, arg[0])) {
if m.Cmdy(s.volume, arg); m.Length() == 0 {
m.EchoInfoButton(m.Trans("please create open", "请创建放号"), s.Create)
}
@ -26,3 +28,11 @@ func (s open) List(m *ice.Message, arg ...string) {
}
func init() { ice.TeamCtxCmd(open{}) }
func (s open) joinKV(m *ice.Message, arg ...string) string {
list := []string{}
for _, k := range arg {
list = append(list, k, m.Option(k))
}
return kit.JoinKV(": ", "\n", list...)
}

View File

@ -9,17 +9,13 @@ import (
type plan struct {
Tables
queue queue
volume volume
schedule schedule
reception reception
create string `name:"create reception_uid*:select volume_uid*:select" role:"void"`
cancel string `name:"cancel" role:"void"`
schedule schedule
create string `name:"create reception_uid*:select volume_uid*:select" role:"void"`
cancel string `name:"cancel" role:"void"`
}
func (s plan) Create(m *ice.Message, arg ...string) {
m.Cmdy(s.schedule, s.Create, arg, m.OptionSimple(model.QUEUE_UID, model.USER_UID), model.STATUS, SchedulePlan)
m.Option(model.UID, m.Result())
}
func (s plan) List(m *ice.Message, arg ...string) {
if len(arg) == 1 {
@ -34,4 +30,4 @@ func (s plan) Cancel(m *ice.Message, arg ...string) {
m.Cmdy(s.schedule, s.Cancel)
}
func init() { ice.TeamCtxCmd(plan{Tables: newTables()}) }
func init() { ice.TeamCtxCmd(plan{}) }

View File

@ -9,7 +9,7 @@ type Portal struct {
gonganxitong.Portal
name string `data:"约号系统"`
list string `name:"list queue_uid index uid auto" role:"void"`
placeCreate string `name:"placeCreate city_name* company_name* name*" role:"void"`
placeCreate string `name:"placeCreate city_name* company_name* queue_name*" role:"void"`
}
func init() {

View File

@ -2,8 +2,8 @@
"portal": "约号系统",
"placeCreate": "创建场景",
"placeRemove": "删除场景",
"queueUser": "服务用户",
"reception": "服务接待",
"queueUser": "服务人员",
"reception": "服务场所",
"volume": "服务计划",
"schedule": "订单数据",
"history": "我的订单",
@ -30,37 +30,47 @@
"input": {
"My Queue": "我的场景",
"user_queue_role": "用户角色",
"queue_uid": "场景",
"queue_uid": "服务场景",
"queue_name": "场景名称",
"queue_type": "场景类型",
"reception_uid": "服务接待",
"reception_name": "服务接待",
"volume_uid": "服务时间",
"reception_uid": "服务场所",
"reception_name": "服务场所",
"volume_uid": "服务计划",
"schedule_status": "订单状态",
"take_time": "取号时间",
"call_time": "叫号时间",
"expire_time": "过期时间",
"finish_time": "完成时间",
"amount": "放号总量",
"count": "约号数量"
},
"value": {
"user_queue_role": {
"creator": "创建人",
"visitor": "访客",
"manager": "管理员",
"worker": "工作员",
"waiter": "接待员",
"style": {
"creator": "danger",
"manager": "danger"
}
},
"queue_type": {
"public": "公开预约",
"private": "会员预约"
},
"schedule_status": {
"plan": "已预约",
"cancel": "已取消",
"take": "已取号",
"call": "已叫号",
"expire": "已过号",
"finish": "已完成"
},
"user_queue_role": {
"creator": "创建人",
"visitor": "访客",
"manager": "管理员",
"server": "服务员",
"waiter": "接待员"
},
"queue_type": {
"public": "公开预约",
"private": "会员预约"
"finish": "已完成",
"style": {
"cancel": "danger",
"expire": "danger"
}
}
}
}

View File

@ -1,3 +1,2 @@
chapter "约号系统"
field web.code.mysql.query args `mysql yuehaoxitong`

View File

@ -3,36 +3,22 @@ package yuehaoxitong
import (
"shylinux.com/x/ice"
"shylinux.com/x/icebergs/base/mdb"
kit "shylinux.com/x/toolkits"
"shylinux.com/x/community/src/yuehaoxitong/model"
)
type reception struct {
Table
userQueue userQueue
portal string `data:"true"`
create string `name:"create name*" role:"void"`
rename string `name:"rename name*" role:"void"`
delete string `name:"delete" role:"void"`
portal string `data:"true"`
create string `name:"create name*" role:"void"`
rename string `name:"rename name*" role:"void"`
delete string `name:"delete" role:"void"`
}
func (s reception) Create(m *ice.Message, arg ...string) {
if !m.WarnNotRight(!s.CheckRole(m)) {
if s.checkRole(m) {
s.Table.Create(m, append(arg, m.OptionSimple(model.QUEUE_UID)...)...)
s.RecordEvent(m, m.Option(model.QUEUE_UID), kit.Format(m.Trans("create reception %s", "创建服务接待 %s"), m.Option(mdb.NAME)), arg...)
}
}
func (s reception) Rename(m *ice.Message, arg ...string) {
if !m.WarnNotRight(!s.CheckRole(m)) {
s.Table.Rename(m.Spawn()).ProcessRefresh()
s.RecordEvent(m, m.Option(model.QUEUE_UID), kit.Format(m.Trans("rename reception %s", "重命名服务接待 %s"), m.Option(mdb.NAME)), arg...)
}
}
func (s reception) Delete(m *ice.Message, arg ...string) {
if !m.WarnNotRight(!s.CheckRole(m)) {
s.Table.Delete(m, m.OptionSimple(model.UID)...).ProcessRefresh()
s.RecordEvent(m, m.Option(model.QUEUE_UID), kit.Format(m.Trans("delete reception %s", "删除服务接待 %s"), m.Option(mdb.NAME)), arg...)
s.RecordEvent(m, m.Trans("create reception ", "创建服务场所 ")+m.Option(mdb.NAME), m.Result())
}
}
func (s reception) List(m *ice.Message, arg ...string) {
@ -42,11 +28,23 @@ func (s reception) List(m *ice.Message, arg ...string) {
s.Table.Select(m, m.OptionSimple(model.QUEUE_UID)...)
}
} else if len(arg) == 1 {
s.Table.Select(m, model.QUEUE_UID, arg[0]).Action(s.Create)
s.Table.Select(m, model.QUEUE_UID, arg[0])
} else if len(arg) == 2 {
s.Table.SelectDetail(m, model.QUEUE_UID, arg[0], model.UID, arg[1])
}
m.PushAction(s.Rename, s.Delete)
}
func (s reception) Rename(m *ice.Message, arg ...string) {
if s.checkRole(m) {
s.Table.Rename(m, m.OptionSimple(model.QUEUE_UID, model.UID)...)
s.recordEvent(m, m.Trans("rename reception %s", "重命名服务场所 %s")+m.Option(mdb.NAME))
}
}
func (s reception) Delete(m *ice.Message, arg ...string) {
if s.checkRole(m) {
s.Table.Delete(m, m.OptionSimple(model.QUEUE_UID, model.UID)...)
s.recordEvent(m, m.Trans("delete reception %s", "删除服务场所 %s")+m.Option(mdb.NAME))
}
}
func init() { ice.TeamCtxCmd(reception{}) }

View File

@ -2,6 +2,7 @@ package yuehaoxitong
import (
"shylinux.com/x/ice"
"shylinux.com/x/icebergs/base/mdb"
kit "shylinux.com/x/toolkits"
"shylinux.com/x/community/src/yuehaoxitong/model"
@ -15,97 +16,168 @@ type schedule struct {
volume volume
portal string `data:"true"`
plan string `name:"plan begin_time@date end_time@date"`
expire string `name:"expire" role:"void"`
finish string `name:"finish" role:"void"`
}
func (s schedule) Create(m *ice.Message, arg ...string) {
defer m.ToastProcess("约号中...")("约号成功")
s.Transaction(m, func() {
msg := m.Cmd(s.volume, s.SelectForUpdate, model.UID, m.Option(model.VOLUME_UID))
if m.Warn(kit.Int(msg.Append(model.COUNT)) >= kit.Int(msg.Append(model.AMOUNT)), "本服务已约满") {
return
}
m.Cmd(s.volume, s.AddCount, m.Option(model.VOLUME_UID), "1")
s.addCount(m, mdb.COUNT, "1")
s.Table.Create(m, arg...)
})
if !m.IsErr() {
m.Option(model.UID, m.Result())
s.SendTemplate(m, "约号成功")
}
s.sendTemplate(m, "约号成功", m.Result())
}
func (s schedule) Call(m *ice.Message, arg ...string) {
s.Orders(m, model.TAKE_TIME).Limit(m, 1)
s.SelectByStatus(m, m.Option(model.QUEUE_UID), kit.Format(ScheduleTake))
// s.Select(m, kit.Simple(m.OptionSimple(model.QUEUE_UID, model.RECEPTION_UID), mdb.STATUS, ScheduleTake)...)
if m.WarnNotFound(m.Length() == 0) {
defer m.ToastProcess("叫号中...")("叫号成功")
if !s.checkRole(m, UserQueueCreator, UserQueueWorker) {
return
}
s.ChangeStatus(m, m.Append(model.UID), "", ScheduleTake, ScheduleCall, arg...)
s.SendTemplate(m, "服务已叫号")
}
func (s schedule) SelectByStatus(m *ice.Message, arg ...string) {
s.Tables(m, s.volume).FieldsWithCreatedAT(m, s,
model.SCHEDULE_STATUS, s.Key(s.volume, model.BEGIN_TIME), s.Key(s.volume, model.END_TIME), model.VOLUME_UID, s.Key(s, model.RECEPTION_UID), model.USER_UID,
s.Key(s, model.QUEUE_UID),
).Orders(m, s.Desc(model.BEGIN_TIME))
s.Select(m, kit.Simple(s.Key(s, model.QUEUE_UID), arg[0], model.STATUS, arg[1], arg[2:])...)
s.RewriteAppend(m)
s.SelectJoin(m, s.reception)
s.SelectJoinUser(m)
m.PushAction().Action()
s.Orders(m, model.TAKE_TIME).Limit(m, 1)
s.SelectByStatus(m, m.Option(model.QUEUE_UID), kit.Format(ScheduleTake)).PushAction(s.Expire, s.Finish)
// s.Select(m, kit.Simple(m.OptionSimple(model.QUEUE_UID, model.RECEPTION_UID), mdb.STATUS, ScheduleTake)...)
if m.Length() == 0 {
m.ProcessRewrite(model.UID, "")
return
}
s.changeStatus(m, ScheduleTake, ScheduleCall, arg...)
s.sendTemplate(m, "服务已叫号", m.Append(model.UID))
m.ProcessRewrite(model.UID, m.Append(model.UID))
}
func (s schedule) List(m *ice.Message, arg ...string) {
if s.CheckRole(m.Options(model.QUEUE_UID, arg[0]), UserQueueCreator, UserQueueServer) {
role := UserQueueRole(kit.Int(m.Cmd(s.userQueue, s.Select, m.OptionSimple(model.QUEUE_UID, model.USER_UID)).Append(model.ROLE)))
s.Tables(m, s.volume).FieldsWithCreatedAT(m, s, model.SCHEDULE_STATUS, model.BEGIN_TIME, model.END_TIME,
model.CANCEL_TIME, model.TAKE_TIME, model.CALL_TIME, model.EXPIRE_TIME, model.FINISH_TIME,
s.Key(s, model.OPERATOR), s.Key(s, model.RECEPTION_UID), model.USER_UID, model.VOLUME_UID,
)
if role == UserQueueCreator || role == UserQueueManager {
if len(arg) == 1 {
s.Select(m, model.QUEUE_UID, arg[0])
s.Select(m, s.Key(s, model.QUEUE_UID), arg[0])
} else if len(arg) == 2 {
s.SelectDetail(m, model.QUEUE_UID, arg[0], model.UID, arg[1])
s.SelectDetail(m, s.Key(s, model.QUEUE_UID), arg[0], s.Key(s, model.UID), arg[1])
}
m.Table(func(value ice.Maps) {
switch ScheduleStatus(kit.Int(value[model.SCHEDULE_STATUS])) {
case SchedulePlan:
m.PushButton(s.Cancel)
case ScheduleCall:
m.PushButton(s.Expire, s.Finish)
default:
m.PushButton()
}
})
} else if role == UserQueueWorker {
if len(arg) == 1 {
s.Select(m, s.Key(s, model.QUEUE_UID), arg[0], s.Key(s, model.OPERATOR), m.Option(model.USER_UID))
} else if len(arg) == 2 {
s.SelectDetail(m, s.Key(s, model.QUEUE_UID), arg[0], s.Key(s, model.OPERATOR), m.Option(model.USER_UID), s.Key(s, model.UID), arg[1])
}
m.Table(func(value ice.Maps) {
switch ScheduleStatus(kit.Int(value[model.SCHEDULE_STATUS])) {
case ScheduleCall:
m.PushButton(s.Expire, s.Finish)
default:
m.PushButton()
}
})
} else {
if len(arg) == 1 {
s.Select(m, model.QUEUE_UID, arg[0], model.USER_UID, m.Option(model.USER_UID))
s.Select(m, s.Key(s, model.QUEUE_UID), arg[0], model.USER_UID, m.Option(model.USER_UID))
} else if len(arg) == 2 {
s.SelectDetail(m, model.QUEUE_UID, arg[0], model.USER_UID, m.Option(model.USER_UID), model.UID, arg[1])
s.SelectDetail(m, s.Key(s, model.QUEUE_UID), arg[0], model.USER_UID, m.Option(model.USER_UID), s.Key(s, model.UID), arg[1])
}
m.Table(func(value ice.Maps) {
switch ScheduleStatus(kit.Int(value[model.SCHEDULE_STATUS])) {
case SchedulePlan:
m.PushButton(s.Cancel)
default:
m.PushButton()
}
})
}
m.RenameAppend(model.STATUS, model.SCHEDULE_STATUS)
s.RewriteAppend(m)
m.Action()
s.SelectJoin(m, s.reception)
s.SelectJoinUser(m)
m.PushAction().Action()
s.RewriteAppend(m)
}
func (s schedule) Cancel(m *ice.Message, arg ...string) {
s.Transaction(m, func() {
m.Cmd(s.volume, s.AddCount, m.Option(model.VOLUME_UID), "-1")
s.ChangeStatus(m, m.Option(model.UID), "", SchedulePlan, ScheduleTake, arg...)
})
if !m.IsErr() {
s.SendTemplate(m, "约号取消")
}
}
func (s schedule) Take(m *ice.Message, arg ...string) {
s.ChangeStatus(m, m.Option(model.UID), "", SchedulePlan, ScheduleTake, arg...)
s.SendTemplate(m, "取号取消")
}
func (s schedule) Expire(m *ice.Message, arg ...string) {
s.ChangeStatus(m, m.Option(model.UID), "", ScheduleCall, ScheduleExpire, arg...)
s.SendTemplate(m, "服务已过号")
}
func (s schedule) Finish(m *ice.Message, arg ...string) {
s.ChangeStatus(m, m.Option(model.UID), "", ScheduleCall, ScheduleFinish, arg...)
s.SendTemplate(m, "服务已完成")
}
func init() { ice.TeamCtxCmd(schedule{Table: newTable{}}) }
func (s schedule) ChangeStatus(m *ice.Message, uid, key string, from, to ScheduleStatus, arg ...string) *ice.Message {
kit.If(key == "", func() { key = m.ActionKey() + "_time" })
s.Table.ChangeStatus(m, uid, int(from), int(to), kit.TransArgValueTime(append(arg, key, m.Time()), key)...)
func (s schedule) SelectByStatus(m *ice.Message, arg ...string) *ice.Message {
order := m.Option(mdb.ORDER)
s.Tables(m, s.volume).FieldsWithCreatedAT(m, s, model.SCHEDULE_STATUS, model.BEGIN_TIME, model.END_TIME,
model.CANCEL_TIME, model.TAKE_TIME, model.CALL_TIME, model.EXPIRE_TIME, model.FINISH_TIME,
s.Key(s, model.OPERATOR), s.Key(s, model.RECEPTION_UID), model.USER_UID, model.VOLUME_UID,
)
kit.If(order, func() { s.Orders(m, order) })
s.Select(m, kit.Simple(s.Key(s, model.QUEUE_UID), arg[0], model.STATUS, arg[1], arg[2:])...).Action()
s.SelectJoin(m, s.reception)
s.SelectJoinUser(m)
s.RewriteAppend(m)
return m
}
func (s schedule) SendTemplate(m *ice.Message, arg ...string) {
func (s schedule) Cancel(m *ice.Message, arg ...string) {
defer m.ToastProcess("取消中...")("取消成功")
if m.WarnNotFound(s.Select(m, m.OptionSimple(model.UID, model.USER_UID)...).Length() == 0) {
return
}
s.Transaction(m, func() {
s.addCount(m, mdb.COUNT, "-1")
s.changeStatus(m, SchedulePlan, ScheduleCancel, arg...)
})
s.sendTemplate(m, "约号取消")
m.ProcessRefresh()
}
func (s schedule) Take(m *ice.Message, arg ...string) {
defer m.ToastProcess("取号中...")("取号成功")
if m.WarnNotFound(s.Select(m, m.OptionSimple(model.UID, model.USER_UID)...).Length() == 0) {
return
}
s.changeStatus(m, SchedulePlan, ScheduleTake, arg...)
s.sendTemplate(m, "取号成功")
m.ProcessRefresh()
}
func (s schedule) Expire(m *ice.Message, arg ...string) {
defer m.ToastProcess("过号中...")("过号成功")
if s.checkRole(m, UserQueueCreator, UserQueueWorker) {
s.Transaction(m, func() {
s.addCount(m, "", "1")
s.changeStatus(m, ScheduleCall, ScheduleExpire, arg...)
})
s.Select(m.FieldsSetDetail(), model.UID, m.Option(model.UID))
s.sendTemplate(m, "服务已过号")
m.ProcessRefresh()
}
}
func (s schedule) Finish(m *ice.Message, arg ...string) {
defer m.ToastProcess("完成中...")("完成成功")
if s.checkRole(m, UserQueueCreator, UserQueueWorker) {
s.Transaction(m, func() {
s.addCount(m, "", "1")
s.changeStatus(m, ScheduleCall, ScheduleFinish, arg...)
})
s.Select(m.FieldsSetDetail(), model.UID, m.Option(model.UID))
s.sendTemplate(m, "服务已完成")
m.ProcessRefresh()
}
}
func init() { ice.TeamCtxCmd(schedule{}) }
func (s schedule) addCount(m *ice.Message, key, count string) {
m.Cmd(s.volume, s.AddCount, kit.Select(m.ActionKey(), key), count, m.Option(model.VOLUME_UID))
}
func (s schedule) changeStatus(m *ice.Message, from, to ScheduleStatus, arg ...string) *ice.Message {
key := m.ActionKey() + "_time"
s.Table.ChangeStatus(m, m.Option(model.UID), int(from), int(to), kit.TransArgValueTime(append(arg, key, m.Time()), key)...)
return m
}
func (s schedule) sendTemplate(m *ice.Message, title string, arg ...string) *ice.Message {
queue := m.Cmd(s.queue, s.Select, model.UID, m.Option(model.QUEUE_UID))
reception := m.Cmd(s.reception, s.Select, model.UID, m.Option(model.RECEPTION_UID))
m.Option(model.QUEUE_NAME, queue.Append(model.NAME)+" "+reception.Append(model.NAME))
s.Table.SendTemplate(m, "", m.Option(model.USER_UID), arg[0])
s.Table.SendTemplate(m, "", m.Append(model.USER_UID), title, queue.Append(model.NAME)+" "+reception.Append(model.NAME), kit.Select("", arg, 0), m.Option(model.QUEUE_UID))
return m
}
type ScheduleStatus int

View File

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

View File

@ -13,12 +13,17 @@ type take struct {
take string `name:"take" help:"取号" role:"void"`
}
func (s take) Take(m *ice.Message, arg ...string) {
m.Cmd(s.schedule, s.schedule.Take)
}
func (s take) List(m *ice.Message, arg ...string) {
m.Cmdy(s.schedule, s.schedule.SelectByStatus, arg[0], SchedulePlan, m.OptionSimple(model.USER_UID)).PushAction(s.Take)
kit.If(m.Length() == 0, func() { m.Echo(m.Trans("not found plan", "没有未取的号")) })
if len(arg) == 1 {
m.Cmdy(s.schedule, s.schedule.SelectByStatus, arg[0], SchedulePlan, m.OptionSimple(model.USER_UID)).PushAction(s.Take)
kit.If(m.Length() == 0, func() { m.Echo(m.Trans("not found plan", "没有未取的号")) })
} else if len(arg) == 2 {
m.FieldsSetDetail()
m.Cmdy(s.schedule, s.schedule.SelectByStatus, arg[0], SchedulePlan, m.OptionSimple(model.USER_UID), s.Key(s.schedule, model.UID), arg[1]).PushAction(s.Take)
}
}
func (s take) Take(m *ice.Message, arg ...string) {
m.Cmdy(s.schedule, s.schedule.Take)
}
func init() { ice.TeamCtxCmd(take{}) }

View File

@ -12,12 +12,11 @@ type userQueue struct {
}
func (s userQueue) User(m *ice.Message, arg ...string) {
s.FieldsWithCreatedAT(m, s, model.USER_UID, model.ROLE)
if len(arg) == 1 {
s.Select(m, model.QUEUE_UID, arg[0])
} else if len(arg) == 2 {
s.SelectDetail(m, model.QUEUE_UID, arg[0], model.UID, arg[1])
} else {
return
}
m.RenameAppend(model.ROLE, model.USER_QUEUE_ROLE)
s.SelectJoinUser(m)
@ -31,16 +30,14 @@ func (s userQueue) List(m *ice.Message, arg ...string) {
if len(arg) == 1 {
s.Select(m, model.USER_UID, arg[0])
} else if len(arg) == 2 {
s.SelectDetail(m, model.USER_UID, arg[0], s.Key(s.queue, model.UID), arg[1])
} else {
return
s.SelectDetail(m, model.USER_UID, arg[0], s.Key(s, model.QUEUE_UID), arg[1])
}
s.SelectJoinCompany(m)
s.SelectJoinCity(m)
s.RewriteAppend(m)
}
func init() { ice.TeamCtxCmd(userQueue{}) }
func init() { ice.TeamCtxCmd(userQueue{Table: newTable()}) }
type UserQueueRole int
@ -48,7 +45,7 @@ const (
UserQueueCreator UserQueueRole = iota
UserQueueVisitor
UserQueueManager
UserQueueServer
UserQueueWorker
UserQueueWaiter
)
@ -56,7 +53,7 @@ var UserQueueRoleList = map[UserQueueRole]string{
UserQueueCreator: "creator",
UserQueueVisitor: "visitor",
UserQueueManager: "manager",
UserQueueServer: "server",
UserQueueWorker: "worker",
UserQueueWaiter: "waiter",
}

View File

@ -12,27 +12,24 @@ type volume struct {
portal string `data:"true"`
}
func (s volume) AddCount(m *ice.Message, arg ...string) {
s.Table.AddCount(m, model.COUNT, arg[1], arg[0])
}
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)
s.Fields(m, model.UID, model.BEGIN_TIME, model.END_TIME, model.AMOUNT, model.COUNT)
s.Select(m, m.OptionSimple(model.QUEUE_UID, model.RECEPTION_UID)...)
}
} else {
} else if len(arg) == 1 {
s.Tables(m, s.reception).FieldsWithCreatedAT(m, s,
model.RECEPTION_NAME,
model.AMOUNT, model.COUNT,
model.RECEPTION_NAME, model.AMOUNT, model.COUNT,
model.EXPIRE, model.FINISH,
model.BEGIN_TIME, model.END_TIME,
)
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])
}
m.PushAction()
s.Select(m, s.Key(s, model.QUEUE_UID), arg[0])
} else if len(arg) == 2 {
s.Fields(m, model.CREATED_AT, model.UID, model.USER_UID, s.AS(model.STATUS, model.SCHEDULE_STATUS))
m.Cmdy(schedule{}, s.Select, "volume_uid = ? and status != ?", arg[1], ScheduleCancel)
s.SelectJoinUser(m)
s.RewriteAppend(m)
}
}

View File

@ -3,9 +3,16 @@ Volcanos(chat.ONIMPORT, {
can.onimport.itemcards(can, msg, function(value) {
return [
{view: html.TITLE, list:[{text: value.reception_name}]},
{view: html.STATUS, list:[{text: "放号量: "}, {text: value.amount}, {text: "预约量: "}, {text: value.count||"0"}]},
{view: html.TITLE, list:[{text: "开始时间:"}, {text: value.begin_time}]},
{view: html.TITLE, list:[{text: "结束时间:"}, {text: value.end_time}]},
{view: html.STATUS, list:[
{text: "放号量: "}, {text: value.amount},
{text: "预约量: "}, {text: value.count||"0"},
]},
{view: html.STATUS, list:[
{text: "过号量: "}, {text: value.expire||"0"},
{text: "完成量: "}, {text: value.finish||"0"},
]},
{view: html.STATUS, list:[{text: "开始时间:"}, {text: value.begin_time}]},
{view: html.STATUS, list:[{text: "结束时间:"}, {text: value.end_time}]},
]
})
},

View File

@ -0,0 +1,63 @@
{
"13b12fc8c2abcab1710ed1671eb65651": {
"meta": {
"_target": [
"b34c62a4ad3ad3c8856177b0172ea1e7"
],
"icons": "https://img.icons8.com/officel/80/edit-property.png",
"index": "web.team.yuehaoxitong5.apply",
"name": "权限申请",
"time": "2024-08-07 13:12:40.518"
}
},
"4de3a4dcf72c28d6f225edfcf1363467": {
"meta": {
"index": "web.team.yuehaoxitong5.item",
"time": "2024-08-07 13:12:40.513"
}
},
"701e09fad4eefee41d69fe056938f0b2": {
"meta": {
"_target": [
"b34c62a4ad3ad3c8856177b0172ea1e7"
],
"icons": "https://img.icons8.com/officel/80/qr-code.png",
"index": "web.team.yuehaoxitong5.qrcode",
"name": "场景码",
"time": "2024-08-07 13:12:40.515"
}
},
"c1f22d758397c1f871b0bd30a9c27127": {
"meta": {
"_target": [
"b34c62a4ad3ad3c8856177b0172ea1e7"
],
"icons": "https://img.icons8.com/officel/80/property-with-timer.png",
"index": "web.team.yuehaoxitong5.event",
"name": "事件流",
"time": "2024-08-07 13:12:40.503"
}
},
"daec0955552a9027833dd08754dded0a": {
"meta": {
"_target": [
"b34c62a4ad3ad3c8856177b0172ea1e7"
],
"icons": "https://img.icons8.com/officel/80/activity-grid.png",
"index": "web.team.yuehaoxitong5.service",
"name": "系统服务",
"time": "2024-08-07 13:12:40.507"
}
},
"e7dfa45a47815b3c164db74027700442": {
"meta": {
"_target": [
"b34c62a4ad3ad3c8856177b0172ea1e7"
],
"icons": "https://img.icons8.com/officel/80/receipt-approved.png",
"index": "web.team.yuehaoxitong5.order",
"name": "权限审批",
"time": "2024-08-07 13:12:40.521"
}
}
}