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.code.mysql.client
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) {
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:
for k, v := range User{{.Option "Class"}}RoleList {
if k != User{{.Option "Class"}}Creator && k != User{{.Option "Class"}}Visitor {
m.Push(arg[0], k).Push(model.NAME, v)
}
}
m.SortInt(arg[0]).DisplayInputKeyNameIconTitle()
s.InputsListRole(m, User{{.Option "Class"}}RoleList, arg...)
case model.{{.Option "CLASS"}}_TYPE:
s.InputsList(m, {{.Option "Class"}}TypeList, arg...)
default:
s.Table.Inputs(m, arg...)
}
}
func (s Table) RewriteAppend(m *ice.Message, arg ...string) *ice.Message {
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() })
kit.If(key == model.USER_{{.Option "CLASS"}}_ROLE, func() { value = User{{.Option "Class"}}Role(kit.Int(value)).String() })
switch key {
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
})
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
}
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())
}
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))
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 {
Table
portal string `data:"true"`
}
type Tables struct { Table }
func (s Tables) BeforeMigrate(m *ice.Message, arg ...string) {}

View File

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

View File

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

View File

@ -28,14 +28,14 @@ type User{{.Option "Class"}} struct {
type {{.Option "Class"}} struct {
db.ModelWithUID
CompanyUID string `gorm:"type:char(32);index"`
Name string `gorm:"type:char(64)"`
Name string `gorm:"type:varchar(64)"`
Type uint8
}
type {{.Option "Table"}} struct {
db.ModelWithUID
{{.Option "Class"}}UID 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
}

View File

@ -7,8 +7,6 @@ import (
type Portal struct {
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"`
}

View File

@ -14,8 +14,8 @@
},
"value": {
"user_{{.Option "class"}}_role": {
"creator": "创建人",
"visitor": "访客",
"creator": "创建人",
"leader": "管理人员",
"worker": "工作人员",
"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)
s.SelectJoinUser(m)
s.RewriteAppend(m)
}
func (s user{{.Option "Class"}}) List(m *ice.Message, arg ...string) {
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.SelectJoinCity(m)
s.RewriteAppend(m)
}
func init() { ice.TeamCtxCmd(user{{.Option "Class"}}{}) }
@ -46,16 +44,16 @@ func init() { ice.TeamCtxCmd(user{{.Option "Class"}}{}) }
type User{{.Option "Class"}}Role int
const (
User{{.Option "Class"}}Creator User{{.Option "Class"}}Role = iota
User{{.Option "Class"}}Visitor
User{{.Option "Class"}}Visitor User{{.Option "Class"}}Role = iota
User{{.Option "Class"}}Creator
User{{.Option "Class"}}Leader
User{{.Option "Class"}}Worker
User{{.Option "Class"}}Server
)
var User{{.Option "Class"}}RoleList = map[User{{.Option "Class"}}Role]string{
User{{.Option "Class"}}Creator: "creator",
User{{.Option "Class"}}Visitor: "visitor",
User{{.Option "Class"}}Creator: "creator",
User{{.Option "Class"}}Leader: "leader",
User{{.Option "Class"}}Worker: "worker",
User{{.Option "Class"}}Server: "server",

View File

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

View File

@ -9,33 +9,23 @@ import (
)
type call struct {
Tables
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"`
Schedule
call string `name:"call" help:"叫号" role:"worker"`
list string `name:"list queue_uid uid reception_uid auto" role:"worker"`
expire string `name:"expire" role:"worker"`
finish string `name:"finish" role:"worker"`
}
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) {
if len(arg) == 1 {
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) })
} 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 {
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{}) }

View File

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

View File

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

View File

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

View File

