This commit is contained in:
IT 老营长 @云轩领航-创始人 2024-09-26 13:00:33 +08:00
parent 724bdcf8b1
commit 95b29e3ec4
24 changed files with 135 additions and 163 deletions

View File

@ -11,6 +11,7 @@ import (
"shylinux.com/x/icebergs/base/aaa" "shylinux.com/x/icebergs/base/aaa"
"shylinux.com/x/icebergs/base/ctx" "shylinux.com/x/icebergs/base/ctx"
"shylinux.com/x/icebergs/base/mdb" "shylinux.com/x/icebergs/base/mdb"
"shylinux.com/x/icebergs/base/nfs"
"shylinux.com/x/icebergs/base/web" "shylinux.com/x/icebergs/base/web"
"shylinux.com/x/icebergs/base/web/html" "shylinux.com/x/icebergs/base/web/html"
kit "shylinux.com/x/toolkits" kit "shylinux.com/x/toolkits"
@ -188,6 +189,9 @@ func (s Table) RenameAppend(m *ice.Message, arg ...string) Table {
} }
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 {
if value != "" && kit.IsIn(key, model.BACKGROUND, model.AVATAR) {
value = m.Resource(value)
}
if _, e := strconv.ParseInt(value, 10, 64); e != nil { if _, e := strconv.ParseInt(value, 10, 64); e != nil {
return value return value
} }
@ -211,6 +215,20 @@ func (s Table) RewriteAppend(m *ice.Message, arg ...string) *ice.Message {
}) })
return m return m
} }
func (s Table) UploadUpdate(m *ice.Message, field, uid string, arg ...string) {
if m.IsErr() {
return
}
p := m.UploadSave(path.Join(nfs.USR, kit.Select(field, m.Option("field")), uid) + nfs.PS)
s.Update(m, kit.Dict(kit.Select(m.Option("field"), field), p), model.UID, uid)
}
func (s Table) UploadCreate(m *ice.Message, field, uid string, arg ...string) {
if m.IsErr() {
return
}
p := m.UploadSave(path.Join(nfs.USR, kit.Select(field, m.Option("field")), uid) + nfs.PS)
s.Create(m, kit.Select(m.Option("field"), field), p, model.UID, uid)
}
func (s Table) Update(m *ice.Message, data ice.Map, arg ...string) { func (s Table) Update(m *ice.Message, data ice.Map, arg ...string) {
data[model.OPERATOR] = m.Option(model.USER_UID) data[model.OPERATOR] = m.Option(model.USER_UID)
s.Table.Update(m, data, arg...) s.Table.Update(m, data, arg...)

View File

@ -19,7 +19,7 @@ $output>div.header { border-radius:100px; background-color:var(--notice-bg-color
$output>div.footer { border-radius:100px; background-color:var(--notice-bg-color); height:300px; width:100%; position:absolute; bottom:-100px; left:0; } $output>div.footer { border-radius:100px; background-color:var(--notice-bg-color); height:300px; width:100%; position:absolute; bottom:-100px; left:0; }
$output>div>div.list { box-shadow:var(--box-shadow); border-radius:10px; background-color:var(--output-bg-color); padding:10px; margin:10px; } $output>div>div.list { box-shadow:var(--box-shadow); border-radius:10px; background-color:var(--output-bg-color); padding:10px; margin:10px; }
$output>div>div.list.mycount { min-height:105px; } $output>div>div.list.mycount { min-height:105px; }
$output>div>div.list.myplace>div.output { max-height:420px; } $output>div>div.list.myplace>div.output { padding:0 10px; max-height:420px; }
$output>div>div.list>div.title { font-weight:bold; display:flex; align-items:center; } $output>div>div.list>div.title { font-weight:bold; display:flex; align-items:center; }
$output>div>div.list>div.title span:first-child { flex-grow:1; } $output>div>div.list>div.title span:first-child { flex-grow:1; }
$output>div>div.list>div.title div.action { overflow:hidden; } $output>div>div.list>div.title div.action { overflow:hidden; }

View File

@ -279,12 +279,13 @@ func (s Portal) MarketInsert(m *ice.Message, arg ...string) {
m.Cmdy(s.Prefix(m, market{}), s.Create, arg) m.Cmdy(s.Prefix(m, market{}), s.Create, arg)
} }
func (s Portal) DashboardCreate(m *ice.Message, name string, arg ...string) func() { func (s Portal) DashboardCreate(m *ice.Message, name string, arg ...string) func() {
defer s.SaveBack(m, ice.MSG_USERPOD)()
kit.If(name == "", func() { name = m.Option(s.Keys(s.Place, model.NAME)) }) kit.If(name == "", func() { name = m.Option(s.Keys(s.Place, model.NAME)) })
s.AutoCmdy(m, api.DASHBOARD_PORTAL, s.PlaceCreate, m.OptionSimple(model.CITY_NAME, model.COMPANY_NAME), model.DASHBOARD_NAME, name, model.DASHBOARD_TYPE, "0") s.AutoCmdy(m, api.DASHBOARD_PORTAL, s.PlaceCreate, m.OptionSimple(model.CITY_NAME, model.COMPANY_NAME), model.DASHBOARD_NAME, name, model.DASHBOARD_TYPE, "0")
s.AutoCmd(m, api.RENZHENGSHOUQUAN_AUTH, s.UpdateField, m.OptionSimple(model.DASHBOARD_UID), model.UID, m.Option(model.AUTH_UID)) s.AutoCmd(m, api.RENZHENGSHOUQUAN_AUTH, s.UpdateField, m.OptionSimple(model.DASHBOARD_UID), model.UID, m.Option(model.AUTH_UID))
return func() { s.DashboardUpdate(m) } return func() { s.DashboardUpdate(m) }
} }
func (s Portal) DashboardInsert(m *ice.Message, score, title, unit string, index ice.Any, field string, arg ...ice.Any) { func (s Portal) DashboardInsert(m *ice.Message, score int, title, unit string, index ice.Any, field string, arg ...ice.Any) {
kit.If(len(arg) == 0, func() { arg = append(arg, s.Keys(s.Place, model.UID), m.Option(s.Keys(s.Place, model.UID))) }) kit.If(len(arg) == 0, func() { arg = append(arg, s.Keys(s.Place, model.UID), m.Option(s.Keys(s.Place, model.UID))) })
s.AutoCmd(m, api.DASHBOARD_SUMMARY, s.Insert, model.SPACE, m.Option(ice.MSG_USERPOD), model.INDEX, s.Prefix(m, index), s.AutoCmd(m, api.DASHBOARD_SUMMARY, s.Insert, model.SPACE, m.Option(ice.MSG_USERPOD), model.INDEX, s.Prefix(m, index),
model.QUERY, kit.Format(arg), mdb.FIELD, field, model.TITLE, title, model.SCORE, score, model.UNIT, unit, m.OptionSimple(model.DASHBOARD_UID)) model.QUERY, kit.Format(arg), mdb.FIELD, field, model.TITLE, title, model.SCORE, score, model.UNIT, unit, m.OptionSimple(model.DASHBOARD_UID))

View File

@ -1,4 +1,5 @@
var UID = "uid", PLACE_UID = "place_uid", PLACE_NAME = "place_name", PLACE_TYPE = "place_type", STREET_NAME = "street_name", CITY_NAME = "city_name" var UID = "uid", PLACE_UID = "place_uid", PLACE_NAME = "place_name", PLACE_TYPE = "place_type", STREET_NAME = "street_name", CITY_NAME = "city_name"
var USER_UID = "user_uid", USER_ROLE = "user_role", AUTH_UID = "auth_uid", AUTH_TYPE = "auth_type"
Volcanos(chat.ONIMPORT, { Volcanos(chat.ONIMPORT, {
_init: function(can, msg) { _init: function(can, msg) {
can.onappend.style(can, html.OUTPUT), can.onimport.myPortal(can, msg) can.onappend.style(can, html.OUTPUT), can.onimport.myPortal(can, msg)

View File

@ -12,6 +12,7 @@ type setting struct {
service service service service
recent recent recent recent
order string `data:"102"` order string `data:"102"`
role string `data:"leader,worker,server"`
short string `data:"name"` short string `data:"name"`
field string `data:"name,type,help"` field string `data:"name,type,help"`
fields string `data:"name,value"` fields string `data:"name,value"`
@ -36,14 +37,7 @@ func (s setting) Update(m *ice.Message, arg ...string) {
} }
func (s setting) Profile(m *ice.Message, arg ...string) { func (s setting) Profile(m *ice.Message, arg ...string) {
s.Fields(m, s.Key(s, model.PLACE_UID)) s.Fields(m, s.Key(s, model.PLACE_UID))
s.Select(m, s.Key(s, model.USER_UID), arg[0], s.Key(s, model.NAME), "profile", s.Key(s, model.VALUE), "on") s.Select(m, s.Key(s, model.USER_UID), arg[0], s.Key(s, model.NAME), m.ActionKey(), s.Key(s, model.VALUE), "on")
return
s.Tables(m, "LEFT JOIN recents ON args = settings.place_uid AND recents.user_uid = settings.user_uid AND recents.deleted_at IS NULL", s.service).Fields(m,
model.SERVICE_ICON, model.SERVICE_NAME,
s.Key(s.recent, model.CITY_NAME), s.Key(s.recent, model.STREET_NAME), s.Key(s.recent, model.PLACE_NAME),
s.AS(model.NODENAME, model.SPACE), model.INDEX, s.Key(s, model.PLACE_UID),
)
s.Select(m, s.Key(s, model.USER_UID), arg[0], s.Key(s, model.NAME), "profile", s.Key(s, model.VALUE), "on")
} }
func (s Table) SettingProfile(m *ice.Message, arg ...string) *ice.Message { func (s Table) SettingProfile(m *ice.Message, arg ...string) *ice.Message {
return m.Cmdy(s.Prefix(m, setting{}), setting{}.Profile, arg) return m.Cmdy(s.Prefix(m, setting{}), setting{}.Profile, arg)

View File

@ -6,6 +6,7 @@ type activity struct {
Table Table
fields string `data:"title,content,user_uid"` fields string `data:"title,content,user_uid"`
create string `name:"create title* content*" role:"leader"` create string `name:"create title* content*" role:"leader"`
modify string `name:"modify title content" role:"leader"`
remove string `name:"remove" role:"leader"` remove string `name:"remove" role:"leader"`
} }

View File

@ -12,7 +12,7 @@ type Auth struct {
cert cert cert cert
order string `data:"2"` order string `data:"2"`
models string `data:"auth"` models string `data:"auth"`
fields string `data:"creator,name,info,auth_type,auth_status,avatar,background,service_uid,place_uid"` fields string `data:"name,info,auth_type,auth_status,avatar,background,service_uid,place_uid,user_uid"`
memberList string `name:"memberList" role:"leader,worker"` memberList string `name:"memberList" role:"leader,worker"`
certList string `name:"certList" role:"leader,worker"` certList string `name:"certList" role:"leader,worker"`
issue string `name:"issue" role:"leader,worker"` issue string `name:"issue" role:"leader,worker"`
@ -51,18 +51,18 @@ func (s Auth) CertList(m *ice.Message, arg ...string) {
kit.If(m.Length() == 0, func() { m.Echo("没有上传证件") }) kit.If(m.Length() == 0, func() { m.Echo("没有上传证件") })
} }
func (s Auth) Issue(m *ice.Message, arg ...string) { func (s Auth) Issue(m *ice.Message, arg ...string) {
msg := m.Cmd(userAuth{}, m.Option(model.USER_UID), m.Option(model.AUTH_UID)) msg := m.Cmd(userAuth{}, s.Select, m.OptionSimple(model.USER_UID), model.UID, m.Option(model.AUTH_UID))
if !m.IsTech() || AuthType(kit.Int(msg.Append(model.AUTH_TYPE))) != AuthRoot { if !m.IsTech() || AuthType(kit.Int(msg.Append(model.AUTH_TYPE))) != AuthRoot {
if m.WarnNotValid(AuthStatus(kit.Int(msg.Append(model.AUTH_STATUS))) != AuthIssued) { if m.WarnNotValid(AuthStatus(kit.Int(msg.Append(model.AUTH_STATUS))) != AuthIssued) {
return return
} }
} }
s.Update(m, kit.Dict(model.STATUS, AuthIssued), model.FROM_UID, m.Option(model.AUTH_UID), model.UID, m.Option(model.UID)) s.Update(m, kit.Dict(model.STATUS, AuthIssued), model.FROM_UID, m.Option(model.AUTH_UID), model.UID, m.Option(model.UID))
switch s.Select(m, model.UID, m.Option(model.UID)); AuthType(kit.Int(m.Append(model.AUTH_TYPE))) { switch s.Select(m, m.OptionSimple(model.UID)...); AuthType(kit.Int(m.Append(model.AUTH_TYPE))) {
case AuthCity: case AuthCity:
m.Cmd("web.team.gonganxitong.city", s.UpdateAuth, m.Option(model.UID), model.NAME, m.Append(model.NAME)) m.Cmd("web.team.gonganxitong.city", s.UpdateAuth, m.Option(model.UID), model.NAME, m.Append(model.NAME))
case AuthPersonal: case AuthPersonal:
m.Cmd("web.team.gonganxitong.user", s.UpdateAuth, m.Option(model.UID), model.UID, m.Append(model.CREATOR)) m.Cmd("web.team.gonganxitong.user", s.UpdateAuth, m.Option(model.UID), model.UID, m.Append(model.USER_UID))
case AuthCompany: case AuthCompany:
m.Cmd("web.team.guanlixitong.company", s.UpdateAuth, m.Option(model.UID), model.NAME, m.Append(model.NAME)) m.Cmd("web.team.guanlixitong.company", s.UpdateAuth, m.Option(model.UID), model.NAME, m.Append(model.NAME))
case AuthSchool: case AuthSchool:

View File

@ -1,7 +1,7 @@
Volcanos(chat.ONIMPORT, { 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.name, can.onimport.textView(can, value, "auth_type"), can.onimport.titleAction(can, value)]}, {view: html.TITLE, list: [value.name, can.onimport.textView(can, value, AUTH_TYPE), can.onimport.titleAction(can, value)]},
{view: html.STATUS, list: [value.uid.slice(0, 6), can.onimport.timeView(can, value), can.onimport.textView(can, value)]}, {view: html.STATUS, list: [value.uid.slice(0, 6), can.onimport.timeView(can, value), can.onimport.textView(can, value)]},
] }) ] })
}, },

View File

@ -1,11 +1,9 @@
package renzhengshouquan package renzhengshouquan
import ( import (
"path"
"shylinux.com/x/ice" "shylinux.com/x/ice"
"shylinux.com/x/icebergs/base/mdb" "shylinux.com/x/icebergs/base/mdb"
"shylinux.com/x/icebergs/base/nfs" "shylinux.com/x/toolkits"
"shylinux.com/x/community/src/renzhengshouquan/model" "shylinux.com/x/community/src/renzhengshouquan/model"
) )
@ -19,8 +17,8 @@ type cert struct {
} }
func (s cert) Upload(m *ice.Message, arg ...string) { func (s cert) Upload(m *ice.Message, arg ...string) {
p := m.UploadSave(path.Join(nfs.USR, m.Option(mdb.FIELD), m.Option(model.AUTH_UID)) + nfs.PS) m.WarnNotValid(!kit.IsIn(m.OptionDefault(mdb.FIELD, "cert"), "cert"))
s.Create(m, model.PATH, p, model.AUTH_UID, m.Option(model.AUTH_UID)) s.UploadCreate(m, model.PATH, m.Option(model.AUTH_UID))
} }
func (s cert) List(m *ice.Message, arg ...string) { func (s cert) List(m *ice.Message, arg ...string) {
if len(arg) == 1 { if len(arg) == 1 {

View File

@ -8,5 +8,5 @@ Volcanos(chat.ONIMPORT, {
}, },
}) })
Volcanos(chat.ONACTION, { Volcanos(chat.ONACTION, {
upload: function(event, can) { can.user.upload(can.request(event, {field: "cert", _handle: ice.TRUE}), can) }, upload: function(event, can) { can.user.upload(can.request(event, {_handle: ice.TRUE}), can) },
}) })

View File

@ -4,7 +4,6 @@ import (
"strconv" "strconv"
"shylinux.com/x/ice" "shylinux.com/x/ice"
"shylinux.com/x/icebergs/base/aaa"
kit "shylinux.com/x/toolkits" kit "shylinux.com/x/toolkits"
"shylinux.com/x/community/src/renzhengshouquan/model" "shylinux.com/x/community/src/renzhengshouquan/model"
@ -24,20 +23,6 @@ func (s Table) Inputs(m *ice.Message, arg ...string) {
s.InputsListSkip(m, AuthTypeList, kit.Select("0", "-1", m.IsTech()), arg...) s.InputsListSkip(m, AuthTypeList, kit.Select("0", "-1", m.IsTech()), arg...)
case model.AUTH_STATUS: case model.AUTH_STATUS:
s.InputsList(m, AuthStatusList, arg...) s.InputsList(m, AuthStatusList, arg...)
case model.FROM_UID:
switch AuthType(kit.Int(m.Option(model.AUTH_TYPE))) {
case AuthRoot:
m.Push(model.UID, aaa.ROOT).Push(model.NAME, aaa.ROOT)
case AuthCity:
m.Cmdy(Auth{}, s.Select, model.TYPE, AuthRoot)
case AuthCompany, AuthPersonal:
m.Cmdy(Auth{}, s.Select, model.TYPE, AuthCity)
default:
msg := m.Cmd(Auth{}, s.Select, model.TYPE, AuthCity, model.NAME, m.Option(model.CITY_NAME))
m.Cmdy(Auth{}, s.Select, model.TYPE, AuthCompany, model.FROM_UID, msg.Append(model.UID))
}
m.Cut(model.UID, model.NAME).RenameAppend(model.UID, model.FROM_UID)
m.DisplayInputKeyNameIconTitle()
default: default:
s.Table.Inputs(m, arg...) s.Table.Inputs(m, arg...)
} }

View File

@ -10,15 +10,14 @@ const (
STATUS = "status" STATUS = "status"
TITLE = "title" TITLE = "title"
CONTENT = "content" CONTENT = "content"
CREATOR = "creator" AVATAR = "avatar"
BACKGROUND = "background"
USER_UID = "user_uid" USER_UID = "user_uid"
USER_AUTH_ROLE = "user_auth_role" USER_AUTH_ROLE = "user_auth_role"
AUTH_UID = "auth_uid" AUTH_UID = "auth_uid"
AUTH_NAME = "auth_name" AUTH_NAME = "auth_name"
AUTH_TYPE = "auth_type" AUTH_TYPE = "auth_type"
AUTH_STATUS = "auth_status" AUTH_STATUS = "auth_status"
DASHBOARD_UID = "dashboard_uid"
STORAGE_UID = "storage_uid"
CERT_UID = "cert_uid" CERT_UID = "cert_uid"
COMPANY_UID = "company_uid" COMPANY_UID = "company_uid"
COMPANY_NAME = "company_name" COMPANY_NAME = "company_name"
@ -27,11 +26,11 @@ const (
FROM_UID = "from_uid" FROM_UID = "from_uid"
SERVICE_UID = "service_uid" SERVICE_UID = "service_uid"
PLACE_UID = "place_uid" PLACE_UID = "place_uid"
STORAGE_UID = "storage_uid"
DASHBOARD_UID = "dashboard_uid"
SPACE = "space" SPACE = "space"
INDEX = "index" INDEX = "index"
PATH = "path" PATH = "path"
BACKGROUND = "background"
AVATAR = "avatar"
) )
type UserAuth struct { type UserAuth struct {
@ -48,11 +47,11 @@ type Auth struct {
Status uint8 `gorm:"default:0"` Status uint8 `gorm:"default:0"`
Avatar string `gorm:"type:varchar(255)"` Avatar string `gorm:"type:varchar(255)"`
Background string `gorm:"type:varchar(255)"` Background string `gorm:"type:varchar(255)"`
StorageUID string `gorm:"type:char(32)"`
DashboardUID string `gorm:"type:char(32)"`
ServiceUID string `gorm:"type:char(32)"` ServiceUID string `gorm:"type:char(32)"`
PlaceUID string `gorm:"type:char(32)"` PlaceUID string `gorm:"type:char(32)"`
UserUID string `gorm:"type:char(32)"` UserUID string `gorm:"type:char(32)"`
StorageUID string `gorm:"type:char(32)"`
DashboardUID string `gorm:"type:char(32)"`
} }
type Cert struct { type Cert struct {
db.ModelContent db.ModelContent

View File

@ -23,6 +23,12 @@ func (s Portal) PlaceCreate(m *ice.Message, arg ...string) {
if m.Option(model.AUTH_TYPE) == ice.AUTO { if m.Option(model.AUTH_TYPE) == ice.AUTO {
arg = append(arg, model.AUTH_TYPE, m.Option(model.AUTH_TYPE, AuthService)) arg = append(arg, model.AUTH_TYPE, m.Option(model.AUTH_TYPE, AuthService))
} }
if m.WarnNotRight(AuthType(kit.Int(m.Option(model.AUTH_TYPE))) == AuthRoot && !m.IsTech()) {
return
}
if AuthType(kit.Int(m.Option(model.AUTH_TYPE))) == AuthRoot && m.IsTech() {
arg = append(arg, model.STATUS, kit.Format(AuthIssued))
}
from := "" from := ""
switch AuthType(kit.Int(m.Option(model.AUTH_TYPE))) { switch AuthType(kit.Int(m.Option(model.AUTH_TYPE))) {
case AuthRoot: case AuthRoot:
@ -41,18 +47,10 @@ func (s Portal) PlaceCreate(m *ice.Message, arg ...string) {
if from == "" { if from == "" {
return return
} }
arg = append(arg, model.FROM_UID, m.Option(model.FROM_UID, from)) s.Portal.PlaceCreate(m, append(arg, model.FROM_UID, m.Option(model.FROM_UID, from), model.USER_UID, m.Option(model.USER_UID))...)
arg = append(arg, model.USER_UID, m.Option(model.USER_UID))
if m.WarnNotRight(AuthType(kit.Int(m.Option(model.AUTH_TYPE))) == AuthRoot && !m.IsTech()) {
return
}
if AuthType(kit.Int(m.Option(model.AUTH_TYPE))) == AuthRoot && m.IsTech() {
arg = append(arg, model.STATUS, kit.Format(AuthIssued))
}
s.Portal.PlaceCreate(m, arg...)
} }
func (s Portal) PlaceList(m *ice.Message, arg ...string) *ice.Message { func (s Portal) PlaceList(m *ice.Message, arg ...string) *ice.Message {
s.Tables(m, "left join auths on user_auths.auth_uid = auths.uid").FieldsWithCreatedAT(m, s.UserPlace, s.Tables(m, s.Place).FieldsWithCreatedAT(m, s.UserPlace,
model.AUTH_NAME, model.AUTH_TYPE, model.AUTH_STATUS, model.USER_AUTH_ROLE, model.AUTH_NAME, model.AUTH_TYPE, model.AUTH_STATUS, model.USER_AUTH_ROLE,
s.AS(s.Key(s.Place, model.UID), model.AUTH_UID), model.COMPANY_UID, s.AS(s.Key(s.Place, model.UID), model.AUTH_UID), model.COMPANY_UID,
) )

View File

@ -2,12 +2,11 @@
"portal": "认证授权", "portal": "认证授权",
"cert": "上传证件", "auth": "认证授权", "profile": "用户名片", "cert": "上传证件", "auth": "认证授权", "profile": "用户名片",
"certList": "证件", "memberList": "成员", "certList": "证件", "memberList": "成员",
"issue": "认证", "revoke": "吊销", "issue": "认证", "revoke": "吊销", "enter": "进入",
"enter": "进入",
"style": { "style": {
"enter": "notice",
"issue": "notice", "issue": "notice",
"revoke": "danger" "revoke": "danger",
"enter": "notice"
}, },
"icons": { "icons": {
"auth": "https://img.icons8.com/officel/80/activity-grid.png", "auth": "https://img.icons8.com/officel/80/activity-grid.png",

View File

@ -1,11 +1,9 @@
package renzhengshouquan package renzhengshouquan
import ( import (
"path"
"shylinux.com/x/ice" "shylinux.com/x/ice"
"shylinux.com/x/icebergs/base/aaa"
"shylinux.com/x/icebergs/base/mdb" "shylinux.com/x/icebergs/base/mdb"
"shylinux.com/x/icebergs/base/nfs"
"shylinux.com/x/icebergs/base/web" "shylinux.com/x/icebergs/base/web"
kit "shylinux.com/x/toolkits" kit "shylinux.com/x/toolkits"
@ -26,20 +24,26 @@ func (s profile) Modify(m *ice.Message, arg ...string) {
s.Update(m, kit.Dict(m.OptionSimple(model.INFO)), model.UID, m.Option(model.AUTH_UID)) s.Update(m, kit.Dict(m.OptionSimple(model.INFO)), model.UID, m.Option(model.AUTH_UID))
} }
func (s profile) Upload(m *ice.Message, arg ...string) { func (s profile) Upload(m *ice.Message, arg ...string) {
p := m.UploadSave(path.Join(nfs.USR, m.Option(mdb.FIELD), m.Option(model.AUTH_UID)) + nfs.PS) m.WarnNotValid(!kit.IsIn(m.OptionDefault(mdb.FIELD, aaa.AVATAR), aaa.AVATAR, aaa.BACKGROUND))
s.Update(m, kit.Dict(m.Option(mdb.FIELD), p), model.UID, m.Option(model.AUTH_UID)) s.Table.UploadUpdate(m, "", m.Option(model.AUTH_UID))
}
func (s profile) List(m *ice.Message, arg ...string) {
if len(arg) == 1 {
s.Select(m, model.UID, arg[0])
kit.If(s.IsVisitor(m), func() { m.Action() }, func() { m.Action(s.Modify) })
}
s.RewriteAppend(m)
m.Display("")
} }
func (s profile) AuthList(m *ice.Message, arg ...string) { func (s profile) AuthList(m *ice.Message, arg ...string) {
m.Cmdy(s.Auth, m.Option(model.AUTH_UID)) m.Cmdy(s.Auth, m.Option(model.AUTH_UID)).Table(func(value ice.Maps) {
kit.If(s.IsVisitor(m), func() { m.PushAction() })
s.SelectJoinService(m)
m.Table(func(value ice.Maps) {
if value[model.SERVICE_UID] == "" { if value[model.SERVICE_UID] == "" {
m.PushButton() m.PushButton()
} else { } else {
m.PushButton(s.Enter) m.PushButton(s.Enter)
} }
}) })
s.SelectJoinService(m)
s.RewriteAppend(m) s.RewriteAppend(m)
} }
func (s profile) MemberList(m *ice.Message, arg ...string) { func (s profile) MemberList(m *ice.Message, arg ...string) {
@ -57,21 +61,5 @@ func (s profile) SystemList(m *ice.Message, arg ...string) {
} }
func (s profile) Enter(m *ice.Message, arg ...string) { func (s profile) Enter(m *ice.Message, arg ...string) {
} }
func (s profile) List(m *ice.Message, arg ...string) {
if len(arg) == 1 {
s.Select(m, model.UID, arg[0]).Display("")
kit.If(s.IsVisitor(m), func() { m.Action() }, func() { m.Action(s.Modify) })
}
s.RewriteAppend(m)
}
func (s profile) RewriteAppend(m *ice.Message, arg ...string) {
s.Table.RewriteAppend(m)
m.RewriteAppend(func(value, key string, index int) string {
if value != "" && kit.IsIn(key, model.BACKGROUND, model.AVATAR) {
value = m.Resource(value)
}
return value
})
}
func init() { ice.TeamCtxCmd(profile{}) } func init() { ice.TeamCtxCmd(profile{}) }

View File

@ -1,42 +1,42 @@
Volcanos(chat.ONIMPORT, { Volcanos(chat.ONIMPORT, {
_init: function(can, msg) { msg.Option("_share_title", msg.Append(mdb.NAME)) _init: function(can, msg) { msg.Option("_share_title", msg.Append(mdb.NAME))
if (!can.base.isIn(msg.Option("user_role"), "1", "2", "3")) { delete(can.onaction.updateAvatar), delete(can.onaction.updateBackground) } if (!can.base.isIn(msg.Option(USER_ROLE), "1", "2", "3")) { delete(can.onaction.updateAvatar), delete(can.onaction.updateBackground) }
can.ui = can.page.Appends(can, can._output, [html.HEAD, html.LIST]) can.ui = can.page.Appends(can, can._output, [html.HEAD, html.LIST])
msg.Table(function(value) { msg.Table(function(value) {
can.page.Append(can, can.ui.head, [{img: can.misc.Resource(can, value.background||"usr/icons/background.jpg"), onclick: function(event) { can.page.Append(can, can.ui.head, [{img: can.misc.Resource(can, value.background||html.BACKGROUND_JPG), onclick: function(event) {
can.onaction.updateBackground && can.onaction.updateBackground(event, can) can.onaction.updateBackground && can.onaction.updateBackground(event, can)
}}]) }}])
can.page.Append(can, can.ui.head, [can.onimport.itemcard(can, {avatar: value.avatar||"usr/icons/avatar.jpg"}, [ can.page.Append(can, can.ui.head, [can.onimport.itemcard(can, {avatar: value.avatar||html.AVATAR_JPG}, [
{view: html.TITLE, list: [value.name, can.onimport.authView(can, value), can.onimport.textView(can, value, "auth_type"), can.onimport.titleAction(can, msg)]}, {view: html.TITLE, list: [value.name, can.onimport.authView(can, value), can.onimport.textView(can, value, AUTH_TYPE), can.onimport.titleAction(can, msg)]},
{view: html.STATUS, list: [value.info]}, {view: html.STATUS, list: [value.info]},
])]) ])])
}) })
var cmd = msg.Append("auth_type") == "personal"? can.onimport.systemList(can, msg): var cmd = msg.Append(AUTH_TYPE) == "personal"? can.onimport.systemList(can, msg):
msg.Append("auth_type") == "service"? can.onimport.memberList(can, msg): msg.Append(AUTH_TYPE) == "service"? can.onimport.memberList(can, msg):
can.onimport.authList(can, msg) can.onimport.authList(can, msg)
}, },
authList: function(can, msg) { authList: function(can, msg) {
can.runAction(can.request({}, {auth_uid: msg.Append(UID)}), "authList", [], function(msg) { can.runAction(can.request({}, {auth_uid: msg.Append(UID)}), "authList", [], function(msg) {
can.onimport.myView(can, msg, function(value) { value.avatar = value.avatar||"usr/icons/avatar.jpg" can.onimport.myView(can, msg, function(value) { value.avatar = value.avatar||html.AVATAR_JPG
return [ return [
{view: html.TITLE, list: [value.name, can.onimport.authView(can, value), can.onimport.textView(can, value, "auth_type"), can.onimport.titleAction(can, value)]}, {view: html.TITLE, list: [value.name, can.onimport.authView(can, value), can.onimport.textView(can, value, AUTH_TYPE), can.onimport.titleAction(can, value)]},
{view: html.STATUS, list: [value.info]}, {view: html.STATUS, list: [value.info]},
] ]
}, function(event, value) { }, function(event, value) {
can.Option("auth_uid", value.uid), can.Update(event) can.Option(AUTH_UID, value.uid), can.Update(event)
}, can.ui.list) }, can.ui.list)
}) })
}, },
memberList: function(can, msg) { memberList: function(can, msg) {
can.runAction(can.request({}, {auth_uid: msg.Append(UID)}), "memberList", [], function(msg) { can.runAction(can.request({}, {auth_uid: msg.Append(UID)}), "memberList", [], function(msg) {
can.onimport.myView(can, msg, function(value) { value.avatar = value.user_avatar||"usr/icons/avatar.jpg" can.onimport.myView(can, msg, function(value) { value.avatar = value.user_avatar||html.AVATAR_JPG
return [ return [
{view: html.TITLE, list: [value.auth_name, can.onimport.authView(can, value), can.onimport.textView(can, value, "auth_type")]}, {view: html.TITLE, list: [value.auth_name, can.onimport.authView(can, value), can.onimport.textView(can, value, AUTH_TYPE)]},
{view: html.STATUS, list: [value.user_info]}, {view: html.STATUS, list: [value.user_info]},
] ]
}, function(event, value) { }, function(event, value) {
if (value.auth_uid) { if (value.auth_uid) {
can.Option("auth_uid", value.auth_uid), can.Update(event) can.Option(AUTH_UID, value.auth_uid), can.Update(event)
} else { } else {
can.onimport.myStory(can, {index: "web.team.gonganxitong.user", args: [value.user_uid]}) can.onimport.myStory(can, {index: "web.team.gonganxitong.user", args: [value.user_uid]})
} }
@ -44,22 +44,20 @@ Volcanos(chat.ONIMPORT, {
}) })
}, },
systemList: function(can, msg) { systemList: function(can, msg) {
can.runAction(can.request({}, {}), "systemList", [msg.Append("user_uid")||msg.Option("user_uid")], function(msg) { can.runAction(can.request({}, {}), "systemList", [msg.Append(USER_UID)||msg.Option(USER_UID)], function(msg) {
can.onimport.myView(can, msg, function(value) { value.avatar = value.avatar||"usr/icons/avatar.jpg" can.onimport.myView(can, msg, function(value) { value.avatar = value.avatar||html.AVATAR_JPG
return [ return [
{view: html.TITLE, list: [value.name, can.onimport.authView(can, value), can.onimport.textView(can, value, "auth_type"), can.onimport.titleAction(can, value)]}, {view: html.TITLE, list: [value.name, can.onimport.authView(can, value), can.onimport.textView(can, value, AUTH_TYPE), can.onimport.titleAction(can, value)]},
{view: html.STATUS, list: [value.info]}, {view: html.STATUS, list: [value.info]},
] ]
}, function(event, value) { }, function(event, value) {
can.Option("auth_uid", value.uid), can.Update(event) can.Option(AUTH_UID, value.uid), can.Update(event)
}, can.ui.list) }, can.ui.list)
}) })
}, },
}) })
Volcanos(chat.ONACTION, { Volcanos(chat.ONACTION, {
enter: function(event, can) { var msg = can.request(event) enter: function(event, can) { var msg = can.request(event); can.onimport.myPlugin(can, {space: msg.Option("service_nodename"), index: msg.Option("service_index"), args: [msg.Option("place_uid")]}) },
can.onimport.myPlugin(can, {space: msg.Option("service_nodename"), index: msg.Option("service_index"), args: [msg.Option("place_uid")]})
},
updateBackground: function(event, can) { can.user.upload(can.request(event, {field: aaa.BACKGROUND}), can) }, updateBackground: function(event, can) { can.user.upload(can.request(event, {field: aaa.BACKGROUND}), can) },
updateAvatar: function(event, can) { can.user.upload(can.request(event, {field: aaa.AVATAR}), can) }, updateAvatar: function(event, can) { can.user.upload(can.request(event, {field: aaa.AVATAR}), can) },
}) })

View File

@ -10,18 +10,19 @@ import (
type call struct { type call struct {
Schedule Schedule
list string `name:"list queue_uid uid reception_uid auto" role:"leader,worker"` reception reception
list string `name:"list queue_uid reception_uid 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) {
if len(arg) == 1 { if len(arg) == 1 {
s.SelectByStatus(m.Options(mdb.ORDER, model.TAKE_TIME), arg[0], kit.Format(ScheduleTake)) m.Cmdy(s.reception, arg).RenameAppend(model.UID, model.RECEPTION_UID).PushAction().Action()
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]).Action(s.Call) s.SelectByStatus(m.Options(mdb.ORDER, model.TAKE_TIME), arg[0], kit.Format(ScheduleTake), s.Key(s.Schedule, model.RECEPTION_UID), arg[1])
kit.If(m.Length() == 0, func() { m.Echo(m.Trans("wait take", "等待取号")) }, func() { m.Action(s.Call) })
} else if len(arg) == 3 { } else if len(arg) == 3 {
s.Select(m, model.QUEUE_UID, arg[0], model.RECEPTION_UID, arg[2], model.STATUS, kit.Format(ScheduleTake)).Action(s.Call) s.Schedule.List(m, arg[0], arg[2]).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) }

View File

@ -1,8 +1,8 @@
$output { display:flex; } $output { display:flex; }
$output>div.reception { max-width:50%; } $output>div.reception { max-width:50%; }
$output>div.reception div.item { padding:10px; } $output>div.reception div.item { padding:var(--item-padding); }
$output>div.reception div.item.select { background-color:var(--notice-bg-color); color:var(--notice-fg-color); } $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 { 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 { background-color:var(--output-bg-color); padding:var(--item-padding); margin-bottom:5px; position:relative; }
$output>div.volume div.item div.status { display:flex; align-items:center; } $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; } $output>div.volume div.item div.action { position:absolute; right:var(--item-padding); top:13px; }

View File

@ -8,19 +8,18 @@ import (
type plan struct { type plan struct {
Schedule Schedule
volume Volume volume Volume
reception reception reception reception
volumeList string `name:"volumeList" role:"void"` 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) {
s.Schedule.Create(m, m.OptionSimple(model.QUEUE_UID, model.RECEPTION_UID, model.VOLUME_UID, model.USER_UID)...) 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) { func (s plan) Cancel(m *ice.Message) {
s.Schedule.Cancel(m.Options(model.UID, m.Option(model.SCHEDULE_UID))) s.Schedule.Cancel(m.Options(model.UID, m.Option(model.SCHEDULE_UID)))
} }
func (s plan) VolumeList(m *ice.Message, arg ...string) { func (s plan) VolumeList(m *ice.Message) {
s.Tables(m, "LEFT JOIN schedules ON schedules.volume_uid = volumes.uid AND status = 0") 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) 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.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())

View File

@ -7,16 +7,19 @@ Volcanos(chat.ONIMPORT, {
return {view: [html.ITEM, "", value.name], onclick: function(event) { can.onmotion.select(can, can.ui.reception, html.DIV_ITEM, event.target) 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) 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() })); var list = can.page.Select(can, can.ui.reception, html.DIV_ITEM); list[0] && 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: [
{view: html.STATUS, list: [{text: "开始时间: "+value.begin_time}]},
{view: html.STATUS, list: [{text: "结束时间: "+value.end_time}]},
can.onimport.titleAction(can, value, "create", "cancel"),
]}
}))
})
}, },
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, { Volcanos(chat.ONACTION, {
create: function(event, can, button) { can.runAction(event, button) }, create: function(event, can, button) { can.runAction(event, button) },

View File

@ -16,12 +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.DashboardInsertOrder(m, "1", "订单总量") s.DashboardInsertOrder(m, 1, "订单总量")
s.DashboardInsertOrder(m, "2", "订单已预约", model.STATUS, SchedulePlan) s.DashboardInsertOrder(m, 2, "订单已预约", model.STATUS, SchedulePlan)
s.DashboardInsertOrder(m, "3", "订单已取号", model.STATUS, ScheduleTake) s.DashboardInsertOrder(m, 3, "订单已取号", model.STATUS, ScheduleTake)
s.DashboardInsertOrder(m, "4", "订单已完成", model.STATUS, ScheduleFinish) s.DashboardInsertOrder(m, 4, "订单已完成", model.STATUS, ScheduleFinish)
} }
func (s Portal) DashboardInsertOrder(m *ice.Message, order, title string, arg ...ice.Any) { func (s Portal) DashboardInsertOrder(m *ice.Message, order int, 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))) s.DashboardInsert(m, order, title, "order", Schedule{}, "", kit.TransArgs(kit.Simple(m.OptionSimple(model.QUEUE_UID), arg))...)
} }
func init() { gonganxitong.PortalCmd(Portal{Portal: guanlixitong.NewPortal(userQueue{}, queue{})}) } func init() { gonganxitong.PortalCmd(Portal{Portal: guanlixitong.NewPortal(userQueue{}, queue{})}) }

View File

@ -1,15 +1,15 @@
{ {
"portal": "约号系统", "portal": "约号系统",
"reception": "服务场所", "volume": "服务计划", "open": "放号", "plan": "约号", "take": "取号", "call": "叫号", "reception": "服务场所", "open": "放号", "plan": "约号", "take": "取号", "call": "叫号",
"schedule": "订单数据", "history": "我的订单", "volume": "服务计划", "schedule": "订单数据", "history": "我的订单",
"expire": "过号", "finish": "完成", "expire": "过号", "finish": "完成",
"icons": { "icons": {
"reception": "https://img.icons8.com/officel/80/meeting-room.png", "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",
"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"
}, },
@ -28,6 +28,7 @@
"queue_type": "场景类型", "queue_type": "场景类型",
"reception_uid": "服务场所", "reception_uid": "服务场所",
"reception_name": "服务场所", "reception_name": "服务场所",
"reception_info": "服务信息",
"volume_uid": "服务计划", "volume_uid": "服务计划",
"volume_total": "放号总量", "volume_total": "放号总量",
"schedule_status": "订单状态", "schedule_status": "订单状态",
@ -39,7 +40,9 @@
"expire_time": "过期时间", "expire_time": "过期时间",
"finish_time": "完成时间", "finish_time": "完成时间",
"total": "放号总量", "total": "放号总量",
"count": "约号数量" "count": "约号数量",
"expire": "过号数量",
"finish": "完成数量"
}, },
"value": { "value": {
"user_queue_role": { "user_queue_role": {

View File

@ -39,11 +39,7 @@ func (s Schedule) Create(m *ice.Message, arg ...string) {
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)
s.Orders(m, model.TAKE_TIME).Limit(m, 1) s.Orders(m, model.TAKE_TIME).Limit(m, 1)
if m.Option(model.RECEPTION_UID) != "" { s.SelectByStatus(m, kit.Simple(m.Option(model.QUEUE_UID), kit.Format(ScheduleTake), s.Key(s, model.RECEPTION_UID), m.Option(model.RECEPTION_UID))...).PushAction(s.Expire, s.Finish)
s.SelectByStatus(m, kit.Simple(m.Option(model.QUEUE_UID), kit.Format(ScheduleTake), m.OptionSimple(model.RECEPTION_UID))...).PushAction(s.Expire, s.Finish)
} else {
s.SelectByStatus(m, m.Option(model.QUEUE_UID), kit.Format(ScheduleTake)).PushAction(s.Expire, s.Finish)
}
if m.Length() == 0 { if m.Length() == 0 {
m.ProcessRewrite(model.UID, "") m.ProcessRewrite(model.UID, "")
return return
@ -107,9 +103,7 @@ func (s Schedule) List(m *ice.Message, arg ...string) *ice.Message {
} }
if len(arg) == 2 { if len(arg) == 2 {
status := ScheduleStatus(kit.Int(m.Append(model.SCHEDULE_STATUS))) status := ScheduleStatus(kit.Int(m.Append(model.SCHEDULE_STATUS)))
if status == ScheduleExpire || status == ScheduleFinish { kit.If(status == ScheduleExpire || status == ScheduleFinish, func() { s.DoneMessage(m) })
s.DoneMessage(m)
}
} }
s.SelectJoin(m, s.reception) s.SelectJoin(m, s.reception)
s.SelectJoinUser(m) s.SelectJoinUser(m)
@ -136,6 +130,7 @@ func (s Schedule) Cancel(m *ice.Message, arg ...string) {
s.addCount(m, model.COUNT, "-1") s.addCount(m, model.COUNT, "-1")
s.changeStatus(m, SchedulePlan, ScheduleCancel) s.changeStatus(m, SchedulePlan, ScheduleCancel)
}) })
s.DashboardUpdate(m)
m.ProcessRefresh() m.ProcessRefresh()
} }
func (s Schedule) Take(m *ice.Message, arg ...string) { func (s Schedule) Take(m *ice.Message, arg ...string) {
@ -157,6 +152,7 @@ func (s Schedule) Expire(m *ice.Message, arg ...string) {
}) })
s.Select(m.FieldsSetDetail(), args...) s.Select(m.FieldsSetDetail(), args...)
s.sendTemplate(m, "已过号") s.sendTemplate(m, "已过号")
s.DashboardUpdate(m)
} }
func (s Schedule) Finish(m *ice.Message, arg ...string) { func (s Schedule) Finish(m *ice.Message, arg ...string) {
args := kit.Simple(model.CALL_UID, m.Option(model.USER_UID), m.OptionSimple(model.UID)) args := kit.Simple(model.CALL_UID, m.Option(model.USER_UID), m.OptionSimple(model.UID))

View File

@ -18,31 +18,21 @@ func (s Volume) Create(m *ice.Message, arg ...string) {
arg = kit.TransArgKeys(arg, model.VOLUME_TOTAL, model.TOTAL) 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.Options(arg), 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", "创建服务计划")+" "+s.joinKV(m, model.VOLUME_TOTAL, model.BEGIN_TIME, model.END_TIME)) s.RecordEvent(m, "✅ "+m.Trans("create volume", "创建服务计划")+" "+kit.JoinKV(": ", "\n", m.OptionSimple(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 { s.Tables(m, s.reception).FieldsWithCreatedAT(m, s,
if m.Option(model.RECEPTION_UID) != "" { model.RECEPTION_NAME, model.BEGIN_TIME, model.END_TIME,
s.Fields(m, model.UID, model.BEGIN_TIME, model.END_TIME, model.TOTAL, model.COUNT) model.TOTAL, model.COUNT, model.EXPIRE, model.FINISH, model.USER_UID,
s.Select(m, m.OptionSimple(model.QUEUE_UID, model.RECEPTION_UID)...) )
} if len(arg) == 1 {
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.TOTAL, model.COUNT, model.EXPIRE, model.FINISH, model.USER_UID,
)
s.Select(m, s.Key(s, model.QUEUE_UID), arg[0]) s.Select(m, s.Key(s, model.QUEUE_UID), arg[0])
s.SelectJoinUser(m) } else if len(arg) == 2 {
m.Display("") s.SelectDetail(m, s.Key(s, model.QUEUE_UID), arg[0], s.Key(s, model.UID), arg[1])
} }
s.SelectJoinUser(m)
m.Display("")
return m return m
} }
func init() { ice.TeamCtxCmd(Volume{}) } func init() { ice.TeamCtxCmd(Volume{}) }
func (s Volume) joinKV(m *ice.Message, arg ...string) string {
list := []string{}
kit.For(arg, func(k string) { list = append(list, k, m.Option(k)) })
return kit.JoinKV(": ", "\n", list...)
}