This commit is contained in:
IT 老营长 @云轩领航-创始人 2024-08-21 11:07:35 +08:00
parent b56fcf3fcb
commit fa06d9d60f
25 changed files with 139 additions and 219 deletions

View File

@ -8,3 +8,4 @@ field web.chat.wx.access
field web.chat.wx.menu field web.chat.wx.menu
field web.code.mysql.client field web.code.mysql.client
field web.code.mysql.query args `mysql gonganxitong` field web.code.mysql.query args `mysql gonganxitong`
field web.code.db.models

View File

@ -15,29 +15,29 @@ type Table struct {
func (s Table) Inputs(m *ice.Message, arg ...string) { func (s Table) Inputs(m *ice.Message, arg ...string) {
switch arg[0] { switch arg[0] {
case model.{{.Option "CLASS"}}_TYPE:
for k, v := range {{.Option "Class"}}TypeList {
m.Push(arg[0], k).Push(model.NAME, v)
}
m.SortInt(arg[0]).DisplayInputKeyNameIconTitle()
case model.USER_{{.Option "CLASS"}}_ROLE: case model.USER_{{.Option "CLASS"}}_ROLE:
for k, v := range User{{.Option "Class"}}RoleList { s.InputsListRole(m, User{{.Option "Class"}}RoleList, arg...)
if k != User{{.Option "Class"}}Creator && k != User{{.Option "Class"}}Visitor { case model.{{.Option "CLASS"}}_TYPE:
m.Push(arg[0], k).Push(model.NAME, v) s.InputsList(m, {{.Option "Class"}}TypeList, arg...)
}
}
m.SortInt(arg[0]).DisplayInputKeyNameIconTitle()
default: default:
s.Table.Inputs(m, arg...) s.Table.Inputs(m, arg...)
} }
} }
func (s Table) RewriteAppend(m *ice.Message, arg ...string) *ice.Message { func (s Table) RewriteAppend(m *ice.Message, arg ...string) *ice.Message {
m.RewriteAppend(func(value, key string, index int) string { m.RewriteAppend(func(value, key string, index int) string {
kit.If(key == model.{{.Option "CLASS"}}_TYPE, func() { value = {{.Option "Class"}}Type(kit.Int(value)).String() }) switch key {
kit.If(key == model.USER_{{.Option "CLASS"}}_ROLE, func() { value = User{{.Option "Class"}}Role(kit.Int(value)).String() }) case model.USER_{{.Option "CLASS"}}_ROLE:
value = User{{.Option "Class"}}Role(kit.Int(value)).String()
case model.{{.Option "CLASS"}}_TYPE:
value = {{.Option "Class"}}Type(kit.Int(value)).String()
}
return value return value
}) })
s.Table.RewriteAppend(m) return s.Table.RewriteAppend(m)
}
func (s Table) CheckRole(m *ice.Message, arg ...string) *ice.Message {
role := User{{.Option "Class"}}Role(kit.Int(m.Cmd(user{{.Option "Class"}}{}, s.Select, m.OptionSimple(model.{{.Option "CLASS"}}_UID, model.USER_UID)).Append(model.ROLE)))
m.WarnNotRight(!kit.IsIn(role.String(), append(arg, User{{.Option "Class"}}Creator.String())...), role.String())
return m return m
} }
func (s Table) checkRole(m *ice.Message, arg ...User{{.Option "Class"}}Role) bool { func (s Table) checkRole(m *ice.Message, arg ...User{{.Option "Class"}}Role) bool {
@ -50,14 +50,13 @@ func (s Table) checkRole(m *ice.Message, arg ...User{{.Option "Class"}}Role) boo
} }
return !m.WarnNotRight(true, role.String()) return !m.WarnNotRight(true, role.String())
} }
func (s Table) recordEvent(m *ice.Message, info string, arg ...string) *ice.Message { 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)) s.Table.RecordEvent(m, m.Option(model.{{.Option "CLASS"}}_UID), info, kit.Select(m.Option(model.UID), arg, 0))
return m }
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 { type Tables struct { Table }
Table
portal string `data:"true"`
}
func (s Tables) BeforeMigrate(m *ice.Message, arg ...string) {} func (s Tables) BeforeMigrate(m *ice.Message, arg ...string) {}

View File

