This commit is contained in:
IT 老营长 @云轩领航-创始人 2024-09-05 20:02:41 +08:00
parent aed9db28b5
commit 2de61939b4
40 changed files with 252 additions and 227 deletions

View File

@ -24,7 +24,7 @@ func (s allow) Create(m *ice.Message, arg ...string) {
s.Table.Create(m, arg...)
m.Options(m.Cmd(s.Prefix(m, s.portal), s.portal.SelectCommand, m.PrefixKey()).AppendSimple(model.COMMAND_UID))
s.SendMessage(m, m.Option(model.FROM_USER_UID), m.Option(model.USER_UID))
s.sendTemplate(m, m.Trans("please process role allow", "请处理 权限审批"))
s.sendTemplate(m, m.Trans("role allow process", "权限审批 请处理"))
}
func (s allow) List(m *ice.Message, arg ...string) {
s.Tables(m, s.apply, "left join users on applies.user_uid = users.uid").FieldsWithCreatedAT(m, s.apply,
@ -52,10 +52,10 @@ func (s allow) List(m *ice.Message, arg ...string) {
s.DisplayBase(m, "")
}
func (s allow) Reject(m *ice.Message, arg ...string) {
s.process(m, AllowCreate, AllowRejected, "❌", m.Trans("rejected role allow", "已驳回 权限审批"))
s.process(m, AllowCreate, AllowRejected, "❌", m.Trans("role allow rejected", "权限审批 已驳回"))
}
func (s allow) Approve(m *ice.Message, arg ...string) {
s.process(m, AllowCreate, AllowApproved, "✅", m.Trans("approved role allow", "已通过 权限审批"))
s.process(m, AllowCreate, AllowApproved, "✅", m.Trans("role allow approved", "权限审批 已通过"))
}
func (s allow) process(m *ice.Message, from, to AllowStatus, icon string, title string) {
defer m.ToastProcess()()

View File

@ -87,17 +87,17 @@ func (s apply) Submit(m *ice.Message, arg ...string) {
}
m.Option(model.FROM_USER_UID, m.Option(model.USER_UID))
m.Cmd(s.Prefix(m, allow{}), s.Create, model.APPLY_UID, m.Option(model.UID), model.PLACE_UID, m.Option(s.Keys(s.Place, model.UID)), msg.AppendSimple(model.USER_UID), model.STATUS, AllowCreate)
s.RecordEvent(m, kit.JoinWord("🕑", m.Trans("apply submit", "已提交 权限申请"), kit.Cut(m.Option(model.UID), 6), s.TransRole(m), m.Option(model.USER_NAME)), m.Option(model.UID))
s.RecordEvent(m, kit.JoinWord("🕑", m.Trans("role apply submit", "权限申请 已提交"), kit.Cut(m.Option(model.UID), 6), s.TransRole(m), m.Option(model.USER_NAME)), m.Option(model.UID))
s.SendMessage(m, msg.Append(model.USER_UID), m.Option(model.USER_UID))
}
func (s apply) Reject(m *ice.Message, arg ...string) {
msg := s.changeStatus(m, ApplySubmit, ApplyRejected)
s.sendTemplate(msg, m.Trans("rejected role apply", "已驳回 权限申请"))
s.sendTemplate(msg, m.Trans("role apply rejected", "权限申请 已驳回"))
}
func (s apply) Approve(m *ice.Message, arg ...string) {
msg := s.changeStatus(m, ApplySubmit, ApplyApproved)
m.Cmd(s.UserPlace, s.Create, msg.AppendSimple(model.USER_UID, model.ROLE), s.Keys(s.Place, model.UID), msg.Append(model.PLACE_UID))
s.sendTemplate(msg, m.Trans("approved role apply", "已通过 权限申请"))
s.sendTemplate(msg, m.Trans("role apply approved", "权限申请 已通过"))
}
func init() { ice.TeamCtxCmd(apply{Table: newTable()}) }

View File

@ -3,7 +3,7 @@ Volcanos(chat.ONIMPORT, {
var PLACE_NAME = msg.Option("_place_name"), PLACE_TYPE = msg.Option("_place_type")
var USER_PLACE_ROLE = msg.Option("_user_place_role"), STREET_NAME = msg.Option("_street_name"), APPLY_STATUS = "apply_status"
can.onimport.itemcards(can, msg, function(value) { var status = value[APPLY_STATUS]; return [
{view: html.TITLE, list: [value[PLACE_NAME], can.onimport.textView(can, value, PLACE_TYPE), can.onimport.textView(can, value, USER_PLACE_ROLE)]},
{view: html.TITLE, list: [value.user_name, can.onimport.textView(can, value, USER_PLACE_ROLE)]},
{view: html.STATUS, list: [value.uid.slice(0, 6), can.base.TimeTrim(value.created_at), can.onimport.textView(can,value, APPLY_STATUS)]},
{view: html.STATUS, list: [value.begin_time.split(" ")[0], value.end_time.split(" ")[0]]},
{view: html.STATUS, list: [value.city_name, value[STREET_NAME]]},

View File

@ -49,9 +49,7 @@ func (s Table) LoadTrans(m *ice.Message, arg ...string) {
ice.LoadTrans(m.Spawn(kit.Dict("_template", path.Join(path.Dir(base), "portal.json"))).Message, m.CommandKey(), m.GetCommand().Command)
}
h := ctx.GetCmdFile(m.Message, m.PrefixKey())
if strings.HasPrefix(h, "/p/src/") {
h = strings.TrimPrefix(h, "/p/")
}
kit.If(strings.HasPrefix(h, "/p/src/"), func() { h = strings.TrimPrefix(h, "/p/") })
if path.Dir(h) != path.Dir(base) && m.CommandKey() != web.PORTAL {
ice.LoadTrans(m.Spawn(kit.Dict("_template", path.Join(path.Dir(h), "portal.json"))).Message, m.CommandKey(), m.GetCommand().Command)
}
@ -73,18 +71,6 @@ func (s Table) Inputs(m *ice.Message, arg ...string) {
s.InputsListRole(m, UserPlaceRoleList, arg...)
case model.PLACE_TYPE:
s.InputsList(m, PlaceTypeList, arg...)
case model.CITY_NAME:
if m.IsDebug() {
m.Push(arg[0], "深圳市")
}
case model.COMPANY_NAME:
if m.IsDebug() {
m.Push(arg[0], "云境互联")
}
case model.SCHOOL_NAME:
if m.IsDebug() {
m.Push(arg[0], "深圳中学")
}
default:
s.Table.Inputs(m, arg...)
}
@ -122,6 +108,35 @@ func (s Table) Create(m *ice.Message, arg ...string) {
s.Table.Create(m, arg...)
s.UserPlaceInit(m)
}
func (s Table) Remove(m *ice.Message, arg ...string) {
s.Table.Remove(m, arg...)
}
func (s Table) Modify(m *ice.Message, arg ...string) {
s.Table.Modify(m, arg...)
}
func (s Table) ValueModel(m *ice.Message, action ice.Any, arg ...string) *ice.Message {
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)
}
func (s Table) ValueCreate(m *ice.Message, arg ...string) {
s.ValueModel(m, s.ValueCreate, arg...)
s.RecordEventWithName(m, "")
}
func (s Table) ValueRemove(m *ice.Message, arg ...string) {
s.ValueModel(m, s.ValueRemove, arg...)
s.RecordEventWithName(m, "")
}
func (s Table) ValueModify(m *ice.Message, arg ...string) {
s.ValueModel(m, s.ValueModify, arg...)
s.RecordEventWithName(m, "")
}
func (s Table) ValueList(m *ice.Message, arg []string, fields ...ice.Any) *ice.Message {
kit.If(len(fields) == 0, func() { fields = kit.TransArgs(kit.Split(m.Config(mdb.FIELDS))) })
defer m.Options(db.FIELDS, fields).Set(ice.MSG_OPTION, db.FIELDS)
defer m.Options(db.TARGET, m.CommandKey()).Set(ice.MSG_OPTION, db.TARGET)
return s.ValueModel(m, s.ValueList, arg...).PushAction(s.Remove).Action(s.Create)
}
func (s Table) List(m *ice.Message, arg ...string) *ice.Message {
if m.IsTech() {
if len(arg) == 0 {
@ -140,27 +155,16 @@ func (s Table) Select(m *ice.Message, arg ...string) *ice.Message {
func (s Table) SelectDetail(m *ice.Message, arg ...string) *ice.Message {
return s.Table.SelectDetail(m, arg...)
}
func (s Table) SelectJoinUser(m *ice.Message) *ice.Message {
return s.SelectJoin(m, user{}, model.NAME, model.AVATAR)
func (s Table) SelectJoinUser(m *ice.Message, arg ...string) *ice.Message {
kit.If(len(arg) == 0, func() { arg = append(arg, model.NAME, model.AVATAR) })
return s.SelectJoin(m, user{}, arg...)
}
func (s Table) SelectJoinCity(m *ice.Message) *ice.Message {
return s.SelectJoin(m, city{}, model.NAME)
}
func (s Table) FindSpaceCmd(m *ice.Message, cmd ice.Any) ice.Any {
switch cmds := ice.GetTypeKey(cmd); cmds {
case web.TEAM_GONGANXITONG_USER, web.TEAM_RENZHENGSHOUQUAN_AUTH, web.CODE_MYSQL_CLIENT:
if ice.Info.NodeName == "20240724-community" {
return cmd
} else {
m.Options(ice.MSG_USERROLE, aaa.TECH)
return []string{web.SPACE, kit.Keys(ice.OPS, "20240724-community"), cmds}
}
}
return cmd
}
func (s Table) SelectJoinAuth(m *ice.Message) *ice.Message {
defer m.Options(ice.MSG_USERROLE, aaa.VOID)
return s.SelectJoin(m, s.FindSpaceCmd(m, web.TEAM_RENZHENGSHOUQUAN_AUTH), model.STATUS)
return s.SelectJoin(m, s.FindSpaceCmd(m, web.TEAM_RENZHENGSHOUQUAN_AUTH), model.NAME, model.STATUS)
}
func (s Table) RenameAppend(m *ice.Message, arg ...string) Table {
m.RenameAppend(arg...)
@ -176,6 +180,8 @@ func (s Table) RewriteAppend(m *ice.Message, arg ...string) *ice.Message {
value = UserPlaceRole(kit.Int(value)).String()
case model.PLACE_TYPE:
value = PlaceType(kit.Int(value)).String()
case model.AUTH_STATUS:
value = AuthStatus(kit.Int(value)).String()
case model.APPLY_STATUS:
value = ApplyStatus(kit.Int(value)).String()
case model.ALLOW_STATUS:
@ -187,7 +193,11 @@ func (s Table) RewriteAppend(m *ice.Message, arg ...string) *ice.Message {
})
return m
}
func (s Table) TablesWithRole(m *ice.Message, arg []string, userPlace UserPlacer, place Placer, target Placer, fields ...ice.Any) *ice.Message {
func (s Table) TablesWithRole(m *ice.Message, arg []string, userPlace UserPlacer, place Placer, target ice.Any, fields ...ice.Any) *ice.Message {
if len(arg) == 0 {
s.Select(m, m.OptionSimple(s.Keys(place, model.UID))...)
return m
}
s.Tables(m, kit.JoinWord("INNER JOIN", s.TableName(kit.TypeName(userPlace)),
"ON", s.Key(target, model.USER_UID), "=", s.Key(userPlace, model.USER_UID),
"AND", s.Key(target, s.Keys(place, model.UID)), "=", s.Key(userPlace, s.Keys(place, model.UID)),
@ -200,7 +210,7 @@ func (s Table) TablesWithRole(m *ice.Message, arg []string, userPlace UserPlacer
} else {
return m
}
return s.SelectJoinUser(m)
return s.SelectJoinUser(m.Options(db.DB, "", db.MODEL, ""))
}
func (s Table) Update(m *ice.Message, data ice.Map, arg ...string) {
data[model.OPERATOR] = m.Option(model.USER_UID)
@ -246,32 +256,32 @@ func (s Table) RecordEventWithName(m *ice.Message, info string, arg ...string) {
s.RecordEvent(m, kit.JoinWord(info, kit.Cut(uid, 6), kit.Select(m.Option(model.TITLE), m.Option(model.NAME))), uid)
}
func (s Table) GetCommands(m *ice.Message, key string, arg ...string) []string {
kit.If(len(arg) == 0, func() { arg = append(arg, m.Option(s.Keys(s.Place, model.UID)), m.Option(model.UID)) })
m.OptionDefault(model.UID, m.Result())
return kit.Simple(m.OptionSimple(key), ctx.ARGS, kit.Join(arg), m.OptionSimple(model.CITY_NAME, model.STREET_NAME, model.PLACE_NAME))
}
func (s Table) SendMessage(m *ice.Message, from_user_uid, to_user_uid string, arg ...string) {
m.Spawn(ice.Maps{db.DB: ""}).Cmd(message{}, s.Create, model.FROM_USER_UID, from_user_uid, model.TO_USER_UID, to_user_uid, s.GetCommands(m, model.COMMAND_UID, arg...))
m.Spawn(ice.Maps{db.DB: ""}).Cmd(s.Prefix(m, message{}), s.Create, model.FROM_USER_UID, from_user_uid, model.TO_USER_UID, to_user_uid, s.GetCommands(m, model.COMMAND_UID, arg...))
}
func (s Table) DoneMessage(m *ice.Message, arg ...string) {
if m.Option(model.MESSAGE_UID) != "" {
m.Spawn(ice.Maps{db.DB: ""}).Cmd(message{}, message{}.Done, kit.Dict(model.UID, m.Option(model.MESSAGE_UID)))
m.Spawn(ice.Maps{db.DB: ""}).Cmd(s.Prefix(m, message{}), message{}.Done, kit.Dict(model.UID, m.Option(model.MESSAGE_UID)))
}
}
func (s Table) SendTemplate(m *ice.Message, from, to, title string, arg ...string) {
if m.IsErr() {
return
}
m.Cmd(Portal{}, m.PrefixKey(), from, to, title, arg)
m.Cmd(s.Prefix(m, Portal{}), s.SendTemplate, m.PrefixKey(), from, to, title, arg)
}
func (s Portal) SendTemplate(m *ice.Message, arg ...string) {
name := kit.Select("", arg, 4)
if name == "" {
name = m.Option(s.Keys(s.Place, model.NAME)) + " " + s.Place.TransValue(m, s.Keys(s.UserPlace, model.ROLE))
name = kit.JoinWord(m.Option(model.CITY_NAME), m.Option(model.STREET_NAME), m.Option(s.Keys(s.Place, model.NAME)))
}
uid, place_uid := kit.Select(m.Option(model.UID), arg, 5), kit.Select("", arg, 6)
kit.If(place_uid == "", func() { place_uid = m.Option(s.Keys(s.Place, model.UID)) })
link := s.Link(m, place_uid, arg[0], uid)
m.Cmd(s.FindSpaceCmd(m, user{}), s.SendTemplate, arg[1], arg[2], link, arg[3], name, kit.Cut(uid, 6))
m.Cmd(s.FindSpaceCmd(m, user{}), s.SendTemplate, arg[1], arg[2], link, kit.JoinWord(m.Option(model.PORTAL_NAME), arg[3]), name, kit.Cut(uid, 6))
}
func (s Table) DisplayBase(m *ice.Message, file string) *ice.Message {
if s.Place != nil {
@ -329,6 +339,18 @@ func (s Table) SpaceCmd(m *ice.Message, space string, arg ...ice.Any) *ice.Messa
return m.Cmd(append([]ice.Any{web.SPACE, kit.Keys(ice.OPS, space)}, arg...)...)
}
}
func (s Table) FindSpaceCmd(m *ice.Message, cmd ice.Any) ice.Any {
switch cmds := ice.GetTypeKey(cmd); cmds {
case web.TEAM_GONGANXITONG_USER, web.TEAM_RENZHENGSHOUQUAN_AUTH, web.CODE_MYSQL_CLIENT:
if ice.Info.NodeName == "20240724-community" {
return cmd
} else {
m.Options(ice.MSG_USERROLE, aaa.TECH)
return []string{web.SPACE, kit.Keys(ice.OPS, "20240724-community"), cmds}
}
}
return cmd
}
func (s Table) Link(m *ice.Message, arg ...string) string {
return Portal{}.Link(m, arg...)
}
@ -368,8 +390,8 @@ func PortalCmd(portal ice.Any) {
cmd("apply", apply{Table: table})
cmd("allow", allow{Table: table})
cmd("member", member{Tables: Tables{Table: table}})
cmd("message", message{})
cmd("recent", recent{})
cmd("message", message{Table: table})
cmd("recent", recent{Table: table})
cmd("service", service{Table: table})
cmd("support", support{})
cmd("support", support{Table: table})
}

View File

@ -1,11 +1,9 @@
Volcanos(chat.ONIMPORT, {
_init: function(can, msg) { can.onimport.shareTitle && can.onimport.shareTitle(can, msg)
_init: function(can, msg) {
var PLACE_NAME = msg.Option("_place_name"), PLACE_TYPE = msg.Option("_place_type"), USER_PLACE_ROLE = msg.Option("_user_place_role")
PLACE_TYPE || can.core.List(msg.append, function(key) { can.base.endWith(key, "_type") && (PLACE_TYPE = key), can.base.endWith(key, "_role") && (USER_PLACE_ROLE = key) })
can.onimport.itemcards(can, msg, function(value) { return [
{view: html.TITLE, list:[value.title||value.name||value.user_name,
can.onimport.textView(can, value, PLACE_TYPE), can.onimport.textView(can, value, USER_PLACE_ROLE),
]},
{view: html.TITLE, list:[value.title||value.name||value.user_name, can.onimport.textView(can, value, PLACE_TYPE), can.onimport.textView(can, value, USER_PLACE_ROLE)]},
{view: html.STATUS, list: [value.city_name, value.street_name, value.company_name]},
{view: html.STATUS, list: [value.uid && value.uid.slice(0, 6), can.base.TimeTrim(value.created_at||value.updated_at)]},
value.address && {view: html.STATUS, list: [value.address]},

View File

@ -21,7 +21,27 @@ func (s member) List(m *ice.Message, arg ...string) {
} else {
return
}
s.SelectJoinUser(m)
s.SelectJoinUser(m, model.AVATAR, model.NAME, model.AUTH_UID)
s.SelectJoinAuth(m)
s.Display(m, "")
}
func init() { ice.TeamCtxCmd(member{Tables: newTables()}) }
type AuthStatus int
const (
AuthCreate AuthStatus = iota
AuthRequest
AuthIssued
AuthRevoked
)
var AuthStatusList = map[AuthStatus]string{
AuthCreate: "create",
AuthRequest: "request",
AuthIssued: "issued",
AuthRevoked: "revoked",
}
func (s AuthStatus) String() string { return AuthStatusList[s] }

View File

@ -0,0 +1,10 @@
Volcanos(chat.ONIMPORT, {
_init: function(can, msg) {
var PLACE_NAME = msg.Option("_place_name"), PLACE_TYPE = msg.Option("_place_type"), USER_PLACE_ROLE = msg.Option("_user_place_role")
can.onimport.itemcards(can, msg, function(value) { return [
{view: html.TITLE, list: [value.user_name, value.auth_name, can.onimport.authView(can, value), can.onimport.textView(can, value, USER_PLACE_ROLE)]},
{view: html.STATUS, list: [value.uid.slice(0, 6), can.base.TimeTrim(value.created_at)]},
{view: html.OUTPUT, list: [value.info||value.content]},
] })
},
})

View File

@ -15,12 +15,22 @@ type message struct {
command command
service service
order string `data:"100"`
create string `name:"create from_user_uid to_user_uid"`
read string `name:"read" role:"void"`
done string `name:"done" role:"void"`
sticky string `name:"sticky" role:"void"`
unSticky string `name:"unSticky" role:"void"`
}
func (s message) Create(m *ice.Message, arg ...string) {
m.Info("what %v", m.FormatChain())
m.Info("what %v", m.Option(s.Keys(s.Place, model.UID)))
m.Info("what %v", s.Keys(s.Place, model.UID))
kit.If(m.Option(ctx.ARGS) == "", func() {
arg = append(arg, ctx.ARGS, kit.Join([]string{m.Option(s.Keys(s.Place, model.UID)), m.Option(model.UID)}))
})
s.Table.Create(m, arg...)
}
func (s message) List(m *ice.Message, arg ...string) {
s.Tables(m, s.command, s.service).FieldsWithCreatedAT(m, s,
model.FROM_USER_UID, s.Key(s, model.PLACE_NAME), s.Key(s.command, model.NAME), model.SCORE, model.MESSAGE_STATUS,
@ -82,7 +92,7 @@ func (s message) update(m *ice.Message, data ice.Map, arg ...ice.Any) {
s.Table.Update(m, data, kit.Simple(model.TO_USER_UID, m.Option(model.USER_UID), m.OptionSimple(model.UID), arg)...)
}
func init() { ice.TeamCtxCmd(message{}) }
func init() { ice.TeamCtxCmd(message{Table: newTable()}) }
type MessageStatus int

View File

@ -42,6 +42,7 @@ const (
ALLOW_UID = "allow_uid"
ALLOW_STATUS = "allow_status"
EVENT_UID = "event_uid"
PORTAL_NAME = "portal_name"
COMMAND_UID = "command_uid"
MESSAGE_UID = "message_uid"
MESSAGE_STATUS = "message_status"
@ -59,8 +60,6 @@ const (
EMAIL = "email"
AVATAR = "avatar"
ADDRESS = "address"
TABLES = "tables"
SCORE = "score"
NODE_NAME = "node_name"
NODENAME = "nodename"
SPACE = "space"
@ -68,6 +67,7 @@ const (
INDEX = "index"
ARGS = "args"
INIT = "init"
SCORE = "score"
)
type Sess struct {
@ -162,11 +162,9 @@ type Service struct {
Hostname string `gorm:"type:varchar(32)"`
}
type Support struct {
db.ModelWithUID
db.ModelContent
FromUserUID string `gorm:"type:char(32);index"`
ToUserUID string `gorm:"type:char(32);index"`
Title string `gorm:"type:varchar(64)"`
Content string
}
func init() {

View File

@ -52,6 +52,7 @@ $output fieldset.story>form.option { display:none; }
$output fieldset.story>div.action { display:none; }
$output fieldset.story>div.status { display:none; }
$output fieldset.story>div.output { background-color:var(--plugin-bg-color); }
$output div.list fieldset.story>div.output { background-color:var(--output-bg-color); }
$output fieldset.story>div.output table.content td { box-shadow:none; }
$output fieldset.story>div.output table.content tr.uid { display:none; }
$output fieldset.story>div.output table.content td img { max-width:100%; }

View File

@ -95,7 +95,7 @@ func (s Portal) Run(m *ice.Message, arg ...string) {
}
func (s Portal) List(m *ice.Message, arg ...string) {
if m.Option(mdb.VIEW) == mdb.TABLE {
s.Hash.List(m, arg...).PushAction(mdb.DETAIL, s.Remove).SortInt(mdb.ORDER)
s.Hash.List(m, arg...).PushAction(mdb.DETAIL, s.Hash.Remove).SortInt(mdb.ORDER)
return
}
if len(arg) == 0 {
@ -166,7 +166,7 @@ func (s Portal) PlaceRemove(m *ice.Message, arg ...string) {
m.Cmdy(s.UserPlace, s.Delete, m.OptionSimple(model.USER_UID, model.UID))
}
func (s Portal) PlaceList(m *ice.Message, arg ...string) *ice.Message {
s.Tables(m, s.Place).FieldsWithCreatedAT(m, s.UserPlace, model.AUTH_UID, model.INIT,
s.Tables(m, s.Place).FieldsWithCreatedAT(m, s.UserPlace, model.AUTH_UID, s.Key(s.Place, model.INIT),
s.Keys(s.Place, model.NAME), s.Keys(s.Place, model.TYPE), s.Keys(s.UserPlace, model.ROLE),
s.Keys(s.Place, model.UID), s.Keys(s.Street, model.UID),
)
@ -233,6 +233,18 @@ func (s Portal) AddRecent(m *ice.Message, arg ...string) {
m.Cmd(s.Prefix(m, s.recent), s.Create, s.GetCommands(m, model.SERVICE_UID, arg...))
}
}
func (s Portal) ValueCreate(m *ice.Message, arg ...string) {
s.Table.Create(m, kit.Simple(arg, m.OptionSimple(model.USER_UID, s.Keys(s.Place, model.UID)))...)
}
func (s Portal) ValueRemove(m *ice.Message, arg ...string) {
s.Table.Delete(m, m.OptionSimple(s.Keys(s.Place, model.UID), model.UID)...)
}
func (s Portal) ValueModify(m *ice.Message, arg ...string) {
s.Table.Update(m, kit.Dict(arg), m.OptionSimple(s.Keys(s.Place, model.UID), model.UID)...)
}
func (s Portal) ValueList(m *ice.Message, arg ...string) {
s.TablesWithRole(m, arg, s.UserPlace, s.Place, m.Option("target"), m.Optionv(mdb.FIELDS).([]ice.Any)...)
}
func init() { ice.TeamCtxCmd(Portal{Table: newTable()}) }

View File

@ -97,8 +97,8 @@ Volcanos(chat.ONIMPORT, {
can.page.Append(can, target, [{view: html.TITLE, list: [{text: can.user.trans(can, "My Count", "我的数据")}]}])
can.onappend.plugin(can._root.Action, {space: "20240903-operation", index: "web.team.dashboard.summary", args: ["e61693838bfe34ab15485b0bc2355d19"]}, function() {}, target)
},
myInit: function(can, msg, value, target) { if (!msg) { return }
can.onmotion.hidden(can, target)
myInit: function(can, msg, value, target) { if (!msg) { return } can.onmotion.hidden(can, target)
return
can.page.Append(can, target, [{view: html.TITLE, list: [{text: can.user.trans(can, "My Init", "我的初始化")}]}])
msg.Table(function(val) {
if (parseInt(val.init) == parseInt(value.init)+1) { val.args = [value._uid], val.style = html.OUTPUT, value._init = true
@ -106,9 +106,7 @@ Volcanos(chat.ONIMPORT, {
can.onappend.plugin(can, val, function(sub) { var run = sub.run
sub.run = function(event, cmds, cb) {
run(can.request(event, {place_uid: value._uid, place_init: value.init}), cmds, function(msg) {
if (cmds[1] == mdb.CREATE || cmds.length == 1 && msg.Length() > 0) {
debugger
can.onmotion.clearInput(can), can.Update() } else { cb(msg) }
if (cmds[1] == mdb.CREATE || cmds.length == 1 && msg.Length() > 0) { can.onmotion.clearInput(can), can.Update() } else { cb(msg) }
})
}
}, target)

View File

@ -38,6 +38,9 @@
"street_name": "街道名称",
"company_name": "公司名称",
"city_name": "城市名称",
"auth_name": "认证主体",
"auth_status": "认证状态",
"service_name": "服务名称",
"qrcode_type": "链接类型",
"apply_status": "申请状态",
"allow_status": "审批状态",
@ -54,17 +57,23 @@
"table": "应用"
},
"value": {
"auth_status": {
"create": "🕑 待认证",
"request": "🕑 待认证",
"issued": "✅ 已认证",
"revoked": "❌ 已吊销"
},
"apply_status": {
"create": "待提交 🕑",
"cancel": "已取消 ❌",
"submit": "已提交 🕑",
"rejected": "已驳回 ❌",
"approved": "已通过 ✅"
"create": "🕑 待提交",
"cancel": "已取消",
"submit": "🕑 已提交",
"rejected": "已驳回",
"approved": "已通过"
},
"allow_status": {
"create": "待审批 🕑",
"rejected": "已驳回",
"approved": "已通过"
"create": "🕑 待审批",
"rejected": "已驳回",
"approved": "已通过"
},
"user_place_role": {
"visitor": "访客",

View File

@ -62,4 +62,4 @@ func (s recent) UnSticky(m *ice.Message, arg ...string) {
s.Table.Update(m, ice.Map{model.SCORE: 0}, m.OptionSimple(model.USER_UID, model.UID)...)
}
func init() { ice.TeamCtxCmd(recent{}) }
func init() { ice.TeamCtxCmd(recent{Table: newTable()}) }

View File

@ -9,4 +9,4 @@ type support struct {
func (s support) List(m *ice.Message, arg ...string) {}
func init() { ice.TeamCtxCmd(support{}) }
func init() { ice.TeamCtxCmd(support{Table: newTable()}) }

View File

@ -35,11 +35,6 @@ func (s Table) RewriteAppend(m *ice.Message, arg ...string) *ice.Message {
})
return s.Table.RewriteAppend(m)
}
func (s Table) CheckRole(m *ice.Message, arg ...string) *ice.Message {
role := User{{.Option "Class"}}Role(s.UserPlaceRole(m))
m.WarnNotRight(!kit.IsIn(role.String(), append(arg, User{{.Option "Class"}}Creator.String())...), role.String())
return m
}
type Tables struct { Table }

View File

@ -1,25 +1,18 @@
package {{.Option "name"}}
import (
"shylinux.com/x/ice"
kit "shylinux.com/x/toolkits"
"{{.Option "module"}}/model"
)
import "shylinux.com/x/ice"
type {{.Option "table"}} struct {
Table
{{.Option "class"}} {{.Option "class"}}
user{{.Option "Class"}} user{{.Option "Class"}}
create string `name:"create title* content*" role:"leader"`
fields string `data:"title,content"`
create string `name:"create title* content*" role:"leader"`
}
func (s {{.Option "table"}}) Create(m *ice.Message, arg ...string) {
s.Table.Create(m, kit.Simple(arg, m.OptionSimple(model.USER_UID, model.{{.Option "CLASS"}}_UID))...)
s.RecordEventWithName(m, "")
s.Table.ValueCreate(m, arg...)
}
func (s {{.Option "table"}}) List(m *ice.Message, arg ...string) {
s.TablesWithRole(m, arg, s.user{{.Option "Class"}}, s.{{.Option "class"}}, s, model.TITLE, model.CONTENT).Display("")
s.Table.ValueList(m, arg).Display("")
}
func init() { ice.TeamCtxCmd({{.Option "table"}}{}) }

View File

@ -1,5 +1,5 @@
Volcanos(chat.ONIMPORT, {
_init: function(can, msg) { can.onimport.shareTitle(can, msg)
_init: function(can, msg) {
can.onimport.itemcards(can, msg, function(value) { return [
{view: html.TITLE, list: [value.title]},
{view: html.STATUS, list: [value.uid.slice(0, 6), can.base.TimeTrim(value.created_at), value.user_name]},

View File

@ -15,7 +15,7 @@ const (
{{.Option "CLASS"}}_NAME = "{{.Option "class"}}_name"
{{.Option "CLASS"}}_TYPE = "{{.Option "class"}}_type"
{{.Option "TABLE"}}_UID = "{{.Option "what"}}_uid"
COMPANY_UID = "company_uid"
COMPANY_UID = "company_uid"
CITY_UID = "city_uid"
)

View File

@ -7,9 +7,7 @@ import (
type Portal struct {
guanlixitong.Portal
placeCreate string `name:"placeCreate city_name* company_name* {{.Option "class"}}_type*:select {{.Option "class"}}_name*" role:"void"`
placeCreate string `name:"placeCreate city_name* company_name* {{.Option "class"}}_name* {{.Option "class"}}_type*:select" role:"void"`
}
func init() {
gonganxitong.PortalCmd(Portal{Portal: guanlixitong.NewPortal(user{{.Option "Class"}}{}, {{.Option "class"}}{})})
}
func init() { gonganxitong.PortalCmd(Portal{Portal: guanlixitong.NewPortal(user{{.Option "Class"}}{}, {{.Option "class"}}{})}) }

View File

@ -1,27 +1,15 @@
package {{.Option "name"}}
import "shylinux.com/x/ice"
import (
"shylinux.com/x/ice"
"shylinux.com/x/enterprise/src/guanlixitong"
)
type user{{.Option "Class"}} struct{ Table }
func init() { ice.TeamCtxCmd(user{{.Option "Class"}}{}) }
type User{{.Option "Class"}}Role int
type User{{.Option "Class"}}Role = guanlixitong.UserGroupRole
const (
User{{.Option "Class"}}Visitor User{{.Option "Class"}}Role = iota
User{{.Option "Class"}}Creator
User{{.Option "Class"}}Leader
User{{.Option "Class"}}Worker
User{{.Option "Class"}}Server
)
var User{{.Option "Class"}}RoleList = map[User{{.Option "Class"}}Role]string{
User{{.Option "Class"}}Visitor: "visitor",
User{{.Option "Class"}}Creator: "creator",
User{{.Option "Class"}}Leader: "leader",
User{{.Option "Class"}}Worker: "worker",
User{{.Option "Class"}}Server: "server",
}
func (s User{{.Option "Class"}}Role) String() string { return User{{.Option "Class"}}RoleList[s] }
var User{{.Option "Class"}}RoleList = guanlixitong.UserGroupRoleList

View File

@ -1,25 +1,16 @@
package huodongzuzhi
import (
"shylinux.com/x/ice"
kit "shylinux.com/x/toolkits"
"shylinux.com/x/community/src/huodongzuzhi/model"
)
import "shylinux.com/x/ice"
type activity struct {
Table
group group
userGroup userGroup
create string `name:"create title* content*" role:"leader"`
fields string `data:"title,content"`
create string `name:"create title* content*" role:"leader"`
remove string `name:"remove" role:"leader"`
}
func (s activity) Create(m *ice.Message, arg ...string) {
s.Table.Create(m, kit.Simple(arg, m.OptionSimple(model.USER_UID, model.GROUP_UID))...)
s.RecordEventWithName(m, "")
}
func (s activity) List(m *ice.Message, arg ...string) {
s.TablesWithRole(m, arg, s.userGroup, s.group, s, model.TITLE, model.CONTENT).Display("")
}
func (s activity) Create(m *ice.Message, arg ...string) { s.ValueCreate(m, arg...) }
func (s activity) Remove(m *ice.Message, arg ...string) { s.ValueRemove(m, arg...) }
func (s activity) List(m *ice.Message, arg ...string) { s.ValueList(m, arg).Display("") }
func init() { ice.TeamCtxCmd(activity{}) }

View File

@ -1,5 +1,5 @@
Volcanos(chat.ONIMPORT, {
_init: function(can, msg) { can.onimport.shareTitle(can, msg)
_init: function(can, msg) {
can.onimport.itemcards(can, msg, function(value) { return [
{view: html.TITLE, list: [value.title]},
{view: html.STATUS, list: [value.uid.slice(0, 6), can.base.TimeTrim(value.created_at), value.user_name]},

View File

@ -7,7 +7,7 @@ import (
type Portal struct {
guanlixitong.Portal
placeCreate string `name:"placeCreate city_name* company_name* group_type*:select group_name*" role:"void"`
placeCreate string `name:"placeCreate city_name* company_name* group_name* group_type*:select" role:"void"`
}
func init() { gonganxitong.PortalCmd(Portal{Portal: guanlixitong.NewPortal(userGroup{}, group{})}) }

View File

@ -1,7 +1,7 @@
{
"portal": "活动组织",
"member": "组织成员",
"activity": "活动安排",
"member": "组织成员",
"icons": {
"activity": "https://img.icons8.com/officel/80/activity-grid.png"
},

View File

@ -27,11 +27,12 @@ func (s auth) List(m *ice.Message, arg ...string) {
m.PushButton(s.Issue)
case AuthIssued:
m.PushButton(s.Revoke)
case AuthRevoked:
m.PushButton(s.Issue)
default:
m.PushButton()
}
})
m.RenameAppend(model.TYPE, model.AUTH_TYPE, model.STATUS, model.AUTH_STATUS).Display("")
}).RenameAppend(model.TYPE, model.AUTH_TYPE, model.STATUS, model.AUTH_STATUS).Display("")
}
func (s auth) CertList(m *ice.Message, arg ...string) {
m.Cmdy(cert{}, arg[0]).Action()
@ -48,14 +49,13 @@ func (s auth) Issue(m *ice.Message, arg ...string) {
}
}
s.Update(m, kit.Dict(model.STATUS, AuthIssued), model.FROM_UID, m.Option(model.AUTH_UID), model.UID, m.Option(model.UID))
s.Select(m, model.UID, m.Option(model.UID))
switch AuthType(kit.Int(m.Append(model.TYPE))) {
switch s.Select(m, model.UID, m.Option(model.UID)); AuthType(kit.Int(m.Append(model.TYPE))) {
case AuthCity:
m.Cmd("web.team.gonganxitong.city", s.UpdateAuth, m.Option(model.UID), model.NAME, m.Append(model.NAME))
case AuthCompany:
m.Cmd("web.team.guanlixitong.company", s.UpdateAuth, m.Option(model.UID), model.NAME, m.Append(model.NAME))
case AuthPersonal:
m.Cmd("web.team.gonganxitong.user", s.UpdateAuth, m.Option(model.UID), model.UID, m.Append(model.CREATOR))
case AuthCompany:
m.Cmd("web.team.guanlixitong.company", s.UpdateAuth, m.Option(model.UID), model.NAME, m.Append(model.NAME))
}
}
func (s auth) Revoke(m *ice.Message, arg ...string) {
@ -69,21 +69,17 @@ type AuthType int
const (
AuthRoot AuthType = iota
AuthCity
AuthPersonal
AuthService
AuthCompany
AuthSchool
AuthStreet
AuthService
AuthPersonal
)
var AuthTypeList = map[AuthType]string{
AuthRoot: "root",
AuthCity: "city",
AuthPersonal: "personal",
AuthService: "service",
AuthCompany: "company",
AuthSchool: "school",
AuthStreet: "street",
AuthService: "service",
AuthPersonal: "personal",
}
func (s AuthType) String() string { return AuthTypeList[s] }

View File

@ -1,5 +1,5 @@
Volcanos(chat.ONIMPORT, {
_init: function(can, msg) { can.onimport.shareTitle(can, msg)
_init: function(can, msg) {
can.onimport.itemcards(can, msg, function(value) { return [
{view: html.TITLE, list: [value.name||value.title||value.user_name, can.onimport.textView(can, value, "auth_type")]},
{view: html.STATUS, list: [value.uid.slice(0, 6), can.base.TimeTrim(value.created_at), can.onimport.textView(can, value, "auth_status")]},

View File

@ -1,25 +1,7 @@
package renzhengshouquan
import (
"shylinux.com/x/ice"
kit "shylinux.com/x/toolkits"
import "shylinux.com/x/ice"
"shylinux.com/x/community/src/renzhengshouquan/model"
)
type cert struct {
Table
auth auth
userAuth userAuth
create string `name:"create title* content*" role:"leader"`
}
func (s cert) Create(m *ice.Message, arg ...string) {
s.Table.Create(m, kit.Simple(arg, m.OptionSimple(model.USER_UID, model.AUTH_UID))...)
s.RecordEventWithName(m, "")
}
func (s cert) List(m *ice.Message, arg ...string) {
s.TablesWithRole(m, arg, s.userAuth, s.auth, s, model.TITLE, model.CONTENT).Display("")
}
type cert struct{ Value }
func init() { ice.TeamCtxCmd(cert{}) }

View File

@ -1,5 +1,5 @@
Volcanos(chat.ONIMPORT, {
_init: function(can, msg) { can.onimport.shareTitle(can, msg)
_init: function(can, msg) {
can.onimport.itemcards(can, msg, function(value) { return [
{view: html.TITLE, list: [value.title]},
{view: html.STATUS, list: [value.uid.slice(0, 6), can.base.TimeTrim(value.created_at), value.user_name]},

View File

@ -64,3 +64,16 @@ func (s Table) RewriteAppend(m *ice.Message, arg ...string) *ice.Message {
type Tables struct{ Table }
func (s Tables) BeforeMigrate(m *ice.Message, arg ...string) {}
type Value struct {
Table
fields string `data:"title,content"`
create string `name:"create title* content*" role:"leader"`
modify string `name:"modify title* content*" role:"leader"`
remove string `name:"remove" role:"leader"`
}
func (s Value) Create(m *ice.Message, arg ...string) { s.ValueCreate(m, arg...) }
func (s Value) Modify(m *ice.Message, arg ...string) { s.ValueModify(m, arg...) }
func (s Value) Remove(m *ice.Message, arg ...string) { s.ValueRemove(m, arg...) }
func (s Value) List(m *ice.Message, arg ...string) { s.ValueList(m, arg, model.TITLE, model.CONTENT) }

View File

@ -65,9 +65,7 @@ func (s Portal) PlaceList(m *ice.Message, arg ...string) *ice.Message {
return m
}
func init() {
gonganxitong.PortalCmd(Portal{Portal: guanlixitong.NewPortal(userAuth{}, auth{})})
}
func init() { gonganxitong.PortalCmd(Portal{Portal: guanlixitong.NewPortal(userAuth{}, auth{})}) }
func (s Portal) findAuthFrom(m *ice.Message, authType AuthType, arg ...string) string {
msg := m.Cmd(auth{}, s.Table.Select, model.TYPE, authType, arg)

View File

@ -14,7 +14,7 @@
"My Auth": "我的认证",
"user_auth_role": "用户角色",
"auth_uid": "认证",
"auth_name": "主体名称",
"auth_name": "认证主体",
"auth_type": "主体类型",
"auth_status": "认证状态",
"from_uid": "认证机构"
@ -34,11 +34,9 @@
"auth_type": {
"root": "官方",
"city": "城市",
"company": "公司",
"personal": "个人",
"service": "服务",
"company": "公司",
"school": "学校",
"street": "街道",
"style": {
"root": "danger",
"city": "danger"

View File

@ -18,13 +18,12 @@ type call struct {
func (s call) List(m *ice.Message, arg ...string) {
if len(arg) == 1 {
m.Option(mdb.ORDER, model.TAKE_TIME)
s.SelectByStatus(m, 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) })
} else if len(arg) == 2 {
m.Cmdy(s.Schedule, arg[0], arg[1]).Action(s.Call)
s.Schedule.List(m, arg[0], arg[1]).Action(s.Call)
} else if len(arg) == 3 {
m.Cmdy(s.Schedule, s.Select, model.QUEUE_UID, arg[0], model.RECEPTION_UID, arg[2], model.STATUS, ScheduleTake).Action(s.Call)
s.Schedule.Select(m, model.QUEUE_UID, arg[0], model.RECEPTION_UID, arg[2], model.STATUS, kit.Format(ScheduleTake)).Action(s.Call)
}
}

View File

@ -22,6 +22,9 @@ const (
SCHEDULE_UID = "schedule_uid"
SCHEDULE_STATUS = "schedule_status"
COMPANY_UID = "company_uid"
PLACE_NAME = "place_name"
STREET_NAME = "street_name"
CITY_NAME = "city_name"
CALL_UID = "call_uid"
BEGIN_TIME = "begin_time"
END_TIME = "end_time"
@ -34,7 +37,6 @@ const (
COUNT = "count"
EXPIRE = "expire"
FINISH = "finish"
INIT = "init"
)
type UserQueue struct {

View File

@ -21,7 +21,7 @@ func (s plan) List(m *ice.Message, arg ...string) {
s.SelectByStatus(m, kit.Simple(arg[0], SchedulePlan, m.OptionSimple(model.USER_UID))...).PushAction(s.Cancel)
kit.If(m.Length() == 0, func() { m.EchoInfoButton("") }, func() { m.Action(s.Create) })
} else if len(arg) == 2 {
m.Cmdy(s.Schedule, arg)
s.Schedule.List(m, arg...)
}
}

View File

@ -7,7 +7,7 @@ import (
type Portal struct {
guanlixitong.Portal
placeCreate string `name:"placeCreate city_name* company_name* queue_type*:select queue_name*" role:"void"`
placeCreate string `name:"placeCreate city_name* company_name* queue_name* queue_type*:select" role:"void"`
}
func init() { gonganxitong.PortalCmd(Portal{Portal: guanlixitong.NewPortal(userQueue{}, queue{})}) }

View File

@ -18,25 +18,29 @@ func (s reception) Create(m *ice.Message, arg ...string) {
s.Table.Create(m, append(arg, m.OptionSimple(model.QUEUE_UID)...)...)
s.RecordEventWithName(m, "")
}
func (s reception) Remove(m *ice.Message, arg ...string) {
s.Table.Delete(m, m.OptionSimple(model.QUEUE_UID, model.UID)...)
s.RecordEventWithName(m, "")
}
func (s reception) Rename(m *ice.Message, arg ...string) {
s.Table.Rename(m, m.OptionSimple(model.QUEUE_UID, model.UID)...)
s.RecordEventWithName(m, "")
}
func (s reception) Remove(m *ice.Message, arg ...string) {
s.Table.Delete(m, m.OptionSimple(model.QUEUE_UID, model.UID)...)
s.RecordEventWithName(m, "")
}
func (s reception) List(m *ice.Message, arg ...string) {
s.Table.Fields(m, model.UID, model.NAME, model.CREATED_AT)
if len(arg) == 0 {
if m.Option(model.QUEUE_UID) != "" {
s.Table.Select(m, m.OptionSimple(model.QUEUE_UID)...)
}
} else if len(arg) == 1 {
return
}
s.Table.FieldsWithCreatedAT(m, s, model.NAME)
if len(arg) == 1 {
s.Table.Select(m, model.QUEUE_UID, arg[0])
kit.If(!m.IsErr() && m.Length() == 0, func() { m.EchoInfoButton("") })
} else if len(arg) == 2 {
s.Table.SelectDetail(m, model.QUEUE_UID, arg[0], model.UID, arg[1])
} else {
return
}
m.PushAction(s.Rename, s.Remove)
}

View File

@ -10,8 +10,8 @@ import (
type Schedule struct {
Table
queue queue
userQueue userQueue
queue queue
reception reception
volume Volume
models string `data:"schedule"`
@ -28,13 +28,14 @@ func (s Schedule) Create(m *ice.Message, arg ...string) {
s.addCount(m, mdb.COUNT, "1")
s.Table.Create(m, arg...)
})
s.SendMessage(m, m.Option(model.USER_UID), m.Option(model.USER_UID), m.Option(model.QUEUE_UID), m.Result())
s.SendMessage(m, m.Option(model.USER_UID), m.Option(model.USER_UID))
s.sendTemplate(m, "约号成功", m.Result())
m.ProcessRefresh()
}
func (s Schedule) Call(m *ice.Message, arg ...string) {
defer m.ToastProcess("叫号中...")("叫号成功")
s.Orders(m, model.TAKE_TIME).Limit(m, 1)
user_uid := m.Option(model.USER_UID)
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), m.OptionSimple(model.RECEPTION_UID))...).PushAction(s.Expire, s.Finish)
} else {
@ -45,24 +46,20 @@ func (s Schedule) Call(m *ice.Message, arg ...string) {
return
}
s.changeStatus(m, ScheduleTake, ScheduleCall, model.CALL_UID, user_uid)
s.SendMessage(m, user_uid, m.Append(model.USER_UID), m.Option(model.QUEUE_UID), m.Append(model.UID))
s.SendMessage(m, user_uid, m.Append(model.USER_UID))
s.sendTemplate(m, "服务已叫号", m.Append(model.UID))
m.ProcessRewrite(model.UID, m.Append(model.UID))
}
func (s Schedule) List(m *ice.Message, arg ...string) {
role := UserQueueRole(kit.Int(m.Cmd(s.userQueue, s.Select, m.OptionSimple(model.QUEUE_UID, model.USER_UID)).Append(model.ROLE)))
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,
model.CANCEL_TIME, model.TAKE_TIME, model.CALL_TIME, model.EXPIRE_TIME, model.FINISH_TIME,
s.Key(s, model.CALL_UID), s.Key(s, model.RECEPTION_UID), model.USER_UID, model.VOLUME_UID,
)
s.Key(s, model.RECEPTION_UID), model.VOLUME_UID, s.Key(s, model.CALL_UID), model.USER_UID)
if role == UserQueueCreator || role == UserQueueLeader {
if len(arg) == 1 {
s.Select(m, s.Key(s, model.QUEUE_UID), arg[0])
} else if len(arg) == 2 {
s.SelectDetail(m, s.Key(s, model.QUEUE_UID), arg[0], s.Key(s, model.UID), arg[1])
if ScheduleStatus(kit.Int(m.Append(model.SCHEDULE_STATUS))) == ScheduleFinish {
s.DoneMessage(m)
}
}
m.Table(func(value ice.Maps) {
switch ScheduleStatus(kit.Int(value[model.SCHEDULE_STATUS])) {
@ -79,9 +76,6 @@ func (s Schedule) List(m *ice.Message, arg ...string) {
s.Select(m, s.Key(s, model.QUEUE_UID), arg[0], model.CALL_UID, m.Option(model.USER_UID))
} else if len(arg) == 2 {
s.SelectDetail(m, s.Key(s, model.QUEUE_UID), arg[0], model.CALL_UID, m.Option(model.USER_UID), s.Key(s, model.UID), arg[1])
if ScheduleStatus(kit.Int(m.Append(model.SCHEDULE_STATUS))) == ScheduleFinish {
s.DoneMessage(m)
}
}
m.Table(func(value ice.Maps) {
switch ScheduleStatus(kit.Int(value[model.SCHEDULE_STATUS])) {
@ -96,9 +90,6 @@ func (s Schedule) List(m *ice.Message, arg ...string) {
s.Select(m, s.Key(s, model.QUEUE_UID), arg[0], model.USER_UID, m.Option(model.USER_UID))
} else if len(arg) == 2 {
s.SelectDetail(m, s.Key(s, model.QUEUE_UID), arg[0], model.USER_UID, m.Option(model.USER_UID), s.Key(s, model.UID), arg[1])
if ScheduleStatus(kit.Int(m.Append(model.SCHEDULE_STATUS))) == ScheduleFinish {
s.DoneMessage(m)
}
}
m.Table(func(value ice.Maps) {
switch ScheduleStatus(kit.Int(value[model.SCHEDULE_STATUS])) {
@ -109,22 +100,27 @@ func (s Schedule) List(m *ice.Message, arg ...string) {
}
})
}
if len(arg) == 2 {
status := ScheduleStatus(kit.Int(m.Append(model.SCHEDULE_STATUS)))
if status == ScheduleExpire || status == ScheduleFinish {
s.DoneMessage(m)
}
}
s.SelectJoin(m, s.reception)
s.SelectJoinUser(m)
m.Display("")
m.Action()
m.Action().Display("")
return m
}
func (s Schedule) SelectByStatus(m *ice.Message, arg ...string) *ice.Message {
order := m.Option(mdb.ORDER)
s.Tables(m, s.volume).FieldsWithCreatedAT(m, s, model.SCHEDULE_STATUS, model.BEGIN_TIME, model.END_TIME,
model.CANCEL_TIME, model.TAKE_TIME, model.CALL_TIME, model.EXPIRE_TIME, model.FINISH_TIME,
s.Key(s, model.OPERATOR), s.Key(s, model.RECEPTION_UID), model.USER_UID, model.VOLUME_UID,
)
s.Key(s, model.RECEPTION_UID), model.VOLUME_UID, s.Key(s, 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:])...).Action()
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.Display("")
m.Action().Display("")
return m
}
func (s Schedule) Cancel(m *ice.Message, arg ...string) {
@ -137,7 +133,6 @@ func (s Schedule) Cancel(m *ice.Message, arg ...string) {
s.addCount(m, mdb.COUNT, "-1")
s.changeStatus(m, SchedulePlan, ScheduleCancel)
})
s.sendTemplate(m, "约号取消")
m.ProcessRefresh()
}
func (s Schedule) Take(m *ice.Message, arg ...string) {
@ -147,7 +142,6 @@ func (s Schedule) Take(m *ice.Message, arg ...string) {
return
}
s.changeStatus(m, SchedulePlan, ScheduleTake)
s.sendTemplate(m, "取号成功")
m.ProcessRefresh()
}
func (s Schedule) Expire(m *ice.Message, arg ...string) {
@ -162,7 +156,6 @@ func (s Schedule) Expire(m *ice.Message, arg ...string) {
})
s.Select(m.FieldsSetDetail(), args...)
s.sendTemplate(m, "服务已过号")
// m.ProcessRefresh()
}
func (s Schedule) Finish(m *ice.Message, arg ...string) {
defer m.ToastProcess("完成中...")("完成成功")
@ -176,7 +169,6 @@ func (s Schedule) Finish(m *ice.Message, arg ...string) {
})
s.Select(m.FieldsSetDetail(), args...)
s.sendTemplate(m, "服务已完成")
// m.ProcessRefresh()
}
func init() { ice.TeamCtxCmd(Schedule{}) }
@ -190,9 +182,9 @@ 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 {
queue := m.Cmd(s.queue, s.Select, model.UID, m.Option(model.QUEUE_UID))
reception := m.Cmd(s.reception, s.Select, model.UID, m.Option(model.RECEPTION_UID))
s.Table.SendTemplate(m, "", m.Append(model.USER_UID), title, queue.Append(model.NAME)+" "+reception.Append(model.NAME), kit.Select("", arg, 0), m.Option(model.QUEUE_UID))
s.Table.SendTemplate(m, "", m.Append(model.USER_UID), kit.JoinWord(title, reception.Append(model.NAME)),
kit.JoinWord(m.Option(model.CITY_NAME), m.Option(model.STREET_NAME), m.Option(model.PLACE_NAME)), kit.Select("", arg, 0), m.Option(model.QUEUE_UID))
return m
}

View File

@ -17,7 +17,7 @@ func (s take) List(m *ice.Message, arg ...string) {
s.SelectByStatus(m, kit.Simple(arg[0], SchedulePlan, m.OptionSimple(model.USER_UID))...).PushAction(s.Take)
kit.If(m.Length() == 0, func() { m.Echo(m.Trans("not found plan", "没有未取的号")) })
} else if len(arg) == 2 {
m.Cmdy(s.Schedule, arg)
s.Schedule.List(m, arg...)
}
}

View File

@ -21,11 +21,9 @@ func (s Volume) List(m *ice.Message, arg ...string) {
s.Tables(m, s.reception).FieldsWithCreatedAT(m, s,
model.RECEPTION_NAME, model.AMOUNT, model.COUNT, model.EXPIRE, model.FINISH,
model.BEGIN_TIME, model.END_TIME,
)
s.Select(m, s.Key(s, model.QUEUE_UID), arg[0])
m.Display("")
).Select(m, s.Key(s, model.QUEUE_UID), arg[0]).Display("")
} else if len(arg) == 2 {
s.Fields(m, model.CREATED_AT, model.UID, model.USER_UID, s.AS(model.STATUS, model.SCHEDULE_STATUS))
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)
s.SelectJoinUser(m)
}