From 724bdcf8b19e857a417aa7e6ba314a626fa4ad0d Mon Sep 17 00:00:00 2001 From: shy Date: Wed, 25 Sep 2024 22:38:20 +0800 Subject: [PATCH] add some --- src/gonganxitong/common.go | 13 +++++++--- src/gonganxitong/portal.go | 5 ---- src/huodongzuzhi/model/model.go | 3 +-- src/yuehaoxitong/call.go | 18 ++++--------- src/yuehaoxitong/model/model.go | 29 ++++++++++----------- src/yuehaoxitong/open.go | 7 ++--- src/yuehaoxitong/plan.css | 8 ++++++ src/yuehaoxitong/plan.go | 33 ++++++++++++++++------- src/yuehaoxitong/plan.js | 23 +++++++++++++++++ src/yuehaoxitong/portal.go | 12 ++++++--- src/yuehaoxitong/portal.json | 12 ++++----- src/yuehaoxitong/portal.shy | 24 ----------------- src/yuehaoxitong/reception.go | 6 ++--- src/yuehaoxitong/schedule.go | 46 ++++++++++++++++----------------- src/yuehaoxitong/schedule.js | 6 ++--- src/yuehaoxitong/userQueue.go | 4 --- src/yuehaoxitong/volume.go | 22 +++++++--------- src/yuehaoxitong/volume.js | 4 +-- 18 files changed, 141 insertions(+), 134 deletions(-) create mode 100644 src/yuehaoxitong/plan.css create mode 100644 src/yuehaoxitong/plan.js delete mode 100644 src/yuehaoxitong/portal.shy diff --git a/src/gonganxitong/common.go b/src/gonganxitong/common.go index b02bfec..d2f9dd6 100644 --- a/src/gonganxitong/common.go +++ b/src/gonganxitong/common.go @@ -110,10 +110,11 @@ func (s Table) InputsListValue(m *ice.Message, list ice.Any, key string) string return "" } func (s Table) ValueModel(m *ice.Message, action ice.Any, arg ...string) *ice.Message { - defer m.Options(db.TARGET, kit.Select(m.CommandKey(), m.Config(db.MODELS))).Set(ice.MSG_OPTION, db.TARGET) - defer m.Options(db.MODEL, m.Configv(db.MODEL)).Set(ice.MSG_OPTION, db.MODEL) defer m.Options(db.DB, m.Configv(db.DB)).Set(ice.MSG_OPTION, db.DB) - return m.Cmdy(m.Prefix(web.PORTAL), action, arg) + defer m.Options(db.MODEL, m.Configv(db.MODEL)).Set(ice.MSG_OPTION, db.MODEL) + defer m.Options(db.TARGET, kit.Select(m.CommandKey(), m.Config(db.MODELS))).Set(ice.MSG_OPTION, db.TARGET) + kit.For(db.CommonField, func(k string) { arg = kit.TransArgKeys(arg, s.Keys(m.Option(db.TARGET), k), k) }) + return m.Options(arg).Cmdy(m.Prefix(web.PORTAL), action, arg) } func (s Table) ValueCreate(m *ice.Message, arg ...string) { s.ValueModel(m, s.ValueCreate, arg...) @@ -244,6 +245,12 @@ func (s Table) IsLeader(m *ice.Message) bool { } return false } +func (s Table) IsWorker(m *ice.Message) bool { + if role := kit.Int(m.Option(model.USER_ROLE)); role == 1 || role == 2 || role == 3 { + return true + } + return false +} func (s Table) UserPlaceRole(m *ice.Message) int { return kit.Int(m.Cmdy(s.Prefix(m, Portal{}), s.UserPlaceRole).Option(model.USER_ROLE)) } diff --git a/src/gonganxitong/portal.go b/src/gonganxitong/portal.go index 97db53a..bd48eed 100644 --- a/src/gonganxitong/portal.go +++ b/src/gonganxitong/portal.go @@ -226,11 +226,6 @@ func (s Portal) PlaceAuth(m *ice.Message, arg ...string) { } func (s Portal) ValueCreate(m *ice.Message, arg ...string) { - arg = kit.TransArgKeys(arg, s.Keys(m.Option(db.TARGET), model.NAME), model.NAME) - arg = kit.TransArgKeys(arg, s.Keys(m.Option(db.TARGET), model.TYPE), model.TYPE) - arg = kit.TransArgKeys(arg, s.Keys(m.Option(db.TARGET), model.LEVEL), model.LEVEL) - arg = kit.TransArgKeys(arg, s.Keys(m.Option(db.TARGET), model.TITLE), model.TITLE) - arg = kit.TransArgKeys(arg, s.Keys(m.Option(db.TARGET), model.CONTENT), model.CONTENT) s.Table.Insert(m, kit.Simple(arg, m.OptionSimple(model.USER_UID, s.Keys(s.Place, model.UID)))...) } func (s Portal) ValueRemove(m *ice.Message, arg ...string) { diff --git a/src/huodongzuzhi/model/model.go b/src/huodongzuzhi/model/model.go index 14e3cca..5a43c64 100644 --- a/src/huodongzuzhi/model/model.go +++ b/src/huodongzuzhi/model/model.go @@ -5,6 +5,7 @@ import "shylinux.com/x/mysql-story/src/db" const ( UID = "uid" NAME = "name" + INFO = "info" TYPE = "type" TITLE = "title" CONTENT = "content" @@ -14,8 +15,6 @@ const ( GROUP_NAME = "group_name" GROUP_TYPE = "group_type" ACTIVITY_UID = "activity_uid" - COMPANY_UID = "company_uid" - CITY_UID = "city_uid" ) type UserGroup struct { diff --git a/src/yuehaoxitong/call.go b/src/yuehaoxitong/call.go index 98ab300..756eeab 100644 --- a/src/yuehaoxitong/call.go +++ b/src/yuehaoxitong/call.go @@ -10,26 +10,18 @@ import ( type call struct { Schedule - list string `name:"list queue_uid uid reception_uid auto"` + list string `name:"list queue_uid uid reception_uid auto" role:"leader,worker"` } func (s call) Call(m *ice.Message, arg ...string) { m.Cmdy(s.Schedule, m.ActionKey(), arg) } func (s call) List(m *ice.Message, arg ...string) { - role := UserQueueRole(kit.Int(m.Option(model.USER_ROLE))) if len(arg) == 1 { - if role != UserQueueVisitor { - s.SelectByStatus(m.Options(mdb.ORDER, model.TAKE_TIME), arg[0], kit.Format(ScheduleTake)) - kit.If(m.Length() == 0, func() { m.Echo(m.Trans("wait take", "等待取号")) }, func() { m.Action(s.Call) }) - } + s.SelectByStatus(m.Options(mdb.ORDER, model.TAKE_TIME), arg[0], kit.Format(ScheduleTake)) + kit.If(m.Length() == 0, func() { m.Echo(m.Trans("wait take", "等待取号")) }, func() { m.Action(s.Call) }) } else if len(arg) == 2 { - s.Schedule.List(m, arg[0], arg[1]) - if role != UserQueueVisitor { - m.Action(s.Call) - } + s.Schedule.List(m, arg[0], arg[1]).Action(s.Call) } else if len(arg) == 3 { - if role != UserQueueVisitor { - s.Schedule.Select(m, model.QUEUE_UID, arg[0], model.RECEPTION_UID, arg[2], model.STATUS, kit.Format(ScheduleTake)).Action(s.Call) - } + s.Select(m, model.QUEUE_UID, arg[0], model.RECEPTION_UID, arg[2], model.STATUS, kit.Format(ScheduleTake)).Action(s.Call) } } func (s call) Expire(m *ice.Message, arg ...string) { m.Cmdy(s.Schedule, m.ActionKey(), arg) } diff --git a/src/yuehaoxitong/model/model.go b/src/yuehaoxitong/model/model.go index 98a91ca..e98a070 100644 --- a/src/yuehaoxitong/model/model.go +++ b/src/yuehaoxitong/model/model.go @@ -5,32 +5,30 @@ import "shylinux.com/x/mysql-story/src/db" const ( UID = "uid" NAME = "name" + INFO = "info" TYPE = "type" STATUS = "status" TITLE = "title" CONTENT = "content" USER_UID = "user_uid" - USER_ROLE = "user_role" USER_QUEUE_ROLE = "user_queue_role" QUEUE_UID = "queue_uid" - QUEUE_NAME = "queue_name" QUEUE_TYPE = "queue_type" RECEPTION_UID = "reception_uid" RECEPTION_NAME = "reception_name" VOLUME_UID = "volume_uid" - VOLUME_AMOUNT = "volume_amount" + VOLUME_TOTAL = "volume_total" SCHEDULE_UID = "schedule_uid" SCHEDULE_STATUS = "schedule_status" - COMPANY_UID = "company_uid" CALL_UID = "call_uid" BEGIN_TIME = "begin_time" END_TIME = "end_time" CANCEL_TIME = "cancel_time" TAKE_TIME = "take_time" CALL_TIME = "call_time" - FINISH_TIME = "finish_time" EXPIRE_TIME = "expire_time" - AMOUNT = "amount" + FINISH_TIME = "finish_time" + TOTAL = "total" COUNT = "count" EXPIRE = "expire" FINISH = "finish" @@ -47,33 +45,34 @@ type Queue struct { type Reception struct { db.ModelWithUID QueueUID string `gorm:"type:char(32);index"` - UserUID string `gorm:"type:char(32);index"` + UserUID string `gorm:"type:char(32)"` Name string `gorm:"type:varchar(64)"` + Info string `gorm:"type:varchar(255)"` } type Volume struct { db.ModelWithUID QueueUID string `gorm:"type:char(32);index:idx_queue"` ReceptionUID string `gorm:"type:char(32);index:idx_queue"` + Total int `gorm:"default:0"` + Count int `gorm:"default:0"` + Expire int `gorm:"default:0"` + Finish int `gorm:"default:0"` BeginTime db.Time EndTime db.Time - 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 - QueueUID string `gorm:"type:char(32);index:idx_queue"` - ReceptionUID string `gorm:"type:char(32);index:idx_queue"` - VolumeUID string `gorm:"type:char(32);index:idx_queue"` + QueueUID string `gorm:"type:char(32);index"` + ReceptionUID string `gorm:"type:char(32)"` + VolumeUID string `gorm:"type:char(32)"` UserUID string `gorm:"type:char(32);index"` CallUID string `gorm:"type:char(32);index"` + Status uint8 `gorm:"default:0"` CancelTime db.Time TakeTime db.Time CallTime db.Time ExpireTime db.Time FinishTime db.Time - Status uint8 `gorm:"default:0"` } func init() { db.CmdModels("", &UserQueue{}, &Queue{}, &Reception{}, Volume{}, &Schedule{}) } diff --git a/src/yuehaoxitong/open.go b/src/yuehaoxitong/open.go index bd17fda..6fc75f0 100644 --- a/src/yuehaoxitong/open.go +++ b/src/yuehaoxitong/open.go @@ -1,15 +1,12 @@ package yuehaoxitong -import ( - "shylinux.com/x/ice" - kit "shylinux.com/x/toolkits" -) +import "shylinux.com/x/ice" type open struct{ Volume } func (s open) List(m *ice.Message, arg ...string) { s.Volume.List(m, arg...).PushAction(s.MarketInsert) - kit.If(len(arg) == 1, func() { s.Button(m, "") }) + s.Button(m, "") } func init() { ice.TeamCtxCmd(open{}) } diff --git a/src/yuehaoxitong/plan.css b/src/yuehaoxitong/plan.css new file mode 100644 index 0000000..6164621 --- /dev/null +++ b/src/yuehaoxitong/plan.css @@ -0,0 +1,8 @@ +$output { display:flex; } +$output>div.reception { max-width:50%; } +$output>div.reception div.item { padding:10px; } +$output>div.reception div.item.select { background-color:var(--notice-bg-color); color:var(--notice-fg-color); } +$output>div.volume { flex-grow:1; } +$output>div.volume div.item { background-color:var(--output-bg-color); padding:10px; margin-bottom:5px; position:relative; } +$output>div.volume div.item div.status { display:flex; align-items:center; } +$output>div.volume div.item div.action { position:absolute; right:10px; top:13px; } \ No newline at end of file diff --git a/src/yuehaoxitong/plan.go b/src/yuehaoxitong/plan.go index ccd791d..9c4781e 100644 --- a/src/yuehaoxitong/plan.go +++ b/src/yuehaoxitong/plan.go @@ -2,23 +2,38 @@ package yuehaoxitong import ( "shylinux.com/x/ice" - kit "shylinux.com/x/toolkits" "shylinux.com/x/community/src/yuehaoxitong/model" ) -type plan struct{ Schedule } +type plan struct { + Schedule + volume Volume + reception reception + volumeList string `name:"volumeList" role:"void"` + receptionList string `name:"receptionList" role:"void"` +} func (s plan) Create(m *ice.Message, arg ...string) { - s.Schedule.Create(m, kit.Simple(arg, m.OptionSimple(model.QUEUE_UID, model.USER_UID), model.STATUS, SchedulePlan)...) + s.Schedule.Create(m, m.OptionSimple(model.QUEUE_UID, model.RECEPTION_UID, model.VOLUME_UID, model.USER_UID)...) +} +func (s plan) Cancel(m *ice.Message, arg ...string) { + s.Schedule.Cancel(m.Options(model.UID, m.Option(model.SCHEDULE_UID))) +} +func (s plan) VolumeList(m *ice.Message, arg ...string) { + s.Tables(m, "LEFT JOIN schedules ON schedules.volume_uid = volumes.uid AND status = 0") + s.Fields(m, s.Key(s.volume, model.UID), model.BEGIN_TIME, model.END_TIME, model.STATUS, s.AS(s.Key(s.Schedule, model.UID), model.SCHEDULE_UID)).Orders(m, model.BEGIN_TIME) + m.Cmdy(s.volume, s.Select, "volumes.queue_uid = ? AND volumes.reception_uid = ? AND end_time > ?", m.Option(model.QUEUE_UID), m.Option(model.RECEPTION_UID), m.Time()) + m.Table(func(value ice.Maps) { + if value[model.STATUS] == "0" { + m.PushButton(s.Cancel) + } else { + m.PushButton(s.Create) + } + }) } func (s plan) List(m *ice.Message, arg ...string) { - if len(arg) == 1 { - s.SelectByStatus(m, kit.Simple(arg[0], SchedulePlan, m.OptionSimple(model.USER_UID))...).PushAction(s.Cancel).Action(s.Create) - s.Button(m, "") - } else if len(arg) == 2 { - s.Schedule.List(m, arg...) - } + m.Cmdy(s.reception, arg).Action().Display("").DisplayCSS("") } func init() { ice.TeamCtxCmd(plan{}) } diff --git a/src/yuehaoxitong/plan.js b/src/yuehaoxitong/plan.js new file mode 100644 index 0000000..5eea89d --- /dev/null +++ b/src/yuehaoxitong/plan.js @@ -0,0 +1,23 @@ +Volcanos(chat.ONIMPORT, { + _init: function(can, msg) { + can.ui = can.page.Append(can, can._output, ["reception", "volume"]), can.onimport.reception(can, msg) + }, + reception: function(can, msg) { + can.page.Append(can, can.ui.reception, msg.Table(function(value) { + return {view: [html.ITEM, "", value.name], onclick: function(event) { can.onmotion.select(can, can.ui.reception, html.DIV_ITEM, event.target) + if (can.onmotion.cache(can, function() { return value.name }, can.ui.volume)) { return } can.onimport.volume(can, value) + }} + })); var list = can.page.Select(can, can.ui.reception, html.DIV_ITEM); list[0].click() + }, + volume: function(can, reception) { can.runAction(can.request({}, {reception_uid: reception.uid}), "volumeList", [], function(msg) { + can.page.Append(can, can.ui.volume, msg.Table(function(value) { value.reception_uid = reception.uid, value.volume_uid = value.uid + return {view: html.ITEM, list: [can.onimport.titleAction(can, value, "create", "cancel"), + {view: html.STATUS, list: [{text: "开始时间: "+value.begin_time}]}, + {view: html.STATUS, list: [{text: "结束时间: "+value.end_time}]}, + ]} + })) + }) }, +}) +Volcanos(chat.ONACTION, { + create: function(event, can, button) { can.runAction(event, button) }, +}) \ No newline at end of file diff --git a/src/yuehaoxitong/portal.go b/src/yuehaoxitong/portal.go index 939c717..27f35e7 100644 --- a/src/yuehaoxitong/portal.go +++ b/src/yuehaoxitong/portal.go @@ -2,6 +2,7 @@ package yuehaoxitong import ( "shylinux.com/x/ice" + kit "shylinux.com/x/toolkits" "shylinux.com/x/community/src/gonganxitong" "shylinux.com/x/community/src/yuehaoxitong/model" @@ -15,9 +16,12 @@ type Portal struct { func (s Portal) AfterPlaceAuth(m *ice.Message, arg ...string) { defer s.DashboardCreate(m, "")() - s.DashboardInsert(m, "1", "订单总量", "order", Schedule{}, "", model.QUEUE_UID, m.Option(model.QUEUE_UID)) - s.DashboardInsert(m, "2", "订单已预约", "order", Schedule{}, "", model.QUEUE_UID, m.Option(model.QUEUE_UID), model.STATUS, SchedulePlan) - s.DashboardInsert(m, "3", "订单已取号", "order", Schedule{}, "", model.QUEUE_UID, m.Option(model.QUEUE_UID), model.STATUS, ScheduleTake) - s.DashboardInsert(m, "4", "订单已完成", "order", Schedule{}, "", model.QUEUE_UID, m.Option(model.QUEUE_UID), model.STATUS, ScheduleFinish) + s.DashboardInsertOrder(m, "1", "订单总量") + s.DashboardInsertOrder(m, "2", "订单已预约", model.STATUS, SchedulePlan) + s.DashboardInsertOrder(m, "3", "订单已取号", model.STATUS, ScheduleTake) + s.DashboardInsertOrder(m, "4", "订单已完成", model.STATUS, ScheduleFinish) +} +func (s Portal) DashboardInsertOrder(m *ice.Message, order, title string, arg ...ice.Any) { + s.DashboardInsert(m, order, title, "order", Schedule{}, "", kit.TransArgs(kit.Simple(model.QUEUE_UID, m.Option(model.QUEUE_UID), arg))) } func init() { gonganxitong.PortalCmd(Portal{Portal: guanlixitong.NewPortal(userQueue{}, queue{})}) } diff --git a/src/yuehaoxitong/portal.json b/src/yuehaoxitong/portal.json index fd49aaf..bb9010a 100644 --- a/src/yuehaoxitong/portal.json +++ b/src/yuehaoxitong/portal.json @@ -1,15 +1,15 @@ { "portal": "约号系统", - "open": "放号", "plan": "约号", "take": "取号", "call": "叫号", - "reception": "服务场所", "volume": "服务计划", "schedule": "订单数据", "history": "我的订单", + "reception": "服务场所", "volume": "服务计划", "open": "放号", "plan": "约号", "take": "取号", "call": "叫号", + "schedule": "订单数据", "history": "我的订单", "expire": "过号", "finish": "完成", "icons": { + "reception": "https://img.icons8.com/officel/80/meeting-room.png", + "volume": "https://img.icons8.com/officel/80/combo-chart.png", "open": "https://img.icons8.com/officel/80/open-sign.png", "plan": "https://img.icons8.com/officel/80/calendar-plus.png", "take": "https://img.icons8.com/officel/80/receipt.png", "call": "https://img.icons8.com/officel/80/calling.png", - "reception": "https://img.icons8.com/officel/80/meeting-room.png", - "volume": "https://img.icons8.com/officel/80/combo-chart.png", "schedule": "https://img.icons8.com/officel/80/List-of-parts.png", "history": "https://img.icons8.com/officel/80/order-history.png" }, @@ -29,6 +29,7 @@ "reception_uid": "服务场所", "reception_name": "服务场所", "volume_uid": "服务计划", + "volume_total": "放号总量", "schedule_status": "订单状态", "begin_time": "开始时间", "end_time": "结束时间", @@ -37,8 +38,7 @@ "call_time": "叫号时间", "expire_time": "过期时间", "finish_time": "完成时间", - "volume_amount": "放号总量", - "amount": "放号总量", + "total": "放号总量", "count": "约号数量" }, "value": { diff --git a/src/yuehaoxitong/portal.shy b/src/yuehaoxitong/portal.shy deleted file mode 100644 index b2cc635..0000000 --- a/src/yuehaoxitong/portal.shy +++ /dev/null @@ -1,24 +0,0 @@ -chapter "约号系统" -field web.code.mysql.client -field web.code.mysql.query args `mysql yuehaoxitong` -field web.code.db.models -order ` -userQueue.go -queue.go -reception.go -volume.go -volume.js -schedule.go -schedule.js -history.go -plan.go -take.go -call.go -open.go - -common.go -portal.go -portal.json -portal.shy -model -` diff --git a/src/yuehaoxitong/reception.go b/src/yuehaoxitong/reception.go index 9c4b239..926ee22 100644 --- a/src/yuehaoxitong/reception.go +++ b/src/yuehaoxitong/reception.go @@ -4,9 +4,9 @@ import "shylinux.com/x/ice" type reception struct { Table - fields string `data:"name,user_uid"` - create string `name:"create reception_name*" role:"leader"` - rename string `name:"rename name*" role:"leader"` + fields string `data:"name,info,user_uid"` + create string `name:"create reception_name* reception_info" role:"leader"` + rename string `name:"rename name* info" role:"leader"` remove string `name:"remove" role:"leader"` } diff --git a/src/yuehaoxitong/schedule.go b/src/yuehaoxitong/schedule.go index 8838676..684bb4a 100644 --- a/src/yuehaoxitong/schedule.go +++ b/src/yuehaoxitong/schedule.go @@ -15,7 +15,7 @@ type Schedule struct { reception reception volume Volume models string `data:"schedule"` - create string `name:"create reception_uid*:select volume_uid*:select" role:"void"` + create string `name:"create reception_uid*:select volume_uid*:select" help:"预约" role:"void"` cancel string `name:"cancel" role:"void"` take string `name:"take" help:"取号" role:"void"` call string `name:"call" help:"叫号" role:"leader,worker"` @@ -26,16 +26,15 @@ type Schedule struct { func (s Schedule) Create(m *ice.Message, arg ...string) { 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)), "本服务已约满") { + if m.Warn(kit.Int(msg.Append(model.COUNT)) >= kit.Int(msg.Append(model.TOTAL)), "本服务此时间段已约满") { return } - s.addCount(m, mdb.COUNT, "1") + s.addCount(m, model.COUNT, "1") s.Insert(m, arg...) }) - s.SendMessage(m, m.Option(model.USER_UID), m.Option(model.USER_UID)) + s.SendMessage(m, "", "") s.sendTemplate(m, "约号成功", m.Result()) s.DashboardUpdate(m) - m.ProcessRefresh() } func (s Schedule) Call(m *ice.Message, arg ...string) { user_uid := m.Option(model.USER_UID) @@ -56,11 +55,12 @@ func (s Schedule) Call(m *ice.Message, arg ...string) { m.ProcessRewrite(model.UID, m.Append(model.UID)) } func (s Schedule) List(m *ice.Message, arg ...string) *ice.Message { - role := UserQueueRole(s.UserPlaceRole(m)) - 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, + s.Key(s, model.RECEPTION_UID), model.VOLUME_UID, 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.RECEPTION_UID), model.VOLUME_UID, s.Key(s, model.CALL_UID), model.USER_UID) - if role == UserQueueCreator || role == UserQueueLeader { + model.SCHEDULE_STATUS, model.CALL_UID, model.USER_UID, + ) + if s.IsLeader(m) { if len(arg) == 1 { s.Select(m, s.Key(s, model.QUEUE_UID), arg[0]) } else if len(arg) == 2 { @@ -76,7 +76,7 @@ func (s Schedule) List(m *ice.Message, arg ...string) *ice.Message { m.PushButton() } }) - } else if role == UserQueueWorker { + } else if s.IsWorker(m) { if len(arg) == 1 { s.Select(m, s.Key(s, model.QUEUE_UID), arg[0], model.CALL_UID, m.Option(model.USER_UID)) } else if len(arg) == 2 { @@ -113,35 +113,33 @@ func (s Schedule) List(m *ice.Message, arg ...string) *ice.Message { } s.SelectJoin(m, s.reception) s.SelectJoinUser(m) - m.Action().Display("") - return m + return m.Action().Display("") } 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, + s.Tables(m, s.volume).FieldsWithCreatedAT(m, s, + s.Key(s, model.RECEPTION_UID), model.VOLUME_UID, 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.RECEPTION_UID), model.VOLUME_UID, s.Key(s, model.CALL_UID), model.USER_UID) + model.SCHEDULE_STATUS, model.CALL_UID, model.USER_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:])...) s.SelectJoin(m, s.reception) s.SelectJoinUser(m) - m.Action().Display("") - return m + return m.Action().Display("") } func (s Schedule) Cancel(m *ice.Message, arg ...string) { - args := m.OptionSimple(model.USER_UID, model.UID) - if m.WarnNotFound(m.Cmdy(s, s.Select, args).Length() == 0) { + if m.WarnNotFound(m.Cmdy(s, s.Select, m.OptionSimple(model.USER_UID, model.UID)).Length() == 0) { return } s.Transaction(m, func() { - s.addCount(m, mdb.COUNT, "-1") + s.addCount(m, model.COUNT, "-1") s.changeStatus(m, SchedulePlan, ScheduleCancel) }) m.ProcessRefresh() } func (s Schedule) Take(m *ice.Message, arg ...string) { - args := m.OptionSimple(model.USER_UID, model.UID) - if m.WarnNotFound(m.Cmdy(s, s.Select, args).Length() == 0) { + if m.WarnNotFound(m.Cmdy(s, s.Select, m.OptionSimple(model.USER_UID, model.UID)).Length() == 0) { return } s.changeStatus(m, SchedulePlan, ScheduleTake) @@ -171,7 +169,7 @@ func (s Schedule) Finish(m *ice.Message, arg ...string) { }) s.Select(m.FieldsSetDetail(), args...) s.sendTemplate(m, "已完成") - Portal{}.DashboardUpdate(m) + s.DashboardUpdate(m) } func init() { ice.TeamCtxCmd(Schedule{}) } @@ -185,8 +183,8 @@ func (s Schedule) changeStatus(m *ice.Message, from, to ScheduleStatus, arg ...s return m } func (s Schedule) sendTemplate(m *ice.Message, title string, arg ...string) *ice.Message { - reception := m.Cmd(s.reception, s.Select, model.UID, m.Option(model.RECEPTION_UID)) - s.Table.SendTemplate(m, "", m.Append(model.USER_UID), kit.JoinWord(title, reception.Append(model.NAME))) + msg := m.Cmd(s.reception, s.Select, model.UID, m.Option(model.RECEPTION_UID)) + s.SendTemplate(m, "", m.Append(model.USER_UID), kit.JoinWord(title, msg.Append(model.NAME)), kit.Simple("", arg)...) return m } diff --git a/src/yuehaoxitong/schedule.js b/src/yuehaoxitong/schedule.js index 9d58cc8..dacae30 100644 --- a/src/yuehaoxitong/schedule.js +++ b/src/yuehaoxitong/schedule.js @@ -11,11 +11,11 @@ Volcanos(chat.ONIMPORT, { } else if (value.take_time) { time = {view: html.STATUS, list: [can.user.trans(can, "take_time:", "取号时间:"), value.take_time]} } else { - var _time = {view: html.STATUS, list: [can.user.trans(can, "finish_time:", "结束时间:"), value.end_time]} + var _time = {view: html.STATUS, list: [can.user.trans(can, "end_time:", "结束时间:"), value.end_time]} } return [ - {view: html.TITLE, list:[value.name||value.user_name, can.onimport.textView(can, value), can.onimport.titleAction(can, value)]}, - {view: html.STATUS, list: [value.uid && value.uid.slice(0, 6), can.onimport.timeView(can, value), value.reception_name]}, + {view: html.TITLE, list:[value.user_name, can.onimport.textView(can, value), can.onimport.titleAction(can, value)]}, + {view: html.STATUS, list: [value.uid.slice(0, 6), can.onimport.timeView(can, value), value.reception_name]}, time, _time, ] }) diff --git a/src/yuehaoxitong/userQueue.go b/src/yuehaoxitong/userQueue.go index a59013e..cd02910 100644 --- a/src/yuehaoxitong/userQueue.go +++ b/src/yuehaoxitong/userQueue.go @@ -12,8 +12,4 @@ func init() { ice.TeamCtxCmd(userQueue{}) } type UserQueueRole = guanlixitong.UserGroupRole -var UserQueueVisitor = guanlixitong.UserGroupVisitor -var UserQueueCreator = guanlixitong.UserGroupCreator -var UserQueueLeader = guanlixitong.UserGroupLeader -var UserQueueWorker = guanlixitong.UserGroupWorker var UserQueueRoleList = guanlixitong.UserGroupRoleList diff --git a/src/yuehaoxitong/volume.go b/src/yuehaoxitong/volume.go index a26a0d5..2585863 100644 --- a/src/yuehaoxitong/volume.go +++ b/src/yuehaoxitong/volume.go @@ -11,33 +11,31 @@ type Volume struct { Table reception reception models string `data:"volume"` - create string `name:"create reception_uid*:select volume_amount*=100 begin_time:select@date end_time:select@date" role:"leader"` + create string `name:"create reception_uid*:select volume_total*=100 begin_time:select@date end_time:select@date" role:"leader"` } func (s Volume) Create(m *ice.Message, arg ...string) { - arg = kit.TransArgKeys(arg, model.VOLUME_AMOUNT, model.AMOUNT) + arg = kit.TransArgKeys(arg, model.VOLUME_TOTAL, model.TOTAL) arg = kit.ArgDef(arg, model.BEGIN_TIME, m.Time(), model.END_TIME, m.Time("24h")) - s.Insert(m, kit.Simple(arg, m.OptionSimple(model.QUEUE_UID))...) - s.RecordEvent(m, "✅ "+m.Trans("create volume", "创建服务计划")+"\n"+s.joinKV(m, model.AMOUNT, model.BEGIN_TIME, model.END_TIME), m.Result()) + s.Insert(m.Options(arg), kit.Simple(arg, m.OptionSimple(model.QUEUE_UID))...) + s.RecordEvent(m, "✅ "+m.Trans("create volume", "创建服务计划")+" "+s.joinKV(m, model.VOLUME_TOTAL, model.BEGIN_TIME, model.END_TIME)) } func (s Volume) List(m *ice.Message, arg ...string) *ice.Message { if len(arg) == 0 { if m.Option(model.RECEPTION_UID) != "" { - s.Fields(m, model.UID, model.BEGIN_TIME, model.END_TIME, model.AMOUNT, model.COUNT) + s.Fields(m, model.UID, model.BEGIN_TIME, model.END_TIME, model.TOTAL, model.COUNT) s.Select(m, m.OptionSimple(model.QUEUE_UID, model.RECEPTION_UID)...) } return m } else if len(arg) == 1 { s.Tables(m, s.reception).FieldsWithCreatedAT(m, s, model.RECEPTION_NAME, model.BEGIN_TIME, model.END_TIME, - model.AMOUNT, model.COUNT, model.EXPIRE, model.FINISH, model.USER_UID, - ).Select(m, s.Key(s, model.QUEUE_UID), arg[0]).Display("") - } else if len(arg) == 2 { - s.FieldsWithCreatedAT(m, Schedule{}, s.AS(model.STATUS, model.SCHEDULE_STATUS), model.USER_UID) - m.Cmdy(Schedule{}, s.Select, "volume_uid = ? and status != ?", arg[1], ScheduleCancel) - kit.If(m.Length() == 0, func() { m.Echo("没有约号") }) + model.TOTAL, model.COUNT, model.EXPIRE, model.FINISH, model.USER_UID, + ) + s.Select(m, s.Key(s, model.QUEUE_UID), arg[0]) + s.SelectJoinUser(m) + m.Display("") } - s.SelectJoinUser(m) return m } diff --git a/src/yuehaoxitong/volume.js b/src/yuehaoxitong/volume.js index c19c269..268e3e7 100644 --- a/src/yuehaoxitong/volume.js +++ b/src/yuehaoxitong/volume.js @@ -2,10 +2,10 @@ Volcanos(chat.ONIMPORT, { _init: function(can, msg) { can.onimport.myView(can, msg, function(value) { return [ {view: html.TITLE, list: [value.reception_name]}, - {view: html.STATUS, list: [can.user.trans(can, "open:", "放号量:"), value.amount, can.user.trans(can, "plan:", "预约量:"), value.count]}, - {view: html.STATUS, list: [can.user.trans(can, "expired:", "过号量:"), value.expire||"0", can.user.trans(can, "finish:", "完成量:"), value.finish||"0"]}, {view: html.STATUS, list: [can.user.trans(can, "begin_time:", "开始时间:"), value.begin_time]}, {view: html.STATUS, list: [can.user.trans(can, "end_time:", "结束时间:"), value.end_time]}, + {view: html.STATUS, list: [can.user.trans(can, "open:", "放号量:"), value.total, can.user.trans(can, "plan:", "预约量:"), value.count]}, + {view: html.STATUS, list: [can.user.trans(can, "expired:", "过号量:"), value.expire||"0", can.user.trans(can, "finish:", "完成量:"), value.finish||"0"]}, ] }) }, }) \ No newline at end of file