@ -11,7 +11,6 @@ type {{.Option "table"}} struct {
Table Table
{{.Option "class"}} {{.Option "class"}} {{.Option "class"}} {{.Option "class"}}
user{{.Option "Class"}} user{{.Option "Class"}} user{{.Option "Class"}} user{{.Option "Class"}}
portal string `data:"true"`
create string `name:"create title* content*" role:"void"` create string `name:"create title* content*" role:"void"`
} }

View File

@ -1,6 +1,5 @@
Volcanos(chat.ONIMPORT, { Volcanos(chat.ONIMPORT, {
_init: function(can, msg) { _init: function(can, msg) { can.onimport.shareTitle(can, msg)
if (msg.IsDetail()) { var value = msg.TableDetail(); msg.Option("_share_title", value.title), msg.Option("_share_content", value.content) }
can.onimport.itemcards(can, msg, function(value) { return [ can.onimport.itemcards(can, msg, function(value) { return [
{view: html.TITLE, list: [{text: value.title}]}, {view: html.TITLE, list: [{text: value.title}]},
{view: html.STATUS, list: [ {view: html.STATUS, list: [

View File

@ -28,14 +28,14 @@ type User{{.Option "Class"}} struct {
type {{.Option "Class"}} struct { type {{.Option "Class"}} struct {
db.ModelWithUID db.ModelWithUID
CompanyUID string `gorm:"type:char(32);index"` CompanyUID string `gorm:"type:char(32);index"`
Name string `gorm:"type:char(64)"` Name string `gorm:"type:varchar(64)"`
Type uint8 Type uint8
} }
type {{.Option "Table"}} struct { type {{.Option "Table"}} struct {
db.ModelWithUID db.ModelWithUID
{{.Option "Class"}}UID string `gorm:"type:char(32);index"` {{.Option "Class"}}UID string `gorm:"type:char(32);index"`
UserUID string `gorm:"type:char(32);index"` UserUID string `gorm:"type:char(32);index"`
Title string `gorm:"type:char(64)"` Title string `gorm:"type:varchar(64)"`
Content string Content string
} }

View File

@ -7,8 +7,6 @@ import (
type Portal struct { type Portal struct {
gonganxitong.Portal gonganxitong.Portal
name string `data:"{{.Option "help"}}"`
list string `name:"list {{.Option "class"}}_uid index uid auto" role:"void"`
placeCreate string `name:"placeCreate city_name* company_name* {{.Option "class"}}_name*" role:"void"` placeCreate string `name:"placeCreate city_name* company_name* {{.Option "class"}}_name*" role:"void"`
} }

View File

@ -14,8 +14,8 @@
}, },
"value": { "value": {
"user_{{.Option "class"}}_role": { "user_{{.Option "class"}}_role": {
"creator": "创建人",
"visitor": "访客", "visitor": "访客",
"creator": "创建人",
"leader": "管理人员", "leader": "管理人员",
"worker": "工作人员", "worker": "工作人员",
"server": "服务人员", "server": "服务人员",

View File

@ -22,7 +22,6 @@ func (s user{{.Option "Class"}}) User(m *ice.Message, arg ...string) {
} }
m.RenameAppend(model.ROLE, model.USER_{{.Option "CLASS"}}_ROLE) m.RenameAppend(model.ROLE, model.USER_{{.Option "CLASS"}}_ROLE)
s.SelectJoinUser(m) s.SelectJoinUser(m)
s.RewriteAppend(m)
} }
func (s user{{.Option "Class"}}) List(m *ice.Message, arg ...string) { func (s user{{.Option "Class"}}) List(m *ice.Message, arg ...string) {
s.Tables(m, s.{{.Option "class"}}).FieldsWithCreatedAT(m, s, s.Tables(m, s.{{.Option "class"}}).FieldsWithCreatedAT(m, s,
@ -38,7 +37,6 @@ func (s user{{.Option "Class"}}) List(m *ice.Message, arg ...string) {
} }
s.SelectJoinCompany(m) s.SelectJoinCompany(m)
s.SelectJoinCity(m) s.SelectJoinCity(m)
s.RewriteAppend(m)
} }
func init() { ice.TeamCtxCmd(user{{.Option "Class"}}{}) } func init() { ice.TeamCtxCmd(user{{.Option "Class"}}{}) }
@ -46,16 +44,16 @@ func init() { ice.TeamCtxCmd(user{{.Option "Class"}}{}) }
type User{{.Option "Class"}}Role int type User{{.Option "Class"}}Role int
const ( const (
User{{.Option "Class"}}Creator User{{.Option "Class"}}Role = iota User{{.Option "Class"}}Visitor User{{.Option "Class"}}Role = iota
User{{.Option "Class"}}Visitor User{{.Option "Class"}}Creator
User{{.Option "Class"}}Leader User{{.Option "Class"}}Leader
User{{.Option "Class"}}Worker User{{.Option "Class"}}Worker
User{{.Option "Class"}}Server User{{.Option "Class"}}Server
) )
var User{{.Option "Class"}}RoleList = map[User{{.Option "Class"}}Role]string{ var User{{.Option "Class"}}RoleList = map[User{{.Option "Class"}}Role]string{
User{{.Option "Class"}}Creator: "creator",
User{{.Option "Class"}}Visitor: "visitor", User{{.Option "Class"}}Visitor: "visitor",
User{{.Option "Class"}}Creator: "creator",
User{{.Option "Class"}}Leader: "leader", User{{.Option "Class"}}Leader: "leader",
User{{.Option "Class"}}Worker: "worker", User{{.Option "Class"}}Worker: "worker",
User{{.Option "Class"}}Server: "server", User{{.Option "Class"}}Server: "server",

View File

@ -2,11 +2,9 @@ package ludengguanli
import "shylinux.com/x/ice" import "shylinux.com/x/ice"
type good struct { type {{.Option "name"}} struct{ Tables }
Tables
func (s {{.Option "name"}}) List(m *ice.Message, arg ...string) {
} }
func (s good) List(m *ice.Message, arg ...string) { func init() { ice.TeamCtxCmd({{.Option "name"}}{}) }
}
func init() { ice.TeamCtxCmd(good{}) }

View File

@ -9,33 +9,23 @@ import (
) )
type call struct { type call struct {
Tables Schedule
schedule schedule call string `name:"call" help:"叫号" role:"worker"`
call string `name:"call" help:"叫号" role:"void"` list string `name:"list queue_uid uid reception_uid auto" role:"worker"`
list string `name:"list queue_uid uid reception_uid auto"` expire string `name:"expire" role:"worker"`
expire string `name:"expire" role:"void"` finish string `name:"finish" role:"worker"`
finish string `name:"finish" role:"void"`
} }
func (s call) Call(m *ice.Message, arg ...string) {
m.Cmdy(s.schedule, s.schedule.Call).Action(s.Call)
}
func (s call) List(m *ice.Message, arg ...string) { func (s call) List(m *ice.Message, arg ...string) {
if len(arg) == 1 { if len(arg) == 1 {
m.Option(mdb.ORDER, model.TAKE_TIME) m.Option(mdb.ORDER, model.TAKE_TIME)
m.Cmdy(s.schedule, s.schedule.SelectByStatus, arg[0], ScheduleTake) s.Schedule.SelectByStatus(m, arg[0], kit.Format(ScheduleTake))
kit.If(m.Length() == 0, func() { m.Echo(m.Trans("not found order", "没有等待")) }, func() { m.Action(s.Call) }) kit.If(m.Length() == 0, func() { m.Echo(m.Trans("not found order", "没有等待")) }, func() { m.Action(s.Call) })
} else if len(arg) == 2 { } else if len(arg) == 2 {
m.Cmdy(s.schedule, arg[0], arg[1]).Action(s.Call) m.Cmdy(s.Schedule, arg[0], arg[1]).Action(s.Call)
} else if len(arg) == 3 { } else if len(arg) == 3 {
m.Cmdy(s.schedule, s.Select, model.QUEUE_UID, arg[0], model.RECEPTION_UID, arg[2], model.STATUS, ScheduleTake).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{}) } func init() { ice.TeamCtxCmd(call{}) }

View File

@ -15,50 +15,41 @@ type Table struct {
func (s Table) Inputs(m *ice.Message, arg ...string) { func (s Table) Inputs(m *ice.Message, arg ...string) {
switch arg[0] { switch arg[0] {
case model.QUEUE_TYPE:
for k, v := range QueueTypeList {
m.Push(arg[0], k).Push(model.NAME, v)
}
m.SortInt(arg[0]).DisplayInputKeyNameIconTitle()
case model.USER_QUEUE_ROLE: case model.USER_QUEUE_ROLE:
for k, v := range UserQueueRoleList { s.InputsListRole(m, UserQueueRoleList, arg...)
if k != UserQueueCreator && k != UserQueueVisitor { case model.QUEUE_TYPE:
m.Push(arg[0], k).Push(model.NAME, v) s.InputsList(m, QueueTypeList, arg...)
}
}
m.SortInt(arg[0]).DisplayInputKeyNameIconTitle()
default: default:
s.Table.Inputs(m, arg...) s.Table.Inputs(m, arg...)
} }
} }
func (s Table) RewriteAppend(m *ice.Message, arg ...string) *ice.Message { func (s Table) RewriteAppend(m *ice.Message, arg ...string) *ice.Message {
m.RewriteAppend(func(value, key string, index int) string { m.RewriteAppend(func(value, key string, index int) string {
kit.If(key == model.QUEUE_TYPE, func() { value = QueueType(kit.Int(value)).String() }) switch key {
kit.If(key == model.USER_QUEUE_ROLE, func() { value = UserQueueRole(kit.Int(value)).String() }) case model.USER_QUEUE_ROLE:
kit.If(key == model.SCHEDULE_STATUS, func() { value = ScheduleStatus(kit.Int(value)).String() }) value = UserQueueRole(kit.Int(value)).String()
case model.QUEUE_TYPE:
value = QueueType(kit.Int(value)).String()
case model.SCHEDULE_STATUS:
value = ScheduleStatus(kit.Int(value)).String()
}
return value return value
}) })
return s.Table.RewriteAppend(m) return s.Table.RewriteAppend(m)
} }
func (s Table) checkRole(m *ice.Message, arg ...UserQueueRole) bool { func (s Table) CheckRole(m *ice.Message, arg ...string) *ice.Message {
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))) 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) { m.WarnNotRight(!kit.IsIn(role.String(), append(arg, UserQueueCreator.String())...), role.String())
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 return m
} }
func (s Table) recordEvent(m *ice.Message, info string, arg ...string) {
type Tables struct { s.Table.RecordEvent(m, m.Option(model.QUEUE_UID), info, kit.Select(m.Option(model.UID), arg, 0))
Table
portal string `data:"true"`
} }
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 (s Tables) BeforeMigrate(m *ice.Message, arg ...string) {}

View File

@ -2,13 +2,6 @@ package yuehaoxitong
import "shylinux.com/x/ice" import "shylinux.com/x/ice"
type history struct { type history struct{ Schedule }
Tables
schedule schedule
}
func (s history) List(m *ice.Message, arg ...string) {
m.Cmdy(s.schedule, arg)
}
func init() { ice.TeamCtxCmd(history{}) } func init() { ice.TeamCtxCmd(history{}) }

View File

@ -44,13 +44,13 @@ type UserQueue struct {
type Queue struct { type Queue struct {
db.ModelWithUID db.ModelWithUID
CompanyUID string `gorm:"type:char(32);index"` CompanyUID string `gorm:"type:char(32);index"`
Name string `gorm:"type:char(64)"` Name string `gorm:"type:varchar(64)"`
Type uint8 Type uint8
} }
type Reception struct { type Reception struct {
db.ModelWithUID db.ModelWithUID
QueueUID string `gorm:"type:char(32);index"` QueueUID string `gorm:"type:char(32);index"`
Name string `gorm:"type:char(64)"` Name string `gorm:"type:varchar(64)"`
} }
type Volume struct { type Volume struct {
db.ModelWithUID db.ModelWithUID

View File

@ -10,23 +10,17 @@ import (
type open struct { type open struct {
Tables Tables
volume volume 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:"manager"`
list string `name:"list queue_uid uid auto" role:"manager"`
} }
func (s open) Create(m *ice.Message, arg ...string) { func (s open) Create(m *ice.Message, arg ...string) {
if s.checkRole(m) {
m.Cmdy(s.volume, s.Create, arg, m.OptionSimple(model.QUEUE_UID)).ProcessRefresh() 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()) 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) { func (s open) List(m *ice.Message, arg ...string) {
if len(arg) == 0 {
return
}
if s.checkRole(m.Options(model.QUEUE_UID, arg[0])) {
if m.Cmdy(s.volume, arg); m.Length() == 0 { if m.Cmdy(s.volume, arg); m.Length() == 0 {
m.EchoInfoButton(m.Trans("please create open", "请创建放号"), s.Create) m.EchoInfoButton("", s.Create)
}
} }
} }

View File

@ -8,26 +8,22 @@ import (
) )
type plan struct { type plan struct {
Tables Schedule
schedule schedule
create string `name:"create reception_uid*:select volume_uid*:select" role:"void"` create string `name:"create reception_uid*:select volume_uid*:select" role:"void"`
cancel string `name:"cancel" role:"void"` cancel string `name:"cancel" role:"void"`
} }
func (s plan) Create(m *ice.Message, arg ...string) { 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) s.Create(m, kit.Simple(arg, m.OptionSimple(model.QUEUE_UID, model.USER_UID), model.STATUS, SchedulePlan)...)
} }
func (s plan) List(m *ice.Message, arg ...string) { func (s plan) List(m *ice.Message, arg ...string) {
if len(arg) == 1 { if len(arg) == 1 {
m.Cmdy(s.schedule, s.schedule.SelectByStatus, arg[0], SchedulePlan, m.OptionSimple(model.USER_UID)).PushAction(s.Cancel) s.Schedule.SelectByStatus(m, kit.Simple(arg[0], SchedulePlan, m.OptionSimple(model.USER_UID))...).PushAction(s.Cancel)
kit.If(m.Length() == 0, func() { m.EchoInfoButton(m.Trans("please create schedule", "请创建预约"), s.Create) }, func() { m.Action(s.Create) }) kit.If(m.Length() == 0, func() { m.EchoInfoButton("", s.Create) }, func() { m.Action(s.Create) })
} else if len(arg) == 2 { } else if len(arg) == 2 {
m.FieldsSetDetail() 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.Cancel) s.Schedule.SelectByStatus(m, kit.Simple(arg[0], SchedulePlan, m.OptionSimple(model.USER_UID), s.Key(s.Schedule, model.UID), arg[1])...).PushAction(s.Cancel)
} }
} }
func (s plan) Cancel(m *ice.Message, arg ...string) {
m.Cmdy(s.schedule, s.Cancel)
}
func init() { ice.TeamCtxCmd(plan{}) } func init() { ice.TeamCtxCmd(plan{}) }

View File

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

View File

@ -0,0 +1,4 @@
chapter "约号系统"
field web.code.mysql.client
field web.code.mysql.query args `mysql yuehaoxitong`
field web.code.db.models

View File

@ -2,23 +2,28 @@ package yuehaoxitong
import ( import (
"shylinux.com/x/ice" "shylinux.com/x/ice"
"shylinux.com/x/icebergs/base/mdb"
"shylinux.com/x/community/src/yuehaoxitong/model" "shylinux.com/x/community/src/yuehaoxitong/model"
) )
type reception struct { type reception struct {
Table Table
create string `name:"create name*" role:"void"` create string `name:"create name*" role:"manager"`
rename string `name:"rename name*" role:"void"` rename string `name:"rename name*" role:"manager"`
delete string `name:"delete" role:"void"` remove string `name:"remove" role:"manager"`
} }
func (s reception) Create(m *ice.Message, arg ...string) { func (s reception) Create(m *ice.Message, arg ...string) {
if s.checkRole(m) {
s.Table.Create(m, append(arg, m.OptionSimple(model.QUEUE_UID)...)...) s.Table.Create(m, append(arg, m.OptionSimple(model.QUEUE_UID)...)...)
s.recordEvent(m, m.Trans("create reception ", "创建服务场所 ")+m.Option(mdb.NAME), m.Result()) 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, "")
}
func (s reception) Rename(m *ice.Message, arg ...string) {
s.Table.Rename(m, m.OptionSimple(model.QUEUE_UID, model.UID)...)
s.recordEventWithName(m, "")
} }
func (s reception) List(m *ice.Message, arg ...string) { func (s reception) List(m *ice.Message, arg ...string) {
s.Table.Fields(m, model.UID, model.NAME, model.CREATED_AT) s.Table.Fields(m, model.UID, model.NAME, model.CREATED_AT)
@ -31,19 +36,7 @@ func (s reception) List(m *ice.Message, arg ...string) {
} else if len(arg) == 2 { } else if len(arg) == 2 {
s.Table.SelectDetail(m, model.QUEUE_UID, arg[0], model.UID, arg[1]) s.Table.SelectDetail(m, model.QUEUE_UID, arg[0], model.UID, arg[1])
} }
m.PushAction(s.Rename, s.Delete) m.PushAction(s.Rename, s.Remove)
}
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{}) } func init() { ice.TeamCtxCmd(reception{}) }

View File

@ -8,18 +8,17 @@ import (
"shylinux.com/x/community/src/yuehaoxitong/model" "shylinux.com/x/community/src/yuehaoxitong/model"
) )
type schedule struct { type Schedule struct {
Table Table
queue queue queue queue
userQueue userQueue userQueue userQueue
reception reception reception reception
volume volume volume volume
models string `data:"schedule"`
plan string `name:"plan begin_time@date end_time@date"` 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) { func (s Schedule) Create(m *ice.Message, arg ...string) {
defer m.ToastProcess("约号中...")("约号成功") defer m.ToastProcess("约号中...")("约号成功")
s.Transaction(m, func() { s.Transaction(m, func() {
msg := m.Cmd(s.volume, s.SelectForUpdate, model.UID, m.Option(model.VOLUME_UID)) msg := m.Cmd(s.volume, s.SelectForUpdate, model.UID, m.Option(model.VOLUME_UID))
@ -31,11 +30,8 @@ func (s schedule) Create(m *ice.Message, arg ...string) {
}) })
s.sendTemplate(m, "约号成功", m.Result()) s.sendTemplate(m, "约号成功", m.Result())
} }
func (s schedule) Call(m *ice.Message, arg ...string) { func (s Schedule) Call(m *ice.Message, arg ...string) {
defer m.ToastProcess("叫号中...")("叫号成功") defer m.ToastProcess("叫号中...")("叫号成功")
if !s.checkRole(m, UserQueueCreator, UserQueueWorker) {
return
}
s.Orders(m, model.TAKE_TIME).Limit(m, 1) 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.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)...) // s.Select(m, kit.Simple(m.OptionSimple(model.QUEUE_UID, model.RECEPTION_UID), mdb.STATUS, ScheduleTake)...)
@ -47,7 +43,7 @@ func (s schedule) Call(m *ice.Message, arg ...string) {
s.sendTemplate(m, "服务已叫号", m.Append(model.UID)) s.sendTemplate(m, "服务已叫号", m.Append(model.UID))
m.ProcessRewrite(model.UID, m.Append(model.UID)) m.ProcessRewrite(model.UID, m.Append(model.UID))
} }
func (s schedule) List(m *ice.Message, arg ...string) { func (s Schedule) List(m *ice.Message, arg ...string) {
role := UserQueueRole(kit.Int(m.Cmd(s.userQueue, s.Select, m.OptionSimple(model.QUEUE_UID, model.USER_UID)).Append(model.ROLE))) 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, 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, model.CANCEL_TIME, model.TAKE_TIME, model.CALL_TIME, model.EXPIRE_TIME, model.FINISH_TIME,
@ -103,7 +99,7 @@ func (s schedule) List(m *ice.Message, arg ...string) {
s.RewriteAppend(m) s.RewriteAppend(m)
m.Action() m.Action()
} }
func (s schedule) SelectByStatus(m *ice.Message, arg ...string) *ice.Message { func (s Schedule) SelectByStatus(m *ice.Message, arg ...string) *ice.Message {
order := m.Option(mdb.ORDER) order := m.Option(mdb.ORDER)
s.Tables(m, s.volume).FieldsWithCreatedAT(m, s, model.SCHEDULE_STATUS, model.BEGIN_TIME, model.END_TIME, 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, model.CANCEL_TIME, model.TAKE_TIME, model.CALL_TIME, model.EXPIRE_TIME, model.FINISH_TIME,
@ -116,7 +112,7 @@ func (s schedule) SelectByStatus(m *ice.Message, arg ...string) *ice.Message {
s.RewriteAppend(m) s.RewriteAppend(m)
return m return m
} }
func (s schedule) Cancel(m *ice.Message, arg ...string) { func (s Schedule) Cancel(m *ice.Message, arg ...string) {
defer m.ToastProcess("取消中...")("取消成功") defer m.ToastProcess("取消中...")("取消成功")
if m.WarnNotFound(s.Select(m, m.OptionSimple(model.UID, model.USER_UID)...).Length() == 0) { if m.WarnNotFound(s.Select(m, m.OptionSimple(model.UID, model.USER_UID)...).Length() == 0) {
return return
@ -128,7 +124,7 @@ func (s schedule) Cancel(m *ice.Message, arg ...string) {
s.sendTemplate(m, "约号取消") s.sendTemplate(m, "约号取消")
m.ProcessRefresh() m.ProcessRefresh()
} }
func (s schedule) Take(m *ice.Message, arg ...string) { func (s Schedule) Take(m *ice.Message, arg ...string) {
defer m.ToastProcess("取号中...")("取号成功") defer m.ToastProcess("取号中...")("取号成功")
if m.WarnNotFound(s.Select(m, m.OptionSimple(model.UID, model.USER_UID)...).Length() == 0) { if m.WarnNotFound(s.Select(m, m.OptionSimple(model.UID, model.USER_UID)...).Length() == 0) {
return return
@ -137,9 +133,8 @@ func (s schedule) Take(m *ice.Message, arg ...string) {
s.sendTemplate(m, "取号成功") s.sendTemplate(m, "取号成功")
m.ProcessRefresh() m.ProcessRefresh()
} }
func (s schedule) Expire(m *ice.Message, arg ...string) { func (s Schedule) Expire(m *ice.Message, arg ...string) {
defer m.ToastProcess("过号中...")("过号成功") defer m.ToastProcess("过号中...")("过号成功")
if s.checkRole(m, UserQueueCreator, UserQueueWorker) {
s.Transaction(m, func() { s.Transaction(m, func() {
s.addCount(m, "", "1") s.addCount(m, "", "1")
s.changeStatus(m, ScheduleCall, ScheduleExpire, arg...) s.changeStatus(m, ScheduleCall, ScheduleExpire, arg...)
@ -148,10 +143,8 @@ func (s schedule) Expire(m *ice.Message, arg ...string) {
s.sendTemplate(m, "服务已过号") s.sendTemplate(m, "服务已过号")
m.ProcessRefresh() m.ProcessRefresh()
} }
} func (s Schedule) Finish(m *ice.Message, arg ...string) {
func (s schedule) Finish(m *ice.Message, arg ...string) {
defer m.ToastProcess("完成中...")("完成成功") defer m.ToastProcess("完成中...")("完成成功")
if s.checkRole(m, UserQueueCreator, UserQueueWorker) {
s.Transaction(m, func() { s.Transaction(m, func() {
s.addCount(m, "", "1") s.addCount(m, "", "1")
s.changeStatus(m, ScheduleCall, ScheduleFinish, arg...) s.changeStatus(m, ScheduleCall, ScheduleFinish, arg...)
@ -160,19 +153,18 @@ func (s schedule) Finish(m *ice.Message, arg ...string) {
s.sendTemplate(m, "服务已完成") s.sendTemplate(m, "服务已完成")
m.ProcessRefresh() m.ProcessRefresh()
} }
}
func init() { ice.TeamCtxCmd(schedule{}) } func init() { ice.TeamCtxCmd(Schedule{}) }
func (s schedule) addCount(m *ice.Message, key, count string) { 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)) 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 { func (s Schedule) changeStatus(m *ice.Message, from, to ScheduleStatus, arg ...string) *ice.Message {
key := m.ActionKey() + "_time" key := m.ActionKey() + "_time"
s.Table.ChangeStatus(m, m.Option(model.UID), int(from), int(to), kit.TransArgValueTime(append(arg, key, m.Time()), key)...) s.Table.ChangeStatus(m, m.Option(model.UID), int(from), int(to), kit.TransArgValueTime(append(arg, key, m.Time()), key)...)
return m return m
} }
func (s schedule) sendTemplate(m *ice.Message, title string, arg ...string) *ice.Message { 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)) 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)) reception := m.Cmd(s.reception, s.Select, model.UID, m.Option(model.RECEPTION_UID))
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)) 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))

View File

@ -8,22 +8,18 @@ import (
) )
type take struct { type take struct {
Tables Schedule
schedule schedule
take string `name:"take" help:"取号" role:"void"` take string `name:"take" help:"取号" role:"void"`
} }
func (s take) List(m *ice.Message, arg ...string) { func (s take) List(m *ice.Message, arg ...string) {
if len(arg) == 1 { if len(arg) == 1 {
m.Cmdy(s.schedule, s.schedule.SelectByStatus, arg[0], SchedulePlan, m.OptionSimple(model.USER_UID)).PushAction(s.Take) s.Schedule.SelectByStatus(m, kit.Simple(arg[0], SchedulePlan, m.OptionSimple(model.USER_UID))...).PushAction(s.Take)
kit.If(m.Length() == 0, func() { m.Echo(m.Trans("not found plan", "没有未取的号")) }) kit.If(m.Length() == 0, func() { m.Echo(m.Trans("not found plan", "没有未取的号")) })
} else if len(arg) == 2 { } else if len(arg) == 2 {
m.FieldsSetDetail() 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) s.Schedule.SelectByStatus(m, kit.Simple(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{}) } func init() { ice.TeamCtxCmd(take{}) }

View File

@ -22,7 +22,6 @@ func (s userQueue) User(m *ice.Message, arg ...string) {
} }
m.RenameAppend(model.ROLE, model.USER_QUEUE_ROLE) m.RenameAppend(model.ROLE, model.USER_QUEUE_ROLE)
s.SelectJoinUser(m) s.SelectJoinUser(m)
s.RewriteAppend(m)
} }
func (s userQueue) List(m *ice.Message, arg ...string) { func (s userQueue) List(m *ice.Message, arg ...string) {
s.Tables(m, s.queue).FieldsWithCreatedAT(m, s, s.Tables(m, s.queue).FieldsWithCreatedAT(m, s,
@ -38,7 +37,6 @@ func (s userQueue) List(m *ice.Message, arg ...string) {
} }
s.SelectJoinCompany(m) s.SelectJoinCompany(m)
s.SelectJoinCity(m) s.SelectJoinCity(m)
s.RewriteAppend(m)
} }
func init() { ice.TeamCtxCmd(userQueue{Table: newTable()}) } func init() { ice.TeamCtxCmd(userQueue{Table: newTable()}) }

View File

@ -25,9 +25,8 @@ func (s volume) List(m *ice.Message, arg ...string) {
s.Select(m, s.Key(s, model.QUEUE_UID), arg[0]) s.Select(m, s.Key(s, model.QUEUE_UID), arg[0])
} else if len(arg) == 2 { } else if len(arg) == 2 {
s.Fields(m, model.CREATED_AT, model.UID, model.USER_UID, s.AS(model.STATUS, model.SCHEDULE_STATUS)) 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) m.Cmdy(Schedule{}, s.Select, "volume_uid = ? and status != ?", arg[1], ScheduleCancel)
s.SelectJoinUser(m) s.SelectJoinUser(m)
s.RewriteAppend(m)
} }
} }

View File

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

View File

@ -27,27 +27,13 @@
"time": "2024-08-11 09:30:00.536" "time": "2024-08-11 09:30:00.536"
} }
}, },
"1da7b672d4dfc12166de36c4f0f1279c": {
"meta": {
"_target": [
"5e5292ec8e95dedb5e23fa5a49ffc1f4"
],
"enable": "true",
"icons": "https://img.icons8.com/officel/80/receipt-approved.png",
"index": "web.team.yuehaoxitong.order",
"name": "权限审批",
"order": "4",
"role": "creator,manager",
"time": "2024-08-11 09:30:00.526"
}
},
"377f3c0dae9dbf423a8e188bfd245b7a": { "377f3c0dae9dbf423a8e188bfd245b7a": {
"meta": { "meta": {
"enable": "true", "enable": "true",
"icons": "https://img.icons8.com/officel/80/multiple-smartphones.png", "icons": "https://img.icons8.com/officel/80/multiple-smartphones.png",
"index": "web.team.yuehaoxitong.recent", "index": "web.team.yuehaoxitong.recent",
"name": "最近访问", "name": "最近访问",
"order": "100", "order": "101",
"time": "2024-08-20 11:07:54.840" "time": "2024-08-20 11:07:54.840"
} }
}, },
@ -70,6 +56,7 @@
"_target": [ "_target": [
"d21f8cd636d4b90986a476e4746c1b25" "d21f8cd636d4b90986a476e4746c1b25"
], ],
"enable": "true",
"icons": "https://img.icons8.com/officel/80/receipt-approved.png", "icons": "https://img.icons8.com/officel/80/receipt-approved.png",
"index": "web.team.yuehaoxitong.allow", "index": "web.team.yuehaoxitong.allow",
"name": "权限审批", "name": "权限审批",
@ -150,7 +137,7 @@
"icons": "https://img.icons8.com/officel/80/customer-support.png", "icons": "https://img.icons8.com/officel/80/customer-support.png",
"index": "web.team.yuehaoxitong.support", "index": "web.team.yuehaoxitong.support",
"name": "客服支持", "name": "客服支持",
"order": "100", "order": "103",
"time": "2024-08-20 21:24:17.275" "time": "2024-08-20 21:24:17.275"
} }
}, },
@ -204,8 +191,7 @@
"icons": "https://img.icons8.com/officel/80/activity-grid.png", "icons": "https://img.icons8.com/officel/80/activity-grid.png",
"index": "web.team.yuehaoxitong.service", "index": "web.team.yuehaoxitong.service",
"name": "服务发现", "name": "服务发现",
"order": "100", "order": "102",
"role": "creator",
"time": "2024-08-11 09:30:00.529" "time": "2024-08-11 09:30:00.529"
} }
}, },