@ -10,23 +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:"manager"`
list string `name:"list queue_uid uid auto" role:"manager"`
}
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()
s.RecordEvent(m, m.Trans("create volume", "创建服务计划")+"\n"+s.joinKV(m, model.AMOUNT, model.BEGIN_TIME, model.END_TIME), m.Result())
}
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 len(arg) == 0 {
return
}
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)
}
if m.Cmdy(s.volume, arg); m.Length() == 0 {
m.EchoInfoButton("", s.Create)
}
}

View File

@ -8,26 +8,22 @@ import (
)
type plan struct {
Tables
schedule schedule
create string `name:"create reception_uid*:select volume_uid*:select" role:"void"`
cancel string `name:"cancel" role:"void"`
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)
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) {
if len(arg) == 1 {
m.Cmdy(s.schedule, s.schedule.SelectByStatus, 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) })
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("", s.Create) }, func() { m.Action(s.Create) })
} 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.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{}) }

View File

@ -7,8 +7,6 @@ import (
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* 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 (
"shylinux.com/x/ice"
"shylinux.com/x/icebergs/base/mdb"
"shylinux.com/x/community/src/yuehaoxitong/model"
)
type reception struct {
Table
create string `name:"create name*" role:"void"`
rename string `name:"rename name*" role:"void"`
delete string `name:"delete" role:"void"`
create string `name:"create name*" role:"manager"`
rename string `name:"rename name*" role:"manager"`
remove string `name:"remove" role:"manager"`
}
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.recordEvent(m, m.Trans("create reception ", "创建服务场所 ")+m.Option(mdb.NAME), m.Result())
}
s.Table.Create(m, append(arg, m.OptionSimple(model.QUEUE_UID)...)...)
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) {
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 {
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))
}
m.PushAction(s.Rename, s.Remove)
}
func init() { ice.TeamCtxCmd(reception{}) }

View File

@ -8,18 +8,17 @@ import (
"shylinux.com/x/community/src/yuehaoxitong/model"
)
type schedule struct {
type Schedule struct {
Table
queue queue
userQueue userQueue
reception reception
volume volume
models string `data:"schedule"`
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("约号中...")("约号成功")
s.Transaction(m, func() {
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())
}
func (s schedule) Call(m *ice.Message, arg ...string) {
func (s Schedule) Call(m *ice.Message, arg ...string) {
defer m.ToastProcess("叫号中...")("叫号成功")
if !s.checkRole(m, UserQueueCreator, UserQueueWorker) {
return
}
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)...)
@ -47,7 +43,7 @@ func (s schedule) Call(m *ice.Message, arg ...string) {
s.sendTemplate(m, "服务已叫号", 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)))
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,
@ -103,7 +99,7 @@ func (s schedule) List(m *ice.Message, arg ...string) {
s.RewriteAppend(m)
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)
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,
@ -116,7 +112,7 @@ func (s schedule) SelectByStatus(m *ice.Message, arg ...string) *ice.Message {
s.RewriteAppend(m)
return m
}
func (s schedule) Cancel(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
@ -128,7 +124,7 @@ func (s schedule) Cancel(m *ice.Message, arg ...string) {
s.sendTemplate(m, "约号取消")
m.ProcessRefresh()
}
func (s schedule) Take(m *ice.Message, arg ...string) {
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
@ -137,42 +133,38 @@ func (s schedule) Take(m *ice.Message, arg ...string) {
s.sendTemplate(m, "取号成功")
m.ProcessRefresh()
}
func (s schedule) Expire(m *ice.Message, arg ...string) {
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()
}
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) {
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()
}
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 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))
}
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"
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 {
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))
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 {
Tables
schedule schedule
take string `name:"take" help:"取号" role:"void"`
Schedule
take string `name:"take" help:"取号" role:"void"`
}
func (s take) List(m *ice.Message, arg ...string) {
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", "没有未取的号")) })
} 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)
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{}) }

View File

@ -22,7 +22,6 @@ func (s userQueue) User(m *ice.Message, arg ...string) {
}
m.RenameAppend(model.ROLE, model.USER_QUEUE_ROLE)
s.SelectJoinUser(m)
s.RewriteAppend(m)
}
func (s userQueue) List(m *ice.Message, arg ...string) {
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.SelectJoinCity(m)
s.RewriteAppend(m)
}
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])
} 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)
m.Cmdy(Schedule{}, s.Select, "volume_uid = ? and status != ?", arg[1], ScheduleCancel)
s.SelectJoinUser(m)
s.RewriteAppend(m)
}
}

View File

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

View File

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