mirror of
https://shylinux.com/x/community
synced 2025-04-26 01:54:05 +08:00
add some
This commit is contained in:
parent
787b2e1698
commit
724bdcf8b1
@ -110,10 +110,11 @@ func (s Table) InputsListValue(m *ice.Message, list ice.Any, key string) string
|
|||||||
return ""
|
return ""
|
||||||
}
|
}
|
||||||
func (s Table) ValueModel(m *ice.Message, action ice.Any, arg ...string) *ice.Message {
|
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)
|
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) {
|
func (s Table) ValueCreate(m *ice.Message, arg ...string) {
|
||||||
s.ValueModel(m, s.ValueCreate, arg...)
|
s.ValueModel(m, s.ValueCreate, arg...)
|
||||||
@ -244,6 +245,12 @@ func (s Table) IsLeader(m *ice.Message) bool {
|
|||||||
}
|
}
|
||||||
return false
|
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 {
|
func (s Table) UserPlaceRole(m *ice.Message) int {
|
||||||
return kit.Int(m.Cmdy(s.Prefix(m, Portal{}), s.UserPlaceRole).Option(model.USER_ROLE))
|
return kit.Int(m.Cmdy(s.Prefix(m, Portal{}), s.UserPlaceRole).Option(model.USER_ROLE))
|
||||||
}
|
}
|
||||||
|
@ -226,11 +226,6 @@ func (s Portal) PlaceAuth(m *ice.Message, arg ...string) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (s Portal) ValueCreate(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)))...)
|
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) {
|
func (s Portal) ValueRemove(m *ice.Message, arg ...string) {
|
||||||
|
@ -5,6 +5,7 @@ import "shylinux.com/x/mysql-story/src/db"
|
|||||||
const (
|
const (
|
||||||
UID = "uid"
|
UID = "uid"
|
||||||
NAME = "name"
|
NAME = "name"
|
||||||
|
INFO = "info"
|
||||||
TYPE = "type"
|
TYPE = "type"
|
||||||
TITLE = "title"
|
TITLE = "title"
|
||||||
CONTENT = "content"
|
CONTENT = "content"
|
||||||
@ -14,8 +15,6 @@ const (
|
|||||||
GROUP_NAME = "group_name"
|
GROUP_NAME = "group_name"
|
||||||
GROUP_TYPE = "group_type"
|
GROUP_TYPE = "group_type"
|
||||||
ACTIVITY_UID = "activity_uid"
|
ACTIVITY_UID = "activity_uid"
|
||||||
COMPANY_UID = "company_uid"
|
|
||||||
CITY_UID = "city_uid"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
type UserGroup struct {
|
type UserGroup struct {
|
||||||
|
@ -10,26 +10,18 @@ import (
|
|||||||
|
|
||||||
type call struct {
|
type call struct {
|
||||||
Schedule
|
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) Call(m *ice.Message, arg ...string) { m.Cmdy(s.Schedule, m.ActionKey(), arg) }
|
||||||
func (s call) List(m *ice.Message, arg ...string) {
|
func (s call) List(m *ice.Message, arg ...string) {
|
||||||
role := UserQueueRole(kit.Int(m.Option(model.USER_ROLE)))
|
|
||||||
if len(arg) == 1 {
|
if len(arg) == 1 {
|
||||||
if role != UserQueueVisitor {
|
s.SelectByStatus(m.Options(mdb.ORDER, model.TAKE_TIME), arg[0], kit.Format(ScheduleTake))
|
||||||
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) })
|
||||||
kit.If(m.Length() == 0, func() { m.Echo(m.Trans("wait take", "等待取号")) }, func() { m.Action(s.Call) })
|
|
||||||
}
|
|
||||||
} else if len(arg) == 2 {
|
} else if len(arg) == 2 {
|
||||||
s.Schedule.List(m, arg[0], arg[1])
|
s.Schedule.List(m, arg[0], arg[1]).Action(s.Call)
|
||||||
if role != UserQueueVisitor {
|
|
||||||
m.Action(s.Call)
|
|
||||||
}
|
|
||||||
} else if len(arg) == 3 {
|
} else if len(arg) == 3 {
|
||||||
if role != UserQueueVisitor {
|
s.Select(m, model.QUEUE_UID, arg[0], model.RECEPTION_UID, arg[2], model.STATUS, kit.Format(ScheduleTake)).Action(s.Call)
|
||||||
s.Schedule.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) }
|
func (s call) Expire(m *ice.Message, arg ...string) { m.Cmdy(s.Schedule, m.ActionKey(), arg) }
|
||||||
|
@ -5,32 +5,30 @@ import "shylinux.com/x/mysql-story/src/db"
|
|||||||
const (
|
const (
|
||||||
UID = "uid"
|
UID = "uid"
|
||||||
NAME = "name"
|
NAME = "name"
|
||||||
|
INFO = "info"
|
||||||
TYPE = "type"
|
TYPE = "type"
|
||||||
STATUS = "status"
|
STATUS = "status"
|
||||||
TITLE = "title"
|
TITLE = "title"
|
||||||
CONTENT = "content"
|
CONTENT = "content"
|
||||||
USER_UID = "user_uid"
|
USER_UID = "user_uid"
|
||||||
USER_ROLE = "user_role"
|
|
||||||
USER_QUEUE_ROLE = "user_queue_role"
|
USER_QUEUE_ROLE = "user_queue_role"
|
||||||
QUEUE_UID = "queue_uid"
|
QUEUE_UID = "queue_uid"
|
||||||
QUEUE_NAME = "queue_name"
|
|
||||||
QUEUE_TYPE = "queue_type"
|
QUEUE_TYPE = "queue_type"
|
||||||
RECEPTION_UID = "reception_uid"
|
RECEPTION_UID = "reception_uid"
|
||||||
RECEPTION_NAME = "reception_name"
|
RECEPTION_NAME = "reception_name"
|
||||||
VOLUME_UID = "volume_uid"
|
VOLUME_UID = "volume_uid"
|
||||||
VOLUME_AMOUNT = "volume_amount"
|
VOLUME_TOTAL = "volume_total"
|
||||||
SCHEDULE_UID = "schedule_uid"
|
SCHEDULE_UID = "schedule_uid"
|
||||||
SCHEDULE_STATUS = "schedule_status"
|
SCHEDULE_STATUS = "schedule_status"
|
||||||
COMPANY_UID = "company_uid"
|
|
||||||
CALL_UID = "call_uid"
|
CALL_UID = "call_uid"
|
||||||
BEGIN_TIME = "begin_time"
|
BEGIN_TIME = "begin_time"
|
||||||
END_TIME = "end_time"
|
END_TIME = "end_time"
|
||||||
CANCEL_TIME = "cancel_time"
|
CANCEL_TIME = "cancel_time"
|
||||||
TAKE_TIME = "take_time"
|
TAKE_TIME = "take_time"
|
||||||
CALL_TIME = "call_time"
|
CALL_TIME = "call_time"
|
||||||
FINISH_TIME = "finish_time"
|
|
||||||
EXPIRE_TIME = "expire_time"
|
EXPIRE_TIME = "expire_time"
|
||||||
AMOUNT = "amount"
|
FINISH_TIME = "finish_time"
|
||||||
|
TOTAL = "total"
|
||||||
COUNT = "count"
|
COUNT = "count"
|
||||||
EXPIRE = "expire"
|
EXPIRE = "expire"
|
||||||
FINISH = "finish"
|
FINISH = "finish"
|
||||||
@ -47,33 +45,34 @@ type Queue struct {
|
|||||||
type Reception struct {
|
type Reception struct {
|
||||||
db.ModelWithUID
|
db.ModelWithUID
|
||||||
QueueUID string `gorm:"type:char(32);index"`
|
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)"`
|
Name string `gorm:"type:varchar(64)"`
|
||||||
|
Info string `gorm:"type:varchar(255)"`
|
||||||
}
|
}
|
||||||
type Volume struct {
|
type Volume struct {
|
||||||
db.ModelWithUID
|
db.ModelWithUID
|
||||||
QueueUID string `gorm:"type:char(32);index:idx_queue"`
|
QueueUID string `gorm:"type:char(32);index:idx_queue"`
|
||||||
ReceptionUID 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
|
BeginTime db.Time
|
||||||
EndTime 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 {
|
type Schedule struct {
|
||||||
db.ModelWithUID
|
db.ModelWithUID
|
||||||
QueueUID string `gorm:"type:char(32);index:idx_queue"`
|
QueueUID string `gorm:"type:char(32);index"`
|
||||||
ReceptionUID string `gorm:"type:char(32);index:idx_queue"`
|
ReceptionUID string `gorm:"type:char(32)"`
|
||||||
VolumeUID string `gorm:"type:char(32);index:idx_queue"`
|
VolumeUID string `gorm:"type:char(32)"`
|
||||||
UserUID string `gorm:"type:char(32);index"`
|
UserUID string `gorm:"type:char(32);index"`
|
||||||
CallUID string `gorm:"type:char(32);index"`
|
CallUID string `gorm:"type:char(32);index"`
|
||||||
|
Status uint8 `gorm:"default:0"`
|
||||||
CancelTime db.Time
|
CancelTime db.Time
|
||||||
TakeTime db.Time
|
TakeTime db.Time
|
||||||
CallTime db.Time
|
CallTime db.Time
|
||||||
ExpireTime db.Time
|
ExpireTime db.Time
|
||||||
FinishTime db.Time
|
FinishTime db.Time
|
||||||
Status uint8 `gorm:"default:0"`
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func init() { db.CmdModels("", &UserQueue{}, &Queue{}, &Reception{}, Volume{}, &Schedule{}) }
|
func init() { db.CmdModels("", &UserQueue{}, &Queue{}, &Reception{}, Volume{}, &Schedule{}) }
|
||||||
|
@ -1,15 +1,12 @@
|
|||||||
package yuehaoxitong
|
package yuehaoxitong
|
||||||
|
|
||||||
import (
|
import "shylinux.com/x/ice"
|
||||||
"shylinux.com/x/ice"
|
|
||||||
kit "shylinux.com/x/toolkits"
|
|
||||||
)
|
|
||||||
|
|
||||||
type open struct{ Volume }
|
type open struct{ Volume }
|
||||||
|
|
||||||
func (s open) List(m *ice.Message, arg ...string) {
|
func (s open) List(m *ice.Message, arg ...string) {
|
||||||
s.Volume.List(m, arg...).PushAction(s.MarketInsert)
|
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{}) }
|
func init() { ice.TeamCtxCmd(open{}) }
|
||||||
|
8
src/yuehaoxitong/plan.css
Normal file
8
src/yuehaoxitong/plan.css
Normal file
@ -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; }
|
@ -2,23 +2,38 @@ package yuehaoxitong
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"shylinux.com/x/ice"
|
"shylinux.com/x/ice"
|
||||||
kit "shylinux.com/x/toolkits"
|
|
||||||
|
|
||||||
"shylinux.com/x/community/src/yuehaoxitong/model"
|
"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) {
|
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) {
|
func (s plan) List(m *ice.Message, arg ...string) {
|
||||||
if len(arg) == 1 {
|
m.Cmdy(s.reception, arg).Action().Display("").DisplayCSS("")
|
||||||
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...)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func init() { ice.TeamCtxCmd(plan{}) }
|
func init() { ice.TeamCtxCmd(plan{}) }
|
||||||
|
23
src/yuehaoxitong/plan.js
Normal file
23
src/yuehaoxitong/plan.js
Normal file
@ -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) },
|
||||||
|
})
|
@ -2,6 +2,7 @@ package yuehaoxitong
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"shylinux.com/x/ice"
|
"shylinux.com/x/ice"
|
||||||
|
kit "shylinux.com/x/toolkits"
|
||||||
|
|
||||||
"shylinux.com/x/community/src/gonganxitong"
|
"shylinux.com/x/community/src/gonganxitong"
|
||||||
"shylinux.com/x/community/src/yuehaoxitong/model"
|
"shylinux.com/x/community/src/yuehaoxitong/model"
|
||||||
@ -15,9 +16,12 @@ type Portal struct {
|
|||||||
|
|
||||||
func (s Portal) AfterPlaceAuth(m *ice.Message, arg ...string) {
|
func (s Portal) AfterPlaceAuth(m *ice.Message, arg ...string) {
|
||||||
defer s.DashboardCreate(m, "")()
|
defer s.DashboardCreate(m, "")()
|
||||||
s.DashboardInsert(m, "1", "订单总量", "order", Schedule{}, "", model.QUEUE_UID, m.Option(model.QUEUE_UID))
|
s.DashboardInsertOrder(m, "1", "订单总量")
|
||||||
s.DashboardInsert(m, "2", "订单已预约", "order", Schedule{}, "", model.QUEUE_UID, m.Option(model.QUEUE_UID), model.STATUS, SchedulePlan)
|
s.DashboardInsertOrder(m, "2", "订单已预约", model.STATUS, SchedulePlan)
|
||||||
s.DashboardInsert(m, "3", "订单已取号", "order", Schedule{}, "", model.QUEUE_UID, m.Option(model.QUEUE_UID), model.STATUS, ScheduleTake)
|
s.DashboardInsertOrder(m, "3", "订单已取号", model.STATUS, ScheduleTake)
|
||||||
s.DashboardInsert(m, "4", "订单已完成", "order", Schedule{}, "", model.QUEUE_UID, m.Option(model.QUEUE_UID), model.STATUS, ScheduleFinish)
|
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{})}) }
|
func init() { gonganxitong.PortalCmd(Portal{Portal: guanlixitong.NewPortal(userQueue{}, queue{})}) }
|
||||||
|
@ -1,15 +1,15 @@
|
|||||||
{
|
{
|
||||||
"portal": "约号系统",
|
"portal": "约号系统",
|
||||||
"open": "放号", "plan": "约号", "take": "取号", "call": "叫号",
|
"reception": "服务场所", "volume": "服务计划", "open": "放号", "plan": "约号", "take": "取号", "call": "叫号",
|
||||||
"reception": "服务场所", "volume": "服务计划", "schedule": "订单数据", "history": "我的订单",
|
"schedule": "订单数据", "history": "我的订单",
|
||||||
"expire": "过号", "finish": "完成",
|
"expire": "过号", "finish": "完成",
|
||||||
"icons": {
|
"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",
|
"open": "https://img.icons8.com/officel/80/open-sign.png",
|
||||||
"plan": "https://img.icons8.com/officel/80/calendar-plus.png",
|
"plan": "https://img.icons8.com/officel/80/calendar-plus.png",
|
||||||
"take": "https://img.icons8.com/officel/80/receipt.png",
|
"take": "https://img.icons8.com/officel/80/receipt.png",
|
||||||
"call": "https://img.icons8.com/officel/80/calling.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",
|
"schedule": "https://img.icons8.com/officel/80/List-of-parts.png",
|
||||||
"history": "https://img.icons8.com/officel/80/order-history.png"
|
"history": "https://img.icons8.com/officel/80/order-history.png"
|
||||||
},
|
},
|
||||||
@ -29,6 +29,7 @@
|
|||||||
"reception_uid": "服务场所",
|
"reception_uid": "服务场所",
|
||||||
"reception_name": "服务场所",
|
"reception_name": "服务场所",
|
||||||
"volume_uid": "服务计划",
|
"volume_uid": "服务计划",
|
||||||
|
"volume_total": "放号总量",
|
||||||
"schedule_status": "订单状态",
|
"schedule_status": "订单状态",
|
||||||
"begin_time": "开始时间",
|
"begin_time": "开始时间",
|
||||||
"end_time": "结束时间",
|
"end_time": "结束时间",
|
||||||
@ -37,8 +38,7 @@
|
|||||||
"call_time": "叫号时间",
|
"call_time": "叫号时间",
|
||||||
"expire_time": "过期时间",
|
"expire_time": "过期时间",
|
||||||
"finish_time": "完成时间",
|
"finish_time": "完成时间",
|
||||||
"volume_amount": "放号总量",
|
"total": "放号总量",
|
||||||
"amount": "放号总量",
|
|
||||||
"count": "约号数量"
|
"count": "约号数量"
|
||||||
},
|
},
|
||||||
"value": {
|
"value": {
|
||||||
|
@ -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
|
|
||||||
`
|
|
@ -4,9 +4,9 @@ import "shylinux.com/x/ice"
|
|||||||
|
|
||||||
type reception struct {
|
type reception struct {
|
||||||
Table
|
Table
|
||||||
fields string `data:"name,user_uid"`
|
fields string `data:"name,info,user_uid"`
|
||||||
create string `name:"create reception_name*" role:"leader"`
|
create string `name:"create reception_name* reception_info" role:"leader"`
|
||||||
rename string `name:"rename name*" role:"leader"`
|
rename string `name:"rename name* info" role:"leader"`
|
||||||
remove string `name:"remove" role:"leader"`
|
remove string `name:"remove" role:"leader"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -15,7 +15,7 @@ type Schedule struct {
|
|||||||
reception reception
|
reception reception
|
||||||
volume Volume
|
volume Volume
|
||||||
models string `data:"schedule"`
|
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"`
|
cancel string `name:"cancel" role:"void"`
|
||||||
take string `name:"take" help:"取号" role:"void"`
|
take string `name:"take" help:"取号" role:"void"`
|
||||||
call string `name:"call" help:"叫号" role:"leader,worker"`
|
call string `name:"call" help:"叫号" role:"leader,worker"`
|
||||||
@ -26,16 +26,15 @@ type Schedule struct {
|
|||||||
func (s Schedule) Create(m *ice.Message, arg ...string) {
|
func (s Schedule) Create(m *ice.Message, arg ...string) {
|
||||||
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))
|
||||||
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
|
return
|
||||||
}
|
}
|
||||||
s.addCount(m, mdb.COUNT, "1")
|
s.addCount(m, model.COUNT, "1")
|
||||||
s.Insert(m, arg...)
|
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.sendTemplate(m, "约号成功", m.Result())
|
||||||
s.DashboardUpdate(m)
|
s.DashboardUpdate(m)
|
||||||
m.ProcessRefresh()
|
|
||||||
}
|
}
|
||||||
func (s Schedule) Call(m *ice.Message, arg ...string) {
|
func (s Schedule) Call(m *ice.Message, arg ...string) {
|
||||||
user_uid := m.Option(model.USER_UID)
|
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))
|
m.ProcessRewrite(model.UID, m.Append(model.UID))
|
||||||
}
|
}
|
||||||
func (s Schedule) List(m *ice.Message, arg ...string) *ice.Message {
|
func (s Schedule) List(m *ice.Message, arg ...string) *ice.Message {
|
||||||
role := UserQueueRole(s.UserPlaceRole(m))
|
s.Tables(m, s.volume).FieldsWithCreatedAT(m, s,
|
||||||
s.Tables(m, s.volume).FieldsWithCreatedAT(m, s, model.SCHEDULE_STATUS, model.BEGIN_TIME, model.END_TIME,
|
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,
|
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,
|
||||||
if role == UserQueueCreator || role == UserQueueLeader {
|
)
|
||||||
|
if s.IsLeader(m) {
|
||||||
if len(arg) == 1 {
|
if len(arg) == 1 {
|
||||||
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 {
|
||||||
@ -76,7 +76,7 @@ func (s Schedule) List(m *ice.Message, arg ...string) *ice.Message {
|
|||||||
m.PushButton()
|
m.PushButton()
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
} else if role == UserQueueWorker {
|
} else if s.IsWorker(m) {
|
||||||
if len(arg) == 1 {
|
if len(arg) == 1 {
|
||||||
s.Select(m, s.Key(s, model.QUEUE_UID), arg[0], model.CALL_UID, m.Option(model.USER_UID))
|
s.Select(m, s.Key(s, model.QUEUE_UID), arg[0], model.CALL_UID, m.Option(model.USER_UID))
|
||||||
} else if len(arg) == 2 {
|
} 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.SelectJoin(m, s.reception)
|
||||||
s.SelectJoinUser(m)
|
s.SelectJoinUser(m)
|
||||||
m.Action().Display("")
|
return m.Action().Display("")
|
||||||
return m
|
|
||||||
}
|
}
|
||||||
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,
|
||||||
|
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,
|
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) })
|
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.Select(m, kit.Simple(s.Key(s, model.QUEUE_UID), arg[0], model.STATUS, arg[1], arg[2:])...)
|
||||||
s.SelectJoin(m, s.reception)
|
s.SelectJoin(m, s.reception)
|
||||||
s.SelectJoinUser(m)
|
s.SelectJoinUser(m)
|
||||||
m.Action().Display("")
|
return m.Action().Display("")
|
||||||
return m
|
|
||||||
}
|
}
|
||||||
func (s Schedule) Cancel(m *ice.Message, arg ...string) {
|
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, m.OptionSimple(model.USER_UID, model.UID)).Length() == 0) {
|
||||||
if m.WarnNotFound(m.Cmdy(s, s.Select, args).Length() == 0) {
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
s.Transaction(m, func() {
|
s.Transaction(m, func() {
|
||||||
s.addCount(m, mdb.COUNT, "-1")
|
s.addCount(m, model.COUNT, "-1")
|
||||||
s.changeStatus(m, SchedulePlan, ScheduleCancel)
|
s.changeStatus(m, SchedulePlan, ScheduleCancel)
|
||||||
})
|
})
|
||||||
m.ProcessRefresh()
|
m.ProcessRefresh()
|
||||||
}
|
}
|
||||||
func (s Schedule) Take(m *ice.Message, arg ...string) {
|
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, m.OptionSimple(model.USER_UID, model.UID)).Length() == 0) {
|
||||||
if m.WarnNotFound(m.Cmdy(s, s.Select, args).Length() == 0) {
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
s.changeStatus(m, SchedulePlan, ScheduleTake)
|
s.changeStatus(m, SchedulePlan, ScheduleTake)
|
||||||
@ -171,7 +169,7 @@ func (s Schedule) Finish(m *ice.Message, arg ...string) {
|
|||||||
})
|
})
|
||||||
s.Select(m.FieldsSetDetail(), args...)
|
s.Select(m.FieldsSetDetail(), args...)
|
||||||
s.sendTemplate(m, "已完成")
|
s.sendTemplate(m, "已完成")
|
||||||
Portal{}.DashboardUpdate(m)
|
s.DashboardUpdate(m)
|
||||||
}
|
}
|
||||||
|
|
||||||
func init() { ice.TeamCtxCmd(Schedule{}) }
|
func init() { ice.TeamCtxCmd(Schedule{}) }
|
||||||
@ -185,8 +183,8 @@ func (s Schedule) changeStatus(m *ice.Message, from, to ScheduleStatus, arg ...s
|
|||||||
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 {
|
||||||
reception := m.Cmd(s.reception, s.Select, model.UID, m.Option(model.RECEPTION_UID))
|
msg := 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)))
|
s.SendTemplate(m, "", m.Append(model.USER_UID), kit.JoinWord(title, msg.Append(model.NAME)), kit.Simple("", arg)...)
|
||||||
return m
|
return m
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -11,11 +11,11 @@ Volcanos(chat.ONIMPORT, {
|
|||||||
} else if (value.take_time) {
|
} else if (value.take_time) {
|
||||||
time = {view: html.STATUS, list: [can.user.trans(can, "take_time:", "取号时间:"), value.take_time]}
|
time = {view: html.STATUS, list: [can.user.trans(can, "take_time:", "取号时间:"), value.take_time]}
|
||||||
} else {
|
} 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 [
|
return [
|
||||||
{view: html.TITLE, list:[value.name||value.user_name, can.onimport.textView(can, value), can.onimport.titleAction(can, value)]},
|
{view: html.TITLE, list:[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.STATUS, list: [value.uid.slice(0, 6), can.onimport.timeView(can, value), value.reception_name]},
|
||||||
time, _time,
|
time, _time,
|
||||||
]
|
]
|
||||||
})
|
})
|
||||||
|
@ -12,8 +12,4 @@ func init() { ice.TeamCtxCmd(userQueue{}) }
|
|||||||
|
|
||||||
type UserQueueRole = guanlixitong.UserGroupRole
|
type UserQueueRole = guanlixitong.UserGroupRole
|
||||||
|
|
||||||
var UserQueueVisitor = guanlixitong.UserGroupVisitor
|
|
||||||
var UserQueueCreator = guanlixitong.UserGroupCreator
|
|
||||||
var UserQueueLeader = guanlixitong.UserGroupLeader
|
|
||||||
var UserQueueWorker = guanlixitong.UserGroupWorker
|
|
||||||
var UserQueueRoleList = guanlixitong.UserGroupRoleList
|
var UserQueueRoleList = guanlixitong.UserGroupRoleList
|
||||||
|
@ -11,33 +11,31 @@ type Volume struct {
|
|||||||
Table
|
Table
|
||||||
reception reception
|
reception reception
|
||||||
models string `data:"volume"`
|
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) {
|
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"))
|
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.Insert(m.Options(arg), 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.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 {
|
func (s Volume) List(m *ice.Message, arg ...string) *ice.Message {
|
||||||
if len(arg) == 0 {
|
if len(arg) == 0 {
|
||||||
if m.Option(model.RECEPTION_UID) != "" {
|
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)...)
|
s.Select(m, m.OptionSimple(model.QUEUE_UID, model.RECEPTION_UID)...)
|
||||||
}
|
}
|
||||||
return m
|
return m
|
||||||
} else if len(arg) == 1 {
|
} else if len(arg) == 1 {
|
||||||
s.Tables(m, s.reception).FieldsWithCreatedAT(m, s,
|
s.Tables(m, s.reception).FieldsWithCreatedAT(m, s,
|
||||||
model.RECEPTION_NAME, model.BEGIN_TIME, model.END_TIME,
|
model.RECEPTION_NAME, model.BEGIN_TIME, model.END_TIME,
|
||||||
model.AMOUNT, model.COUNT, model.EXPIRE, model.FINISH, model.USER_UID,
|
model.TOTAL, 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.Select(m, s.Key(s, model.QUEUE_UID), arg[0])
|
||||||
s.FieldsWithCreatedAT(m, Schedule{}, s.AS(model.STATUS, model.SCHEDULE_STATUS), model.USER_UID)
|
s.SelectJoinUser(m)
|
||||||
m.Cmdy(Schedule{}, s.Select, "volume_uid = ? and status != ?", arg[1], ScheduleCancel)
|
m.Display("")
|
||||||
kit.If(m.Length() == 0, func() { m.Echo("没有约号") })
|
|
||||||
}
|
}
|
||||||
s.SelectJoinUser(m)
|
|
||||||
return m
|
return m
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2,10 +2,10 @@ Volcanos(chat.ONIMPORT, {
|
|||||||
_init: function(can, msg) {
|
_init: function(can, msg) {
|
||||||
can.onimport.myView(can, msg, function(value) { return [
|
can.onimport.myView(can, msg, function(value) { return [
|
||||||
{view: html.TITLE, list: [value.reception_name]},
|
{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, "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, "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"]},
|
||||||
] })
|
] })
|
||||||
},
|
},
|
||||||
})
|
})
|
Loading…
x
Reference in New Issue
Block a user