From adbd454947b9866ae0a012a9147d32c570887bb6 Mon Sep 17 00:00:00 2001 From: shy Date: Sun, 15 Sep 2024 20:00:08 +0800 Subject: [PATCH] add some --- src/gonganxitong/allow.go | 34 ++++---- src/gonganxitong/allow.js | 10 +-- src/gonganxitong/apply.go | 35 ++++----- src/gonganxitong/apply.js | 20 ++--- src/gonganxitong/city.go | 2 +- src/gonganxitong/command.go | 10 +-- src/gonganxitong/comment.go | 2 +- src/gonganxitong/common.go | 108 ++++++++++---------------- src/gonganxitong/common.js | 2 +- src/gonganxitong/domain.go | 9 ++- src/gonganxitong/event.go | 7 +- src/gonganxitong/event.js | 1 - src/gonganxitong/market.go | 30 ++++--- src/gonganxitong/market.js | 23 ++---- src/gonganxitong/member.go | 4 +- src/gonganxitong/member.js | 6 +- src/gonganxitong/message.go | 5 +- src/gonganxitong/message.js | 2 +- src/gonganxitong/model/model.go | 5 +- src/gonganxitong/notice.go | 10 ++- src/gonganxitong/place.go | 6 +- src/gonganxitong/portal.css | 6 +- src/gonganxitong/portal.go | 72 +++++++---------- src/gonganxitong/portal.js | 31 +++++--- src/gonganxitong/recent.go | 19 +++-- src/gonganxitong/search.js | 5 +- src/gonganxitong/service.go | 8 +- src/gonganxitong/sess.go | 11 ++- src/gonganxitong/street.go | 2 +- src/gonganxitong/template/homework.go | 6 +- src/gonganxitong/template/homework.js | 6 +- src/gonganxitong/thumb.go | 2 +- src/gonganxitong/user.go | 6 +- src/huodongzuzhi/activity.go | 6 +- src/huodongzuzhi/activity.js | 2 +- src/renzhengshouquan/auth.go | 26 ++++--- src/renzhengshouquan/auth.js | 5 +- src/renzhengshouquan/cert.go | 10 ++- src/renzhengshouquan/cert.js | 2 +- src/renzhengshouquan/common.go | 16 +--- src/renzhengshouquan/model/model.go | 4 +- src/renzhengshouquan/portal.json | 6 +- src/template/web.code.autogen/demo.go | 6 +- src/template/web.code.js/demo.js | 6 +- src/yuehaoxitong/call.go | 24 ++++-- src/yuehaoxitong/model/model.go | 8 +- src/yuehaoxitong/open.go | 26 +------ src/yuehaoxitong/plan.go | 6 +- src/yuehaoxitong/portal.go | 6 +- src/yuehaoxitong/reception.go | 9 +-- src/yuehaoxitong/schedule.go | 25 +++--- src/yuehaoxitong/schedule.js | 7 +- src/yuehaoxitong/take.go | 5 +- src/yuehaoxitong/userQueue.go | 1 + src/yuehaoxitong/volume.go | 26 ++++++- 55 files changed, 345 insertions(+), 392 deletions(-) diff --git a/src/gonganxitong/allow.go b/src/gonganxitong/allow.go index ba024b6..c29c014 100644 --- a/src/gonganxitong/allow.go +++ b/src/gonganxitong/allow.go @@ -20,27 +20,33 @@ type allow struct { approve string `name:"approve" role:"void"` } +func (s Table) placeInfo(m *ice.Message) { + msg := m.Cmd(s.Place, s.Select, model.UID, m.Option(s.Keys(s.Place, model.UID))) + s.SelectJoin(msg, s.Street, model.NAME, model.CITY_UID) + s.SelectJoinCity(msg) + m.Option(model.CITY_NAME, msg.Append(model.CITY_NAME)) + m.Option(model.STREET_NAME, msg.Append(s.Keys(s.Street, model.NAME))) + m.Option(model.PLACE_NAME, msg.Append(model.NAME)) +} 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.Insert(m.Spawn(), arg...) + s.GetCommandUID(m) + s.SendMessage(m, m.Option(model.FROM_USER_UID), "") 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, - model.USER_AVATAR, model.USER_NAME, - s.Key(s, model.PLACE_UID), s.AS(s.Key(s.apply, model.ROLE), s.Keys(s.UserPlace, model.ROLE)), model.ALLOW_STATUS, - model.BEGIN_TIME, model.END_TIME, s.AS(s.Key(s, model.UID), model.ALLOW_UID), + s.AS(s.Key(s, model.UID), model.ALLOW_UID), model.ALLOW_STATUS, s.AS(s.Key(s.apply, model.ROLE), s.Keys(s.UserPlace, model.ROLE)), + model.BEGIN_TIME, model.END_TIME, s.Key(s, model.PLACE_UID), s.Key(s.apply, model.USER_UID), ) if len(arg) == 1 { - s.Table.Select(m, s.Key(s, model.USER_UID), m.Option(model.USER_UID), s.Key(s, model.PLACE_UID), arg[0]) + s.Select(m, s.Key(s, model.USER_UID), m.Option(model.USER_UID), s.Key(s, model.PLACE_UID), arg[0]) kit.If(m.Length() == 0, func() { m.Echo(m.Trans("wait apply", "等待申请")) }) } else if len(arg) == 2 { - s.Table.SelectDetail(m, s.Key(s, model.USER_UID), m.Option(model.USER_UID), s.Key(s, model.PLACE_UID), arg[0], s.Key(s.apply, model.UID), arg[1]) + s.SelectDetail(m, s.Key(s, model.USER_UID), m.Option(model.USER_UID), s.Key(s, model.PLACE_UID), arg[0], s.Key(s.apply, model.UID), arg[1]) } else { return } - s.RenameAppend(m, model.PLACE_UID, s.Keys(s.Place, model.UID)).SelectJoin(m, s.Place, model.NAME, model.TYPE) m.Table(func(value ice.Maps) { if AllowStatus(kit.Int(value[model.ALLOW_STATUS])) == AllowCreate { m.PushButton(s.Reject, s.Approve) @@ -49,6 +55,9 @@ func (s allow) List(m *ice.Message, arg ...string) { s.DoneMessage(m) } }).Action() + s.RenameAppend(m, model.PLACE_UID, s.Keys(s.Place, model.UID)) + s.SelectJoin(m, s.Place, model.NAME, model.TYPE) + s.SelectJoinUser(m) s.DisplayBase(m, "") } func (s allow) Reject(m *ice.Message, arg ...string) { @@ -58,7 +67,6 @@ func (s allow) Approve(m *ice.Message, arg ...string) { 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()() if s.changeStatus(m, from, to); m.IsErr() { return } @@ -70,16 +78,16 @@ func (s allow) process(m *ice.Message, from, to AllowStatus, icon string, title func init() { ice.TeamCtxCmd(allow{Table: newTable()}) } func (s allow) changeStatus(m *ice.Message, from, todo AllowStatus, arg ...string) *ice.Message { - msg := s.Table.Select(m.Spawn(), model.UID, m.Option(model.ALLOW_UID), model.USER_UID, m.Option(model.USER_UID)) + msg := s.Select(m.Spawn(), model.UID, m.Option(model.ALLOW_UID), model.USER_UID, m.Option(model.USER_UID)) if !m.WarnNotFound(msg.Length() == 0, m.Option(model.UID)) { if status := AllowStatus(kit.Int(msg.Append(model.STATUS))); !m.WarnNotValid(status != from, status.String()) { - s.Table.Update(m, kit.Dict(model.STATUS, todo), model.UID, m.Option(model.ALLOW_UID)) + s.Update(m, kit.Dict(model.STATUS, todo), model.UID, m.Option(model.ALLOW_UID)) } } return msg } func (s allow) sendTemplate(m *ice.Message, info string) *ice.Message { - s.Table.SendTemplate(m, m.Option(model.USER_NAME), m.Append(model.USER_UID), info) + s.SendTemplate(m, m.Option(model.USER_NAME), m.Append(model.USER_UID), info) return m } diff --git a/src/gonganxitong/allow.js b/src/gonganxitong/allow.js index 9be4296..26bf9ba 100644 --- a/src/gonganxitong/allow.js +++ b/src/gonganxitong/allow.js @@ -1,13 +1,9 @@ Volcanos(chat.ONIMPORT, { - _init: function(can, msg) { can.onimport.shareTitle(can, msg) - var PLACE_NAME = msg.Option("_place_name"), PLACE_TYPE = msg.Option("_place_type") + _init: function(can, msg) { var USER_PLACE_ROLE = msg.Option("_user_place_role"), STREET_NAME = msg.Option("_street_name"), ALLOW_STATUS = "allow_status" can.onimport.myView(can, msg, function(value) { var status = value[ALLOW_STATUS]; return [ - {view: html.TITLE, list: [ - value.user_name, can.onimport.textView(can, value, USER_PLACE_ROLE), - can.user.isMobile && {view: html.ACTION, _init: function(target) { can.page.appendAction(can, value, target) }}, - ]}, - {view: html.STATUS, list: [value.uid.slice(0, 6), can.base.TimeTrim(value.created_at), can.onimport.textView(can, value, ALLOW_STATUS)]}, + {view: html.TITLE, list: [value.user_name, can.onimport.textView(can, value, USER_PLACE_ROLE), can.onimport.titleAction(can, value)]}, + {view: html.STATUS, list: [value.uid.slice(0, 6), can.onimport.timeView(can, value), can.onimport.textView(can, value, ALLOW_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]]}, ] }) diff --git a/src/gonganxitong/apply.go b/src/gonganxitong/apply.go index 1934883..5724719 100644 --- a/src/gonganxitong/apply.go +++ b/src/gonganxitong/apply.go @@ -29,33 +29,29 @@ func (s apply) Inputs(m *ice.Message, arg ...string) { s.UserPlace.Inputs(m, arg...) } func (s apply) Create(m *ice.Message, arg ...string) { - PLACE_UID := s.Keys(s.Place, model.UID) - USER_PLACE_ROLE := s.Keys(s.UserPlace, model.ROLE) - arg = kit.TransArgKeys(arg, PLACE_UID, model.PLACE_UID) - arg = kit.TransArgKeys(arg, USER_PLACE_ROLE, model.ROLE) - s.Table.Create(m, kit.Simple(model.PLACE_UID, m.Option(PLACE_UID), arg, m.OptionSimple(model.USER_UID), model.STATUS, ApplyCreate)...) + PLACE_UID, USER_PLACE_ROLE := s.Keys(s.Place, model.UID), s.Keys(s.UserPlace, model.ROLE) + arg = kit.TransArgKeys(arg, PLACE_UID, model.PLACE_UID, USER_PLACE_ROLE, model.ROLE) + s.Insert(m, kit.Simple(model.PLACE_UID, m.Option(PLACE_UID), arg, m.OptionSimple(model.USER_UID), model.STATUS, ApplyCreate)...) m.ProcessRewrite(model.UID, m.Result()) } func (s apply) List(m *ice.Message, arg ...string) { - s.Tables(m, s.user).FieldsWithCreatedAT(m, s, model.USER_AVATAR, model.USER_NAME, - model.PLACE_UID, s.AS(s.Key(s, model.ROLE), s.Keys(s.UserPlace, model.ROLE)), model.APPLY_STATUS, - model.BEGIN_TIME, model.END_TIME, + s.Tables(m).FieldsWithCreatedAT(m, s, model.APPLY_STATUS, + s.AS(s.Key(s, model.ROLE), s.Keys(s.UserPlace, model.ROLE)), + model.BEGIN_TIME, model.END_TIME, model.PLACE_UID, model.USER_UID, ) if len(arg) == 1 { - s.Table.Select(m, model.USER_UID, m.Option(model.USER_UID), model.PLACE_UID, arg[0]) - // s.Button(m, "") + s.Select(m, model.USER_UID, m.Option(model.USER_UID), model.PLACE_UID, arg[0]) } else if len(arg) == 2 { - s.Table.SelectDetail(m, model.USER_UID, m.Option(model.USER_UID), model.PLACE_UID, arg[0], s.Key(s, model.UID), arg[1]) + s.SelectDetail(m, model.USER_UID, m.Option(model.USER_UID), model.PLACE_UID, arg[0], s.Key(s, model.UID), arg[1]) switch ApplyStatus(kit.Int(m.Append(model.APPLY_STATUS))) { case ApplySubmit: - m.EchoQRCode(s.portal.Link(m, arg[0], ice.GetTypeKey(allow{}), arg[1])) + m.EchoQRCode(s.portal.Link(m, arg[0], s.Prefix(m, allow{}), arg[1])) case ApplyRejected, ApplyApproved: s.DoneMessage(m) } } else { return } - s.RenameAppend(m, model.PLACE_UID, s.Keys(s.Place, model.UID)).SelectJoin(m, s.Place, model.NAME, model.TYPE) m.Table(func(value ice.Maps) { if ApplyStatus(kit.Int(value[model.APPLY_STATUS])) == ApplyCreate { m.PushButton(s.Cancel, s.Submit) @@ -63,6 +59,9 @@ func (s apply) List(m *ice.Message, arg ...string) { m.PushButton() } }) + s.RenameAppend(m, model.PLACE_UID, s.Keys(s.Place, model.UID)) + s.SelectJoin(m, s.Place, model.NAME, model.TYPE) + s.SelectJoinUser(m) s.DisplayBase(m, "") } func (s apply) Cancel(m *ice.Message, arg ...string) { @@ -73,7 +72,6 @@ func (s apply) Submit(m *ice.Message, arg ...string) { if m.WarnNotValid(msg.IsErr()) { return } - defer m.ToastProcess()() role := UserPlaceCreator switch UserPlaceRole(kit.Int(msg.Append(model.ROLE))) { case UserPlaceLandlord: @@ -85,6 +83,7 @@ func (s apply) Submit(m *ice.Message, arg ...string) { if m.WarnNotFound(msg.Length() == 0, role.String()) { return } + s.placeInfo(m) 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("role apply submit", "权限申请 已提交"), kit.Cut(m.Option(model.UID), 6), s.TransRole(m), m.Option(model.USER_NAME)), m.Option(model.UID)) @@ -96,23 +95,23 @@ func (s apply) Reject(m *ice.Message, arg ...string) { } 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)) + m.Cmd(s.UserPlace, s.Insert, msg.AppendSimple(model.USER_UID, model.ROLE), s.Keys(s.Place, model.UID), msg.Append(model.PLACE_UID)) s.sendTemplate(msg, m.Trans("role apply approved", "权限申请 已通过")) } func init() { ice.TeamCtxCmd(apply{Table: newTable()}) } func (s apply) changeStatus(m *ice.Message, from, todo ApplyStatus, arg ...string) *ice.Message { - msg := s.Table.Select(m.Spawn(), m.OptionSimple(model.UID)...) + msg := s.Select(m.Spawn(), m.OptionSimple(model.UID)...) if !m.WarnNotFound(msg.Length() == 0, m.Option(model.UID)) { if status := ApplyStatus(kit.Int(msg.Append(model.STATUS))); !m.WarnNotValid(status != from, status.String()) { - s.Table.Update(m, kit.Dict(model.STATUS, todo), m.OptionSimple(model.UID)...) + s.Update(m, kit.Dict(model.STATUS, todo), m.OptionSimple(model.UID)...) } } return msg } func (s apply) sendTemplate(m *ice.Message, info string) *ice.Message { - s.Table.SendTemplate(m, "", m.Append(model.USER_UID), info) + s.SendTemplate(m, "", m.Append(model.USER_UID), info) return m } diff --git a/src/gonganxitong/apply.js b/src/gonganxitong/apply.js index 4b80efb..7c4a599 100644 --- a/src/gonganxitong/apply.js +++ b/src/gonganxitong/apply.js @@ -1,23 +1,19 @@ Volcanos(chat.ONIMPORT, { _init: function(can, msg) { - 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.myView(can, msg, function(value) { var status = value[APPLY_STATUS]; return [ {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.uid.slice(0, 6), can.onimport.timeView(can, value), 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]]}, ] }) - if (msg.Length() == 0) { can.onappend.style(can, "form") - var target = can.page.Append(can, can._output, ["code"])._target - can.page.Append(can, target, [{view: ["info", "", "请创建权限申请"]}]) - can.run({}, [ctx.ACTION, mdb.INPUTS, USER_PLACE_ROLE], function(msg) { - msg.Table(function(value) { - can.onappend.input(can, {type: html.BUTTON, name: value.name, style: value[USER_PLACE_ROLE] == "2"? "danger": "notice", value: "我是"+can.user.trans(can, value.name, null, "value."+USER_PLACE_ROLE), onclick: function(event) { - can.run(can.request(event, {_handle: ice.TRUE}), [ctx.ACTION, mdb.CREATE, USER_PLACE_ROLE, value[USER_PLACE_ROLE]]) - }}, "", target) - }) - }) + if (msg.Length() == 0) { can.onappend.style(can, html.FORM) + var target = can.page.Append(can, can._output, [{view: html.CODE, list: [{view: [mdb.INFO, "", "请创建权限申请"]}]}])._target + can.run({}, [ctx.ACTION, mdb.INPUTS, USER_PLACE_ROLE], function(msg) { msg.Table(function(value) { + can.onappend.input(can, {type: html.BUTTON, name: value.name, style: value[USER_PLACE_ROLE] == "2"? html.DANGER: html.NOTICE, value: "我是"+can.user.trans(can, value.name, null, "value."+USER_PLACE_ROLE), onclick: function(event) { + can.run(can.request(event, {_handle: ice.TRUE}), [ctx.ACTION, mdb.CREATE, USER_PLACE_ROLE, value[USER_PLACE_ROLE]]) + }}, "", target) + }) }) } }, }) diff --git a/src/gonganxitong/city.go b/src/gonganxitong/city.go index 9e9de0e..5bdcd45 100644 --- a/src/gonganxitong/city.go +++ b/src/gonganxitong/city.go @@ -10,7 +10,7 @@ type city struct{ Table } func (s city) FindOrCreateByName(m *ice.Message, arg ...string) { if msg := m.Cmd(s, s.Select, model.NAME, arg[1]); msg.Length() == 0 { - msg := m.Cmd(s, s.Create, model.NAME, arg[1]) + msg := m.Cmd(s, s.Insert, model.NAME, arg[1]) arg[0], arg[1] = model.CITY_UID, msg.Result() } else { arg[0], arg[1] = model.CITY_UID, msg.Append(model.UID) diff --git a/src/gonganxitong/command.go b/src/gonganxitong/command.go index e9e8d62..229b684 100644 --- a/src/gonganxitong/command.go +++ b/src/gonganxitong/command.go @@ -9,15 +9,15 @@ import ( type command struct { Table - update string `name:"update service_uid icon name index"` + modify string `name:"modify service_uid icon name index"` } -func (s command) Update(m *ice.Message, arg ...string) { +func (s command) Modify(m *ice.Message, arg ...string) { uid := kit.Hashs(m.Option(model.SERVICE_UID), m.Option(model.INDEX)) - if s.Table.Select(m.Spawn(), model.UID, uid).Length() == 0 { - s.Table.Create(m, kit.Simple(model.UID, uid, m.OptionSimple(model.SERVICE_UID, model.INDEX))...) + if s.Select(m.Spawn(), model.UID, uid).Length() == 0 { + s.Insert(m, kit.Simple(model.UID, uid, m.OptionSimple(model.SERVICE_UID, model.INDEX))...) } - s.Table.Update(m, kit.Dict(arg), model.UID, uid) + s.Update(m, kit.Dict(arg), model.UID, uid) m.SetResult().Echo(uid) } diff --git a/src/gonganxitong/comment.go b/src/gonganxitong/comment.go index f56aa72..1e51ccb 100644 --- a/src/gonganxitong/comment.go +++ b/src/gonganxitong/comment.go @@ -9,7 +9,7 @@ import ( type comment struct{ Table } func (s comment) Create(m *ice.Message, arg ...string) { - s.Table.Create(m, append(arg, m.OptionSimple(model.MARKET_UID, model.USER_UID)...)...) + s.Insert(m, append(arg, m.OptionSimple(model.MARKET_UID, model.USER_UID)...)...) } func (s comment) List(m *ice.Message, arg ...string) { } diff --git a/src/gonganxitong/common.go b/src/gonganxitong/common.go index 1e03887..9a3a33f 100644 --- a/src/gonganxitong/common.go +++ b/src/gonganxitong/common.go @@ -41,8 +41,7 @@ type Table struct { checkRole string `name:"checkRole role"` inputs string `name:"inputs" role:"void"` list string `name:"list place_uid uid auto" role:"void"` - market string `name:"market domain_uid* title* content" role:"leader"` - marketInsert string `name:"market domain_uid* title* content" role:"leader"` + marketInsert string `name:"marketInsert domain_uid* title* content" role:"leader"` } func (s Table) LoadTrans(m *ice.Message, arg ...string) { @@ -62,10 +61,11 @@ func (s Table) Init(m *ice.Message, arg ...string) { } func (s Table) BeforeMigrate(m *ice.Message, arg ...string) { s.Table.BeforeMigrate(m, arg...) - kit.If(m.GetCommand().Icon, func() { Portal{}.Show(m) }) + // kit.If(m.GetCommand().Icon, func() { Portal{}.Show(m) }) } func (s Table) AfterMigrate(m *ice.Message, arg ...string) { kit.If(m.GetCommand().Icon, func() { Portal{}.Show(m) }) + s.Table.AfterMigrate(m, arg...) } func (s Table) Inputs(m *ice.Message, arg ...string) { switch arg[0] { @@ -109,18 +109,8 @@ func (s Table) InputsListRole(m *ice.Message, list ice.Any, arg ...string) { } m.SortInt(arg[0]).DisplayInputKeyNameIconTitle() } -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.TARGET, m.CommandKey()).Set(ice.MSG_OPTION, db.TARGET) + defer m.Options(db.TARGET, kit.Select(m.CommandKey(), m.Config(db.MODELS))).Set(ice.MSG_OPTION, db.TARGET) defer m.Options(db.MODEL, m.Configv(db.MODEL)).Set(ice.MSG_OPTION, db.MODEL) defer m.Options(db.DB, m.Configv(db.DB)).Set(ice.MSG_OPTION, db.DB) return m.Cmdy(m.Prefix(web.PORTAL), action, arg) @@ -128,6 +118,7 @@ func (s Table) ValueModel(m *ice.Message, action ice.Any, arg ...string) *ice.Me func (s Table) ValueCreate(m *ice.Message, arg ...string) { s.ValueModel(m, s.ValueCreate, arg...) s.RecordEventWithName(m, "") + s.UserPlaceInit(m) } func (s Table) ValueRemove(m *ice.Message, arg ...string) { s.ValueModel(m, s.ValueRemove, arg...) @@ -138,45 +129,49 @@ func (s Table) ValueModify(m *ice.Message, arg ...string) { s.RecordEventWithName(m, "") } func (s Table) ValueList(m *ice.Message, arg []string, fields ...ice.Any) *ice.Message { + defer s.SelectJoinUser(m) if len(arg) > 0 { - kit.If(len(fields) == 0, func() { fields = kit.TransArgs(kit.Split(m.Config(mdb.FIELDS))) }) + 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) - s.ValueModel(m, s.ValueList, arg...).PushAction(s.Remove) - if len(arg) == 1 { - m.Action(s.Create) - } - if len(arg) > 0 { + if s.ValueModel(m, s.ValueList, arg...); len(arg) > 0 { kit.If(m.Length() > 0, func() { s.UserPlaceInit(m) }) s.Button(m, "") } return m } +func (s Table) Create(m *ice.Message, arg ...string) { s.ValueCreate(m, arg...) } +func (s Table) Remove(m *ice.Message, arg ...string) { s.ValueRemove(m, arg...) } +func (s Table) Modify(m *ice.Message, arg ...string) { s.ValueModify(m, arg...) } func (s Table) List(m *ice.Message, arg ...string) *ice.Message { - if m.IsTech() { - if len(arg) == 0 { - s.Select(m) - } else if len(arg) == 2 { - s.SelectDetail(m, model.UID, arg[1]) + return s.ValueList(m, arg) +} +func (s Table) FieldsDefault(m *ice.Message, arg ...string) *ice.Message { + if m.Option(mdb.SELECT) == "" { + if fields := m.Config(mdb.FIELDS); fields != "" { + s.Table.FieldsWithCreatedAT(m, m.CommandKey(), kit.TransArgs(kit.Split(fields, ",", ","))...) } } return m } func (s Table) Select(m *ice.Message, arg ...string) *ice.Message { + s.FieldsDefault(m) s.Table.Select(m, arg...) kit.If(m.Length() > 0, func() { s.UserPlaceInit(m) }) return m } func (s Table) SelectDetail(m *ice.Message, arg ...string) *ice.Message { - return s.Table.SelectDetail(m, arg...) + s.FieldsDefault(m) + s.Table.SelectDetail(m, arg...) + return m } 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) SelectJoinCity(m *ice.Message, arg ...string) *ice.Message { + kit.If(len(arg) == 0, func() { arg = append(arg, model.NAME) }) + return s.SelectJoin(m, city{}, arg...) } func (s Table) SelectJoinAuth(m *ice.Message) *ice.Message { defer m.Options(ice.MSG_USERROLE, aaa.VOID) @@ -209,25 +204,6 @@ 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 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)), - "AND", s.Key(userPlace, model.DELETED_AT), "IS NULL", - )).FieldsWithCreatedAT(m, target, append([]ice.Any{s.Key(target, model.USER_UID), s.AS(s.Key(userPlace, model.ROLE), s.Keys(userPlace, model.ROLE))}, fields...)...) - if len(arg) == 1 { - s.Table.Select(m, s.Key(target, s.Keys(place, model.UID)), arg[0]) - } else if len(arg) == 2 { - s.Table.SelectDetail(m, s.Key(target, s.Keys(place, model.UID)), arg[0], s.Key(target, model.UID), arg[1]) - } else { - return 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) s.Table.Update(m, data, arg...) @@ -245,6 +221,13 @@ func (s Table) ChangeStatus(m *ice.Message, place_uid, uid string, from, to int, func (s Table) CheckRole(m *ice.Message, arg ...string) { role := UserPlaceRole(s.UserPlaceRole(m)) m.WarnNotRight(!kit.IsIn(role.String(), append(arg, UserPlaceCreator.String())...), role.String()) + m.Option(model.USER_ROLE, kit.Format(role)) +} +func (s Table) IsLeader(m *ice.Message) bool { + if role := kit.Int(m.Option(model.USER_ROLE)); role == 1 || role == 2 { + return true + } + return false } func (s Table) UserPlaceRole(m *ice.Message) int { return kit.Int(m.Cmdx(s.Prefix(m, Portal{}), s.UserPlaceRole)) @@ -255,17 +238,6 @@ func (s Table) UserPlaceInit(m *ice.Message, arg ...string) { } m.Cmd(s.Prefix(m, Portal{}), "placeCmd", "addCount", model.INIT, 1, m.Option(model.PLACE_UID), m.Option(model.PLACE_INIT)) } -func (s Table) Market(m *ice.Message, arg ...string) { - s.MarketInsert(m, arg...) -} -func (s Table) MarketInsert(m *ice.Message, arg ...string) { - m.Cmdy(s.Prefix(m, Portal{}), s.MarketInsert, arg) -} -func (s Portal) MarketInsert(m *ice.Message, arg ...string) { - m.Option(model.PLACE_UID, m.Option(s.Keys(s.Place, model.UID))) - m.Option(ctx.ARGS, kit.Join([]string{m.Option(model.PLACE_UID), m.Option(model.UID)})) - m.Cmdy(s.Prefix(m, market{}), s.Create, arg) -} func (s Table) DashboardUpdate(m *ice.Message, arg ...string) { if m.IsErr() { return @@ -289,6 +261,14 @@ 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) MarketInsert(m *ice.Message, arg ...string) { + m.Cmdy(s.Prefix(m, Portal{}), s.MarketInsert, arg) +} +func (s Portal) MarketInsert(m *ice.Message, arg ...string) { + m.Option(model.PLACE_UID, m.Option(s.Keys(s.Place, model.UID))) + m.Option(ctx.ARGS, kit.Join([]string{m.Option(model.PLACE_UID), m.Option(model.UID)})) + m.Cmdy(s.Prefix(m, market{}), s.Create, arg) +} func (s Table) GetCommandUID(m *ice.Message) { m.Options(m.Cmd(s.Prefix(m, Portal{}), Portal{}.SelectCommand, m.PrefixKey()).AppendSimple(model.COMMAND_UID)) } @@ -320,7 +300,7 @@ func (s Table) SendTemplate(m *ice.Message, from, to, title string, arg ...strin func (s Portal) SendTemplate(m *ice.Message, arg ...string) { name := kit.Select("", arg, 4) if name == "" { - name = kit.JoinWord(m.Option(model.CITY_NAME), m.Option(model.STREET_NAME), m.Option(s.Keys(s.Place, model.NAME))) + name = kit.JoinWord(m.Option(model.CITY_NAME), m.Option(model.STREET_NAME), kit.Select(m.Option(model.PLACE_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)) }) @@ -328,10 +308,7 @@ func (s Portal) SendTemplate(m *ice.Message, arg ...string) { 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) Button(m *ice.Message, info string, arg ...ice.Any) *ice.Message { - kit.If(!m.IsErr() && m.Length() == 0, func() { - m.Option(ctx.STYLE, html.FORM) - m.EchoInfoButton(info, arg...) - }) + kit.If(!m.IsErr() && m.Length() == 0, func() { m.Options(ctx.STYLE, html.FORM).EchoInfoButton(info, arg...) }) return m } func (s Table) DisplayBase(m *ice.Message, file string) *ice.Message { @@ -385,6 +362,7 @@ func (s Table) PrefixPortal(m *ice.Message) string { } func (s Table) ProcessPodCmd(m, msg *ice.Message, arg ...string) *ice.Message { m.ProcessPodCmd(msg.Append(web.SPACE), msg.Append(ctx.INDEX), kit.Split(msg.Append(ctx.ARGS))) + m.Push("field.option", kit.Format(kit.Dict(arg))) m.RewriteAppend(func(value, key string, index int) string { kit.If(key == ctx.STYLE, func() { value = html.OUTPUT }) kit.If(key == web.SPACE, func() { value = m.Appendv("_space")[index] }) @@ -393,8 +371,6 @@ func (s Table) ProcessPodCmd(m, msg *ice.Message, arg ...string) *ice.Message { if msg.Append(web.SPACE) != "" { m.Optionv(ice.FIELD_PREFIX, ctx.ACTION, ctx.RUN, kit.Join(kit.Slice(kit.Split(msg.Append(ctx.INDEX), "."), 0, -1), ".")+".portal", ctx.ACTION, ctx.RUN, msg.Append(ctx.INDEX)) } - m.Push("field.option", kit.Format(kit.Dict(arg))) - m.Option("field.option", kit.Format(kit.Dict(arg))) return m } func (s Table) SpaceCmd(m *ice.Message, space string, arg ...ice.Any) *ice.Message { diff --git a/src/gonganxitong/common.js b/src/gonganxitong/common.js index d62aaaf..a30de60 100644 --- a/src/gonganxitong/common.js +++ b/src/gonganxitong/common.js @@ -5,7 +5,7 @@ Volcanos(chat.ONIMPORT, { can.onimport.myView(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.STATUS, list: [value.city_name, value.street_name, value.company_name||value.place_name]}, - {view: html.STATUS, list: [value.uid && value.uid.slice(0, 6), can.base.TimeTrim(value.created_at||value.updated_at)]}, + {view: html.STATUS, list: [value.uid && value.uid.slice(0, 6), can.onimport.timeView(can, value), value.user_name]}, value.address && {view: html.STATUS, list: [value.address]}, value.content && {view: html.OUTPUT, list: [value.content]}, value.info && {view: html.OUTPUT, list: [value.info]}, diff --git a/src/gonganxitong/domain.go b/src/gonganxitong/domain.go index 22b13ea..5a7f98f 100644 --- a/src/gonganxitong/domain.go +++ b/src/gonganxitong/domain.go @@ -12,15 +12,18 @@ type domain struct { remove string `name:"remove" role:"void"` } +func (s domain) Create(m *ice.Message, arg ...string) { s.Insert(m, arg...) } +func (s domain) Remove(m *ice.Message, arg ...string) { s.Delete(m, arg...) } func (s domain) List(m *ice.Message, arg ...string) { + s.Fields(m, model.UID, model.NAME) if len(arg) == 0 { - s.Fields(m, s.AS(s.Key(s, model.UID), model.DOMAIN_UID), model.NAME) - s.Select(m) + s.Select(m).RenameAppend(model.UID, model.DOMAIN_UID) } else if len(arg) == 1 { s.Select(m) } else if len(arg) == 2 { s.Select(m, model.UID, arg[1]) } + m.PushAction(s.Remove) } -func init() { ice.TeamCtxCmd(domain{Table: newTable()}) } +func init() { ice.TeamCtxCmd(domain{}) } diff --git a/src/gonganxitong/event.go b/src/gonganxitong/event.go index 06e591c..b55a811 100644 --- a/src/gonganxitong/event.go +++ b/src/gonganxitong/event.go @@ -18,10 +18,9 @@ type event struct { } func (s event) List(m *ice.Message, arg ...string) { - s.Tables(m, s.user, s.command, s.service).FieldsWithCreatedAT(m, s, - model.USER_AVATAR, model.USER_NAME, model.INFO, + s.Tables(m, s.user, s.command, s.service).FieldsWithCreatedAT(m, s, model.INFO, s.Key(s, model.CITY_NAME), s.Key(s, model.STREET_NAME), s.Key(s, model.PLACE_NAME), - model.SERVICE_NAME, + model.USER_NAME, model.USER_AVATAR, ) if len(arg) == 1 { s.Select(m, model.PLACE_UID, arg[0]).Action() @@ -36,6 +35,6 @@ func (s event) List(m *ice.Message, arg ...string) { func init() { ice.TeamCtxCmd(event{Table: newTable()}) } func (s event) Record(m *ice.Message, info string, arg ...string) { - m.Cmd(s.Prefix(m, s), s.Create, m.OptionSimple(model.COMMAND_UID, model.PLACE_UID, model.USER_UID), model.INFO, info, + m.Cmd(s.Prefix(m, s), s.Insert, m.OptionSimple(model.COMMAND_UID, model.PLACE_UID, model.USER_UID), model.INFO, info, m.OptionSimple(model.CITY_NAME, model.STREET_NAME, model.PLACE_NAME), model.OPERATE, m.ActionKey(), ctx.ARGS, kit.Join(arg, ",")) } diff --git a/src/gonganxitong/event.js b/src/gonganxitong/event.js index 874d376..6fc8db2 100644 --- a/src/gonganxitong/event.js +++ b/src/gonganxitong/event.js @@ -2,7 +2,6 @@ Volcanos(chat.ONIMPORT, { _init: function(can, msg) { can.onimport.myView(can, msg, function(value) { return [ {view: html.TITLE, list: [value.user_name, can.onimport.timeView(can, value)]}, - // {view: html.STATUS, list: [value.city_name, value.street_name, value.service_name]}, {view: html.OUTPUT, list: [value.info]}, ] }) }, diff --git a/src/gonganxitong/market.go b/src/gonganxitong/market.go index c5105f4..7dc7315 100644 --- a/src/gonganxitong/market.go +++ b/src/gonganxitong/market.go @@ -19,28 +19,25 @@ type market struct { create string `name:"create domain_uid* title* content" role:"void"` remove string `name:"remove" role:"void"` thumbToggle string `name:"thumbToggle" role:"void"` - commentCreate string `name:"commentCreate content" role:"void"` + commentCreate string `name:"commentCreate content*" role:"void"` favorToggle string `name:"favorToggle" role:"void"` shareCreate string `name:"shareCreate" role:"void"` } func (s market) Create(m *ice.Message, arg ...string) { - defer m.ToastProcess()() - s.Table.Create(m, append(arg, m.OptionSimple( + s.Insert(m, append(arg, m.OptionSimple( model.CITY_NAME, model.STREET_NAME, model.PLACE_NAME, - model.COMMAND_UID, model.PLACE_UID, model.USER_UID, model.ARGS, + model.ARGS, model.COMMAND_UID, model.PLACE_UID, model.USER_UID, )...)...) } func (s market) List(m *ice.Message, arg ...string) { s.Tables(m, s.domain, s.command, s.service, kit.Format("LEFT JOIN thumbs ON thumbs.market_uid = markets.uid AND thumbs.user_uid = '%s'", m.Option(model.USER_UID)), kit.Format("LEFT JOIN favors ON favors.market_uid = favors.uid AND favors.user_uid = '%s'", m.Option(model.USER_UID)), - ).FieldsWithCreatedAT(m, s, - s.Key(s, model.USER_UID), model.TITLE, model.CONTENT, + ).FieldsWithCreatedAT(m, s, s.Key(s, model.USER_UID), model.TITLE, model.CONTENT, s.Key(s, model.CITY_NAME), s.Key(s, model.STREET_NAME), s.Key(s, model.PLACE_NAME), model.SERVICE_NAME, + model.THUMB_STATUS, model.FAVOR_STATUS, model.THUMB_COUNT, model.COMMENT_COUNT, model.FAVOR_COUNT, model.SHARE_COUNT, s.AS(model.NODENAME, model.SPACE), s.Key(s.command, model.INDEX), model.ARGS, - model.THUMB_COUNT, model.COMMENT_COUNT, model.FAVOR_COUNT, model.SHARE_COUNT, - model.THUMB_STATUS, model.FAVOR_STATUS, ) if len(arg) < 2 { if m.Option(model.DOMAIN_UID) != "" { @@ -48,6 +45,7 @@ func (s market) List(m *ice.Message, arg ...string) { } else { s.Select(m) } + m.Action() } else if len(arg) == 2 { msg := s.Select(m.Spawn(), s.Key(s, model.UID), arg[1]) s.ProcessPodCmd(m, msg, model.MARKET_UID, arg[1]) @@ -56,31 +54,31 @@ func (s market) List(m *ice.Message, arg ...string) { } s.SelectJoinUser(m, model.NAME, model.AVATAR, model.AUTH_UID) s.SelectJoinAuth(m) - m.Action().Display("") + s.Display(m, "") } func (s market) ThumbToggle(m *ice.Message, arg ...string) { m.OptionDefault(model.MARKET_UID, m.Option(model.UID)) if kit.Int(m.Cmdx(s.thumb, s.thumb.Toggle))%2 == 1 { - s.AddCount(m, model.THUMB_COUNT, "1", m.Option(model.UID)) + s.AddCount(m, model.THUMB_COUNT, "1") } else { - s.AddCount(m, model.THUMB_COUNT, "-1", m.Option(model.UID)) + s.AddCount(m, model.THUMB_COUNT, "-1") } } func (s market) CommentCreate(m *ice.Message, arg ...string) { m.OptionDefault(model.MARKET_UID, m.Option(model.UID)) - m.Cmd(s.comment, s.Create, arg) - s.AddCount(m, model.COMMENT_COUNT, "1", m.Option(model.UID)) + m.Cmd(s.comment, s.Insert, arg) + s.AddCount(m, model.COMMENT_COUNT, "1") } func (s market) FavorToggle(m *ice.Message, arg ...string) { m.OptionDefault(model.MARKET_UID, m.Option(model.UID)) if kit.Int(m.Cmdx(s.favor, s.favor.Toggle))%2 == 1 { - s.AddCount(m, model.FAVOR_COUNT, "1", m.Option(model.UID)) + s.AddCount(m, model.FAVOR_COUNT, "1") } else { - s.AddCount(m, model.FAVOR_COUNT, "-1", m.Option(model.UID)) + s.AddCount(m, model.FAVOR_COUNT, "-1") } } func (s market) ShareCreate(m *ice.Message, arg ...string) { - s.AddCount(m, model.SHARE_COUNT, "1", m.Option(model.UID)) + s.AddCount(m, model.SHARE_COUNT, "1") } func init() { ice.TeamCtxCmd(market{Table: newTable()}) } diff --git a/src/gonganxitong/market.js b/src/gonganxitong/market.js index 029564e..d2b970e 100644 --- a/src/gonganxitong/market.js +++ b/src/gonganxitong/market.js @@ -1,21 +1,15 @@ Volcanos(chat.ONIMPORT, { _init: function(can, msg) { can.ui = can.page.Append(can, can._output, [html.TABS, html.LIST]) - can.run({}, [ctx.ACTION, ctx.RUN, "web.team.gonganxitong.domain"], function(msg) { - var domain_uid = can.misc.Cookie(can, "domain_uid") - can.page.Append(can, can.ui.tabs, [{view: [[html.ITEM, domain_uid? "": html.SELECT], "", "全部"], onclick: function(event) { - can.misc.Cookie(can, "domain_uid", "") - can.onmotion.select(can, can.ui.tabs, html.DIV_ITEM, event.target) - can.run(event, [], function(msg) { can.onimport._data(can, msg) }) + can.runAction({}, ctx.RUN, ["web.team.gonganxitong.domain"], function(msg) { var domain_uid = can.misc.Cookie(can, "domain_uid") + can.page.Append(can, can.ui.tabs, [{view: [[html.ITEM, domain_uid? "": html.SELECT], "", "全部"], onclick: function(event) { can.misc.Cookie(can, "domain_uid", "") + can.onmotion.select(can, can.ui.tabs, html.DIV_ITEM, event.target), can.run(event, [], function(msg) { can.onimport._data(can, msg) }) }}]) can.page.Append(can, can.ui.tabs, msg.Table(function(value) { - return {view: [[html.ITEM, value.uid == domain_uid? html.SELECT: ""], "", value.name], onclick: function(event) { - can.misc.Cookie(can, "domain_uid", value.uid) - can.onmotion.select(can, can.ui.tabs, html.DIV_ITEM, event.target) - can.run(event, [], function(msg) { can.onimport._data(can, msg) }) + return {view: [[html.ITEM, value.uid == domain_uid? html.SELECT: ""], "", value.name], onclick: function(event) { can.misc.Cookie(can, "domain_uid", value.uid) + can.onmotion.select(can, can.ui.tabs, html.DIV_ITEM, event.target), can.run(event, [], function(msg) { can.onimport._data(can, msg) }) }} })) - }) - can.onimport._data(can, msg) + }), can.onimport._data(can, msg) }, _data: function(can, msg) { can.onmotion.clear(can, can.ui.list) can.onimport.itemcards(can, msg, function(value) { return [ @@ -26,7 +20,6 @@ Volcanos(chat.ONIMPORT, { can.onimport.authView(can, value), can.onimport.timeView(can, value), ]}, {view: html.STATUS, list: [ - // {text: [value.city_name, "", "street"]}, {text: [value.service_name.split(" ")[0], "", "service"]}, {text: [value.place_name, "", "place"]}, {text: ["@"+value.street_name, "", "street"]}, @@ -47,11 +40,11 @@ Volcanos(chat.ONIMPORT, { can.onimport.thumbs(event, can, value, "shareCreate") }}, ]}, - ] }, null, can.ui.list) + ] }) }, thumbs: function(event, can, value, button) { can.onkeymap.prevent(event) var target = can.page.SelectOne(can, event.currentTarget, html.SPAN) - can.run(can.request(event, value), [ctx.ACTION, button], function(msg) { target.innerHTML = msg.Result() }) + can.runAction(can.request(event, value), button, [], function(msg) { target.innerHTML = msg.Result() }) }, layout: function(can) { can.ui.list && can.page.styleHeight(can, can.ui.list, can.ConfHeight()-can.ui.tabs.offsetHeight) diff --git a/src/gonganxitong/member.go b/src/gonganxitong/member.go index 4754fb4..6deff54 100644 --- a/src/gonganxitong/member.go +++ b/src/gonganxitong/member.go @@ -13,7 +13,7 @@ type member struct { } func (s member) List(m *ice.Message, arg ...string) { - s.Table.FieldsWithCreatedAT(m, s.UserPlace, model.USER_UID, s.Keys(s.UserPlace, model.ROLE)) + s.FieldsWithCreatedAT(m, s.UserPlace, model.USER_UID, s.Keys(s.UserPlace, model.ROLE)) if len(arg) == 1 { m.Cmdy(s.UserPlace, s.Select, s.Keys(s.Place, model.UID), arg[0]).Action() } else if len(arg) == 2 { @@ -21,7 +21,7 @@ func (s member) List(m *ice.Message, arg ...string) { } else { return } - s.SelectJoinUser(m, model.AVATAR, model.NAME, model.AUTH_UID) + s.SelectJoinUser(m, model.NAME, model.AVATAR, model.AUTH_UID) s.SelectJoinAuth(m) s.Display(m, "") } diff --git a/src/gonganxitong/member.js b/src/gonganxitong/member.js index 5c8bfed..d8c59da 100644 --- a/src/gonganxitong/member.js +++ b/src/gonganxitong/member.js @@ -1,10 +1,8 @@ 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") + _init: function(can, msg) { var USER_PLACE_ROLE = msg.Option("_user_place_role") can.onimport.myView(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: html.STATUS, list: [value.uid.slice(0, 6), can.onimport.timeView(can, value)]}, ] }) }, }) \ No newline at end of file diff --git a/src/gonganxitong/message.go b/src/gonganxitong/message.go index 1b835a8..5e6e3a5 100644 --- a/src/gonganxitong/message.go +++ b/src/gonganxitong/message.go @@ -24,7 +24,10 @@ func (s message) Create(m *ice.Message, arg ...string) { kit.If(m.Option(ctx.ARGS) == "", func() { arg = append(arg, ctx.ARGS, kit.JoinFields(m.Option(s.Keys(s.Place, model.UID)), m.Option(model.UID))) }) - s.Table.Create(m, arg...) + s.Insert(m, arg...) +} +func (s message) Remove(m *ice.Message, arg ...string) { + s.Delete(m, arg...) } func (s message) List(m *ice.Message, arg ...string) { s.Tables(m, s.command, s.service).FieldsWithCreatedAT(m, s, diff --git a/src/gonganxitong/message.js b/src/gonganxitong/message.js index 3a915b5..83d6382 100644 --- a/src/gonganxitong/message.js +++ b/src/gonganxitong/message.js @@ -9,7 +9,7 @@ Volcanos(chat.ONIMPORT, { value.message_status != "done" && can.onimport.textView(can, value, MESSAGE_STATUS) ]}, {view: html.STATUS, list: [value.city_name, value.street_name, value.service_name]}, - {view: html.STATUS, list: [can.base.TimeTrim(value.created_at), value.user_name]}, + {view: html.STATUS, list: [can.onimport.timeView(can, value), value.user_name]}, value.info && {view: html.OUTPUT, list: [value.info]}, ] }) diff --git a/src/gonganxitong/model/model.go b/src/gonganxitong/model/model.go index f993b9b..00cc4a9 100644 --- a/src/gonganxitong/model/model.go +++ b/src/gonganxitong/model/model.go @@ -20,6 +20,7 @@ const ( UPDATED_AT = "updated_at" DELETED_AT = "deleted_at" USER_UID = "user_uid" + USER_ROLE = "user_role" USER_NAME = "user_name" USER_AVATAR = "user_avatar" USER_PLACE_ROLE = "user_place_role" @@ -48,11 +49,11 @@ const ( MARKET_UID = "market_uid" DOMAIN_UID = "domain_uid" DOMAIN_NAME = "domain_name" + PORTAL_NAME = "portal_name" DETAIL_NAME = "detail_name" COMMAND_UID = "command_uid" COMMAND_ICON = "command_icon" COMMAND_NAME = "command_name" - PORTAL_NAME = "portal_name" MESSAGE_UID = "message_uid" MESSAGE_STATUS = "message_status" SERVICE_UID = "service_uid" @@ -153,8 +154,8 @@ type Domain struct { } type Market struct { db.ModelCommand - DomainUID string `gorm:"type:char(32);index"` CommandUID string `gorm:"type:char(32)"` + DomainUID string `gorm:"type:char(32);index"` PlaceUID string `gorm:"type:char(32)"` UserUID string `gorm:"type:char(32)"` Title string `gorm:"type:varchar(64)"` diff --git a/src/gonganxitong/notice.go b/src/gonganxitong/notice.go index f53f6bf..6ad3e0a 100644 --- a/src/gonganxitong/notice.go +++ b/src/gonganxitong/notice.go @@ -2,6 +2,7 @@ package gonganxitong import ( "shylinux.com/x/ice" + "shylinux.com/x/icebergs/base/mdb" kit "shylinux.com/x/toolkits" "shylinux.com/x/community/src/gonganxitong/model" @@ -10,6 +11,7 @@ import ( type notice struct { Table order string `data:"95"` + fields string `data:"title,content,user_uid"` create string `name:"create title* content*" role:"landlord,teacher,leader"` remove string `name:"remove" role:"landlord,teacher,leader"` } @@ -19,15 +21,17 @@ func (s notice) Init(m *ice.Message, arg ...string) { m.Design(s.List, "", kit.JoinWord(s.Keys(s.Place, model.UID), model.UID, ice.AUTO)) } func (s notice) Create(m *ice.Message, arg ...string) { - s.Table.Create(m, kit.Simple(arg, model.PLACE_UID, m.Option(s.Keys(s.Place, model.UID)), m.OptionSimple(model.USER_UID))...) + m.Option(model.PLACE_UID, m.Option(s.Keys(s.Place, model.UID))) + s.Insert(m, kit.Simple(arg, m.OptionSimple(model.PLACE_UID, model.USER_UID))...) s.RecordEventWithName(m, "") } func (s notice) Remove(m *ice.Message, arg ...string) { - s.Table.Remove(m, kit.Simple(model.PLACE_UID, m.Option(s.Keys(s.Place, model.UID)), m.OptionSimple(model.UID))...) + m.Option(model.PLACE_UID, m.Option(s.Keys(s.Place, model.UID))) + s.Delete(m, m.OptionSimple(model.PLACE_UID, model.UID)...) s.RecordEventWithName(m, "") } func (s notice) List(m *ice.Message, arg ...string) { - s.FieldsWithCreatedAT(m, s, model.TITLE, model.CONTENT, model.USER_UID) + s.Table.FieldsWithCreatedAT(m, s, kit.TransArgs(kit.Split(m.Config(mdb.FIELDS), ",", ","))...) if len(arg) == 1 { s.Select(m, model.PLACE_UID, arg[0]) } else if len(arg) == 2 { diff --git a/src/gonganxitong/place.go b/src/gonganxitong/place.go index afb0899..a0a2885 100644 --- a/src/gonganxitong/place.go +++ b/src/gonganxitong/place.go @@ -10,10 +10,9 @@ type PlaceType int const ( PlaceHouse PlaceType = iota - PlaceHotel PlaceStore - PlaceSchool PlaceOffice + PlaceSchool PlacePublic PlaceFactory PlaceHospital @@ -21,10 +20,9 @@ const ( var PlaceTypeList = map[PlaceType]string{ PlaceHouse: "house", - PlaceHotel: "hotel", PlaceStore: "store", - PlaceSchool: "school", PlaceOffice: "office", + PlaceSchool: "school", PlacePublic: "public", PlaceFactory: "factory", PlaceHospital: "hospital", diff --git a/src/gonganxitong/portal.css b/src/gonganxitong/portal.css index 6321b29..d155e03 100644 --- a/src/gonganxitong/portal.css +++ b/src/gonganxitong/portal.css @@ -52,9 +52,9 @@ $action div.item.danger input[type=button] { border:var(--box-danger); color:var $output input.notice[type=button] { background-color:var(--notice-bg-color); color:var(--notice-fg-color); } $output input.danger[type=button] { border:var(--box-danger); color:var(--danger-bg-color); } $output input[type=button][name=submit] { background-color:var(--notice-bg-color); color:var(--notice-fg-color); } -$output span.type { border:var(--box-notice); color:var(--notice-bg-color); padding:0 3px; } -$output span.role { border:var(--box-notice); color:var(--notice-bg-color); padding:0 3px; } -$output span.level { border:var(--box-notice); color:var(--notice-bg-color); padding:0 3px; font-size:12px; } +$output span.type { border:var(--box-notice); color:var(--notice-bg-color); padding:0 3px; white-space:pre; } +$output span.role { border:var(--box-notice); color:var(--notice-bg-color); padding:0 3px; white-space:pre; } +$output span.level { border:var(--box-notice); color:var(--notice-bg-color); padding:0 3px; font-size:12px; white-space:pre; } $output span.type.danger { border:var(--box-danger); color:var(--danger-bg-color); } $output span.role.danger { border:var(--box-danger); color:var(--danger-bg-color); } $output span.level.danger { border:var(--box-danger); color:var(--danger-bg-color); } diff --git a/src/gonganxitong/portal.go b/src/gonganxitong/portal.go index d89889c..de3092c 100644 --- a/src/gonganxitong/portal.go +++ b/src/gonganxitong/portal.go @@ -28,7 +28,7 @@ type Portal struct { create string `name:"create index name icons"` command string `name:"command" role:"void"` list string `name:"list place_uid index uid auto" role:"void"` - placeCreate string `name:"placeCreate city_name* street_name* place_type*:select place_name* address*" icon:"bi bi-plus-square-dotted" role:"void"` + placeCreate string `name:"placeCreate city_name* street_name* place_name* place_type*:select address" icon:"bi bi-plus-square-dotted" role:"void"` placeRemove string `name:"placeRemove uid*" role:"void"` placeAuth string `name:"placeAuth" role:"void"` placeSearch string `name:"placeSearch" icon:"bi bi-search" role:"void"` @@ -41,15 +41,7 @@ func (s Portal) Init(m *ice.Message, arg ...string) { s.Hash.Init(m, arg...) } func (s Portal) Exit(m *ice.Message, arg ...string) { - mdb.HashSelectUpdate(m.Message, "", func(value ice.Map) { - delete(value, model.COMMAND_UID) - delete(value, mdb.TARGET) - if value[mdb.ENABLE] == ice.TRUE { - delete(value, mdb.ENABLE) - } - delete(value, mdb.ICONS) - delete(value, mdb.NAME) - }) + mdb.HashSelectUpdate(m.Message, "", func(value ice.Map) { delete(value, model.COMMAND_UID); delete(value, mdb.TARGET) }) s.Hash.Exit(m, arg...) } func (s Portal) BeforeMigrate(m *ice.Message, arg ...string) { @@ -83,6 +75,7 @@ func (s Portal) Run(m *ice.Message, arg ...string) { } } if kit.IsIn(role, "", aaa.VOID, aaa.TECH, aaa.ROOT) { + m.Option(model.USER_ROLE, s.UserPlaceRole(m.Spawn()).Result()) kit.If(!ctx.PodCmd(m.Message, arg) && aaa.Right(m.Message, arg), func() { m.Cmdy(arg) }) } else { if !m.Cmdy(arg[0], s.CheckRole, kit.Split(role)).IsErr() { @@ -115,10 +108,10 @@ func (s Portal) List(m *ice.Message, arg ...string) { default: m.PushButton(s.PlaceRemove) } - }).Action(s.PlaceCreate, s.PlaceSearch) + }).Action(s.PlaceCreate) s.Button(m, "", s.PlaceCreate) } else { - if msg := s.PlaceListOption(m, arg...); arg[0] != "" { + if msg := s.PlaceListOption(m, arg...); arg[0] != "" && msg.Length() > 0 { defer s.AddRecent(msg, arg[0]) } s.Hash.List(m).SortInt(mdb.ORDER) @@ -130,6 +123,9 @@ func (s Portal) PlaceListOption(m *ice.Message, arg ...string) *ice.Message { msg := m.Cmd(m.PrefixKey(), s.PlaceList, m.Option(model.USER_UID), arg[0]) if msg.Length() == 0 { msg = m.Cmd(s.Place, s.Table.Select, model.UID, arg[0]) + if msg.Length() == 0 { + return msg + } msg.Push(s.Keys(s.UserPlace, model.ROLE), "0") msg.RenameAppend(model.NAME, s.Keys(s.Place, model.NAME), model.TYPE, s.Keys(s.Place, model.TYPE)) s.SelectJoin(msg, s.Street, model.NAME, model.CITY_UID) @@ -138,35 +134,31 @@ func (s Portal) PlaceListOption(m *ice.Message, arg ...string) *ice.Message { } s.Place.RewriteAppend(msg) m.Options(msg.AppendSimple( - s.Keys(s.Place, model.NAME), s.Keys(s.Place, model.TYPE), - s.Keys(s.UserPlace, model.ROLE), s.Keys(s.Street, model.NAME), model.CITY_NAME, - model.AUTH_STATUS, model.DASHBOARD_UID, + s.Keys(s.Place, model.NAME), s.Keys(s.Place, model.TYPE), s.Keys(s.UserPlace, model.ROLE), + model.CITY_NAME, s.Keys(s.Street, model.NAME), model.AUTH_STATUS, model.DASHBOARD_UID, )) m.Option(model.PLACE_NAME, msg.Append(s.Keys(s.Place, model.NAME))) m.Option(model.STREET_NAME, msg.Append(s.Keys(s.Street, model.NAME))) return msg } func (s Portal) PlaceCreate(m *ice.Message, arg ...string) { - defer m.ToastProcess()() if s.city.FindOrCreateByName(m, arg...); m.IsErr() { return } else if s.Street.FindOrCreateByName(m, arg...); m.IsErr() { return } name := m.Option(s.Keys(s.Place, model.NAME)) - arg = kit.TransArgKeys(arg, s.Keys(s.Place, model.TYPE), model.TYPE) - arg = kit.TransArgKeys(arg, s.Keys(s.Place, model.NAME), model.NAME) - if m.Cmdy(s.Place, s.Create, arg[2:]).IsErr() { + arg = kit.TransArgKeys(arg, s.Keys(s.Place, model.NAME), model.NAME, s.Keys(s.Place, model.TYPE), model.TYPE) + if m.Cmdy(s.Place, s.Insert, arg[2:]).IsErr() { return } s.RecordEventWithName(m.Options(mdb.NAME, name, s.Keys(s.Place, model.UID), m.Result()), "") args := kit.Simple(m.OptionSimple(s.Keys(s.Place, model.UID), model.USER_UID), model.ROLE, UserPlaceCreator) - m.SetResult().Cmdy(s.UserPlace, s.Create, args) + m.SetResult().Cmdy(s.UserPlace, s.Insert, args) args = append(args, s.Keys(s.UserPlace, model.UID), m.Result()) m.Options(args).Cmd("", s.AfterPlaceCreate, args) } func (s Portal) PlaceRemove(m *ice.Message, arg ...string) { - defer m.ToastProcess()() m.Cmd("", s.BeforePlaceRemove, m.OptionSimple(model.USER_UID, model.UID)) m.Cmdy(s.UserPlace, s.Delete, m.OptionSimple(model.USER_UID, model.UID)) } @@ -182,8 +174,7 @@ func (s Portal) PlaceList(m *ice.Message, arg ...string) *ice.Message { return m } m.Table(func(value ice.Maps) { - m.Push(model.SERVICE_ICON, ice.Info.NodeIcon) - m.Push(model.NODENAME, ice.Info.NodeName) + m.Push(model.SERVICE_ICON, ice.Info.NodeIcon).Push(model.NODENAME, ice.Info.NodeName) }) s.SelectJoin(m, s.Street, model.NAME, model.CITY_UID) s.SelectJoinCity(m) @@ -195,7 +186,7 @@ func (s Portal) PlaceAuth(m *ice.Message, arg ...string) { place_uid := m.Option(s.Keys(s.Place, model.UID)) place_name := m.Option(s.Keys(s.Place, model.NAME)) m.Option(model.COMPANY_NAME, m.Option(s.Keys(s.Street, model.NAME))) - msg := m.Cmd(s.FindSpaceCmd(m, "web.team.renzhengshouquan.portal"), "placeCreate", m.OptionSimple(model.CITY_NAME, model.COMPANY_NAME), + msg := m.Cmd(s.FindSpaceCmd(m, "web.team.renzhengshouquan.portal"), s.PlaceCreate, m.OptionSimple(model.CITY_NAME, model.COMPANY_NAME), model.AUTH_TYPE, ice.AUTO, model.AUTH_NAME, place_name, model.FROM_UID, ice.AUTO) if msg.IsErr() { m.Copy(msg) @@ -212,13 +203,12 @@ func (s Portal) PlaceSearch(m *ice.Message, arg ...string) { m.ProcessRewrite(model.INDEX, s.Prefix(m, search{})) } func (s Portal) ScanQRCode(m *ice.Message, arg ...string) { - defer m.ToastProcess()() if m.Option(mdb.TYPE) == mdb.TEXT { - m.Cmdy(s.UserPlace, s.Create, s.Key(s.Place, model.UID), m.Option(mdb.TEXT), m.OptionSimple(model.USER_UID), model.ROLE, UserPlaceVisitor) + m.Cmdy(s.UserPlace, s.Insert, s.Key(s.Place, model.UID), m.Option(mdb.TEXT), m.OptionSimple(model.USER_UID), model.ROLE, UserPlaceVisitor) } else if m.Option(mdb.TYPE) == web.LINK { args := m.ParseURL(m.Option(mdb.TEXT)) if len(args) > 1 && args[1] == s.Prefix(m, apply{}) { - m.Cmdy(s.UserPlace, s.Create, s.Keys(s.Place, model.UID), args[0], m.OptionSimple(model.USER_UID), model.ROLE, UserPlaceVisitor) + m.Cmdy(s.UserPlace, s.Insert, s.Keys(s.Place, model.UID), args[0], m.OptionSimple(model.USER_UID), model.ROLE, UserPlaceVisitor) } } } @@ -239,7 +229,7 @@ func (s Portal) ValueCreate(m *ice.Message, arg ...string) { 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.Create(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) { s.Table.Delete(m, m.OptionSimple(s.Keys(s.Place, model.UID), model.UID)...) @@ -248,7 +238,6 @@ 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)...) PLACE_UID := s.Keys(s.Place, model.UID) if len(arg) == 0 { if m.Option(PLACE_UID) != "" { @@ -256,9 +245,9 @@ func (s Portal) ValueList(m *ice.Message, arg ...string) { } return } - s.Table.FieldsWithCreatedAT(m, m.Option("target"), m.Optionv(mdb.FIELDS).([]ice.Any)...) + s.Table.FieldsWithCreatedAT(m, m.Option(db.TARGET), m.Optionv(mdb.FIELDS).([]ice.Any)...) if len(arg) == 1 { - s.Table.Select(m, PLACE_UID, arg[0]) + s.Table.Select(m, PLACE_UID, arg[0]).Action(s.Create) } else if len(arg) == 2 { s.Table.SelectDetail(m, PLACE_UID, arg[0], model.UID, arg[1]) } else { @@ -281,7 +270,7 @@ func (s Portal) DashboardCreate(m *ice.Message, name string, arg ...string) *ice } func (s Portal) DashboardInsert(m *ice.Message, score, title string, index ice.Any, field string, arg ...ice.Any) *ice.Message { kit.If(len(arg) == 0, func() { arg = append(arg, s.Keys(s.Place, model.UID), m.Option(s.Keys(s.Place, model.UID))) }) - return m.Cmd(s.FindSpaceCmd(m, "web.team.dashboard.summary"), s.Create, + return m.Cmd(s.FindSpaceCmd(m, "web.team.dashboard.summary"), s.Insert, model.TITLE, title, model.SPACE, m.Option(ice.MSG_USERPOD), model.INDEX, s.Prefix(m, index), model.QUERY, kit.Format(arg), mdb.FIELD, field, model.SCORE, score, m.OptionSimple(model.CLIENT_UID)) } @@ -293,8 +282,9 @@ func (s Portal) DashboardUpdate(m *ice.Message, arg ...string) { func init() { ice.TeamCtxCmd(Portal{Table: newTable()}) } -func (s Portal) UserPlaceRole(m *ice.Message, arg ...string) { +func (s Portal) UserPlaceRole(m *ice.Message, arg ...string) *ice.Message { m.Echo(m.Cmd(s.UserPlace, s.Table.Select, m.OptionSimple(s.Keys(s.Place, model.UID), model.USER_UID)).Append(model.ROLE)) + return m } func (s Portal) UserPlaceCmd(m *ice.Message, arg ...string) { m.Cmdy(s.UserPlace, arg) @@ -302,16 +292,16 @@ func (s Portal) UserPlaceCmd(m *ice.Message, arg ...string) { func (s Portal) PlaceCmd(m *ice.Message, arg ...string) { m.Cmdy(s.Place, arg) } + func (s Portal) UpdateCommand(m *ice.Message, arg ...string) { m.Config(model.SERVICE_UID, arg[0]) s.Hash.Select(m.Spawn()).Table(func(value ice.Maps) { - uid := m.Cmdx(command{}, s.Table.Update, model.SERVICE_UID, arg[0], mdb.ICON, value[mdb.ICONS], model.NAME, value[model.NAME], model.INDEX, value[model.INDEX]) + uid := m.Cmdx(command{}, s.Table.Modify, model.SERVICE_UID, arg[0], mdb.ICON, value[mdb.ICONS], model.NAME, value[model.NAME], model.INDEX, value[model.INDEX]) s.Hash.Modify(m, ctx.INDEX, value[ctx.INDEX], model.COMMAND_UID, uid) }) } -func (s Portal) SelectCommand(m *ice.Message, arg ...string) { - s.Hash.Select(m, arg...) -} +func (s Portal) SelectCommand(m *ice.Message, arg ...string) { s.Hash.Select(m, arg...) } + func (s Portal) Create(m *ice.Message, arg ...string) { args := []string{ctx.INDEX, m.Option(ctx.INDEX)} msg := s.Hash.Select(m.Spawn(), m.Option(ctx.INDEX)) @@ -325,12 +315,8 @@ func (s Portal) Create(m *ice.Message, arg ...string) { }) s.Hash.Create(m, args...) } -func (s Portal) Remove(m *ice.Message, arg ...string) { - s.Hash.Remove(m, arg...) -} -func (s Portal) Modify(m *ice.Message, arg ...string) { - s.Hash.Modify(m, arg...) -} +func (s Portal) Remove(m *ice.Message, arg ...string) { s.Hash.Remove(m, arg...) } +func (s Portal) Modify(m *ice.Message, arg ...string) { s.Hash.Modify(m, arg...) } func (s Portal) Show(m *ice.Message, arg ...string) { m.Cmd(s.Prefix(m, s), s.Create, ctx.INDEX, m.PrefixKey()) } diff --git a/src/gonganxitong/portal.js b/src/gonganxitong/portal.js index 8c11dee..f2c38ff 100644 --- a/src/gonganxitong/portal.js +++ b/src/gonganxitong/portal.js @@ -31,27 +31,36 @@ Volcanos(chat.ONIMPORT, { value.args = [can.db.hash[0]].concat(can.db.hash.slice(2)), can.onimport.myStory(can, value) }) }) } - can.ui = can.page.Append(can, can._output, [ - {view: "header"}, - // {view: "footer"}, + can.ui = can.page.Append(can, can._output, [{view: html.HEADER}, {view: html.OUTPUT, list: ["mydebug.list", "myplace.list", "mycount.list", "myinit.list", "myindex.list", "myallow.list"]}, {view: html.ACTION, list: ["myorder.list"]}, ]) can.onmotion.hidden(can, can.ui.mydebug) can.onmotion.hidden(can, can.ui.mycount) can.onmotion.hidden(can, can.ui.myinit) - // can.onmotion.hidden(can, can.ui.myindex) can.onmotion.hidden(can, can.ui.myallow) - function showIndex(msg) { can.onimport.myDebug(can, msg, can.ui.mydebug) + function showIndex(msg) { if (msg.Length() == 0) { return } + can.onmotion.toggle(can, can.ui.mycount, true) + can.onmotion.toggle(can, can.ui.myallow, true) + + can.onimport.myDebug(can, msg, can.ui.mydebug) + can.onimport.myCount(can, msg, can.ui.mycount) can.onimport.myIndex(can, msg, can.ui.myindex, USER_PLACE_ROLE), can.onexport.index(can, can.sup.current) - can.onimport.myAllow(can, msg, can.ui.myallow), can.onimport.myOrder(can, msg, can.ui.myorder) + can.onimport.myAllow(can, msg, can.ui.myallow) + can.onimport.myOrder(can, msg, can.ui.myorder) } if (can.Option(PLACE_UID) == "") { var uid = can.onimport.myPlace(can, msg, can.ui.myplace) msg.Length() > 0? can.run({}, [uid], function(msg) { showIndex(can._index_msg = msg) }): can.run({}, [uid], function(msg) { can.onimport.myOrder(can, can._index_msg = msg, can.ui.myorder) }) } else { - var _msg = can.request({}); _msg.Push(kit.Dict(UID, "", msg.OptionSimple(PLACE_UID, PLACE_NAME, PLACE_TYPE, USER_PLACE_ROLE, STREET_NAME, CITY_NAME, "auth_status", "dashboard_uid"))) - _msg.Option(ice.MSG_ACTION, msg.Option(USER_PLACE_ROLE) == "visitor"? '[]': '["placeCreate","placeSearch"]') - can.onimport.myPlace(can, _msg, can.ui.myplace), showIndex(can._index_msg = msg) + var _msg = can.request({}); if (msg.Option(PLACE_NAME)) { + _msg.Push(kit.Dict(UID, "", msg.OptionSimple(PLACE_UID, PLACE_NAME, PLACE_TYPE, USER_PLACE_ROLE, STREET_NAME, CITY_NAME, "auth_status", "dashboard_uid"))) + } _msg.Option(ice.MSG_ACTION, msg.Option(USER_PLACE_ROLE) == "visitor"? '[]': '["placeCreate","placeSearch"]') + can.onimport.myPlace(can, _msg, can.ui.myplace) + if (_msg.Length() == 0) { + can.onimport.myOrder(can, msg, can.ui.myorder) + } else { + showIndex(can._index_msg = msg) + } } }, myPlace: function(can, msg, target) { var place_uid @@ -98,7 +107,7 @@ Volcanos(chat.ONIMPORT, { ], onclick: function(event) { if (value.index.split(".").pop() == "recent") { } - can.onimport.myStory(can, {space: can.ConfSpace(), index: value.index, args: [can.onexport.place(can)]}) + can.onimport.myStory(can, {space: can.ConfSpace(), index: value.index, args: [can.onexport.place(can)||can.misc.Search(can, can.Conf("_place_uid"))]}) }} })) }, @@ -143,7 +152,9 @@ Volcanos(chat.ONACTION, { beforeInputs: function(event, can, button, target) { can.page.insertBefore(can, target._target, can._root.Header._target) // can.user.isMobile && can.onmotion.toggle(can, can._root.Action._output, false) + return target.Option("city_name", "深圳市", true) + target.Option("street_name", "航城街道", true) target.Option("company_name", "宝安妇幼", true) target.Option("queue_name", "二楼产检") target.Option("reception_name", "科室1") diff --git a/src/gonganxitong/recent.go b/src/gonganxitong/recent.go index 72c8f60..56ef105 100644 --- a/src/gonganxitong/recent.go +++ b/src/gonganxitong/recent.go @@ -21,22 +21,21 @@ type recent struct { } func (s recent) Create(m *ice.Message, arg ...string) { - if args := m.OptionSimple(model.USER_UID, model.SERVICE_UID, ctx.ARGS); s.Table.Select(m, args...).Length() == 0 { - s.Table.Create(m, kit.Simple(arg, model.UPDATED_AT, m.Time(), m.OptionSimple(model.USER_UID))...) + if args := m.OptionSimple(model.USER_UID, model.SERVICE_UID, ctx.ARGS); s.Select(m, args...).Length() == 0 { + s.Insert(m, kit.Simple(arg, model.UPDATED_AT, m.Time(), m.OptionSimple(model.USER_UID))...) } else { - s.Table.Update(m, kit.Dict(m.OptionSimple(model.AUTH_STATUS)), args...) + s.Update(m, kit.Dict(m.OptionSimple(model.AUTH_STATUS)), args...) } } func (s recent) Remove(m *ice.Message, arg ...string) { - s.Table.Delete(m, m.OptionSimple(model.USER_UID, model.UID)...) + s.Delete(m, m.OptionSimple(model.USER_UID, model.UID)...) } func (s recent) List(m *ice.Message, arg ...string) { if len(arg) < 2 { - s.Tables(m, s.service).Fields(m, - model.SERVICE_ICON, model.SERVICE_NAME, - s.AS(model.NODENAME, model.SPACE), model.INDEX, model.ARGS, s.Key(s, model.AUTH_STATUS), model.SCORE, - s.Key(s, model.UID), s.Key(s, model.UPDATED_AT), + s.Tables(m, s.service).Fields(m, s.Key(s, model.UID), s.Key(s, model.UPDATED_AT), + model.SERVICE_ICON, model.SERVICE_NAME, s.Key(s, model.AUTH_STATUS), model.SCORE, s.Key(s, model.CITY_NAME), s.Key(s, model.STREET_NAME), s.Key(s, model.PLACE_NAME), + s.AS(model.NODENAME, model.SPACE), model.INDEX, model.ARGS, ) s.Orders(m, s.Desc(model.SCORE), s.Desc(model.UPDATED_AT)) s.Select(m, model.USER_UID, m.Option(model.USER_UID)) @@ -56,10 +55,10 @@ func (s recent) Open(m *ice.Message, arg ...string) { m.ProcessOpen(web.S(m.Option(web.SPACE)) + web.C(m.Option(ctx.INDEX)) + "#" + kit.Join(kit.Split(m.Option(ctx.ARGS)), ":")) } func (s recent) Sticky(m *ice.Message, arg ...string) { - s.Table.Update(m, ice.Map{model.SCORE: 100}, m.OptionSimple(model.USER_UID, model.UID)...) + s.Update(m, ice.Map{model.SCORE: 100}, m.OptionSimple(model.USER_UID, model.UID)...) } 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)...) + s.Update(m, ice.Map{model.SCORE: 0}, m.OptionSimple(model.USER_UID, model.UID)...) } func init() { ice.TeamCtxCmd(recent{Table: newTable()}) } diff --git a/src/gonganxitong/search.js b/src/gonganxitong/search.js index 75a8c05..fd5de8b 100644 --- a/src/gonganxitong/search.js +++ b/src/gonganxitong/search.js @@ -3,12 +3,11 @@ Volcanos(chat.ONIMPORT, { can.onimport.myView(can, msg, function(value) { return [ {view: html.TITLE, list: [value.name||value.title||value.user_name]}, - {view: html.STATUS, list: [value.uid && value.uid.slice(0, 6), can.base.TimeTrim(value.created_at||value.updated_at)]}, + {view: html.STATUS, list: [value.uid && value.uid.slice(0, 6), can.onimport.timeView(can, value)]}, {view: html.STATUS, list: [value.city_name, value.street_name, value.company_name]}, {view: html.OUTPUT, list: [value.info||value.content]}, ] - }, function(event, value) { - can.onaction._goback(can) + }, function(event, value) { can.onaction._goback(can) can.onimport.plugin(can, {args: [value.uid]}) }) }, diff --git a/src/gonganxitong/service.go b/src/gonganxitong/service.go index 5f1c54a..4741628 100644 --- a/src/gonganxitong/service.go +++ b/src/gonganxitong/service.go @@ -29,8 +29,8 @@ type service struct { func (s service) Update(m *ice.Message, arg ...string) { uid := kit.Hashs(ice.Info.Hostname, ice.Info.Pwd, m.Option(ctx.INDEX)) - if s.Table.Select(m.Spawn(), model.UID, uid).Length() == 0 { - s.Table.Create(m, kit.Simple(model.UID, uid, m.OptionSimple(mdb.ICON, mdb.NAME, ctx.INDEX), nfs.PATHNAME, ice.Info.Pwd, tcp.HOSTNAME, ice.Info.Hostname)...) + if s.Select(m.Spawn(), model.UID, uid).Length() == 0 { + s.Insert(m, kit.Simple(model.UID, uid, m.OptionSimple(mdb.ICON, mdb.NAME, ctx.INDEX), nfs.PATHNAME, ice.Info.Pwd, tcp.HOSTNAME, ice.Info.Hostname)...) m.Cmd(s.PrefixPortal(m)).Table(func(value ice.Maps) { m.Cmd(s.PrefixPortal(m), mdb.MODIFY, value[ctx.INDEX], mdb.ENABLE, ice.TRUE) }) } s.Table.Update(m, kit.Dict(arg, m.OptionSimple(mdb.NAME, mdb.ICON), @@ -54,7 +54,6 @@ func (s service) Autogen(m *ice.Message, arg ...string) { msg := m.Cmd("web.team.gonganxitong.service") m.Option("table", kit.LowerCapital(table)) m.Option("what", kit.LowerCapital(table)) - m.Info("what %v", m.Option("table")) m.Cmd(nfs.DEFS, path.Join(p, "model/model.go"), msg.Template(from+"model/model.go")) m.Cmd(nfs.DEFS, path.Join(p, "common.go"), msg.Template(from+"common.go")) m.Cmd(nfs.DEFS, path.Join(p, "portal.go"), msg.Template(from+"portal.go")) @@ -71,7 +70,6 @@ func (s service) Compile(m *ice.Message, arg ...string) { m.Cmdy(code.VIMER, code.COMPILE) } func (s service) Oauth(m *ice.Message, arg ...string) { - defer m.ToastProcess()() m.Options(m.Cmd(web.CHAT_WX_ACCESS).AppendSimple()) m.Option("user_cmd", kit.JoinWord(m.Prefix(aaa.USER), mdb.CREATE)) m.Option("sess_cmd", kit.JoinWord(m.Prefix(aaa.SESS), mdb.CREATE)) @@ -81,7 +79,7 @@ func (s service) Oauth(m *ice.Message, arg ...string) { } func (s service) List(m *ice.Message, arg ...string) { if len(arg) == 2 { - s.Table.SelectDetail(m, model.UID, arg[1]) + s.SelectDetail(m, model.UID, arg[1]) } else { s.Orders(m, s.Desc(model.UPDATED_AT)).Select(m) } diff --git a/src/gonganxitong/sess.go b/src/gonganxitong/sess.go index 28d2b04..1082581 100644 --- a/src/gonganxitong/sess.go +++ b/src/gonganxitong/sess.go @@ -16,11 +16,11 @@ type sess struct { } func (s sess) Create(m *ice.Message, arg ...string) { - s.Table.Create(m, model.USER_UID, m.Option(model.USER_UID), web.AGENT, m.Option(ice.MSG_USERUA), aaa.IP, m.Option(ice.MSG_USERIP)) + s.Insert(m, model.USER_UID, m.Option(model.USER_UID), web.AGENT, m.Option(ice.MSG_USERUA), aaa.IP, m.Option(ice.MSG_USERIP)) m.ProcessCookie(ice.MSG_SESSID, kit.JoinWord(web.SPACE, m.Option(ice.MSG_USERPOD), m.PrefixKey(), aaa.CHECK, m.Result()), "-2") } func (s sess) Check(m *ice.Message, arg ...string) { - msg := s.Table.Select(m.Spawn(), model.UID, arg[0]) + msg := s.Select(m.Spawn(), model.UID, arg[0]) msg = m.Cmd(s.user, s.Select, model.UID, msg.Append(model.USER_UID)) m.Option(ice.MSG_USERROLE, aaa.VOID) m.Option(ice.MSG_USERNAME, msg.Append(model.UID)) @@ -30,8 +30,11 @@ func (s sess) Check(m *ice.Message, arg ...string) { } func (s sess) List(m *ice.Message, arg ...string) { if m.IsTech() { - s.Table.List(m, arg...) - m.PushAction(s.Remove) + if len(arg) < 2 { + s.Select(m) + } else { + s.SelectDetail(m, model.UID, arg[1]) + } } } diff --git a/src/gonganxitong/street.go b/src/gonganxitong/street.go index e722ee3..4dfa887 100644 --- a/src/gonganxitong/street.go +++ b/src/gonganxitong/street.go @@ -10,7 +10,7 @@ type street struct{ Table } func (s street) FindOrCreateByName(m *ice.Message, arg ...string) { if msg := m.Cmd(s, s.Select, model.CITY_UID, arg[1], model.NAME, arg[3]); msg.Length() == 0 { - msg := m.Cmd(s, s.Create, model.CITY_UID, arg[1], model.NAME, arg[3]) + msg := m.Cmd(s, s.Insert, model.CITY_UID, arg[1], model.NAME, arg[3]) arg[2], arg[3] = model.STREET_UID, msg.Result() } else { arg[2], arg[3] = model.STREET_UID, msg.Append(model.UID) diff --git a/src/gonganxitong/template/homework.go b/src/gonganxitong/template/homework.go index 370fdab..2fc3eb6 100644 --- a/src/gonganxitong/template/homework.go +++ b/src/gonganxitong/template/homework.go @@ -4,13 +4,11 @@ import "shylinux.com/x/ice" type {{.Option "table"}} struct { Table - fields string `data:"title,content"` + fields string `data:"title,content,user_uid"` create string `name:"create title* content*" role:"leader"` remove string `name:"remove" role:"leader"` } -func (s {{.Option "table"}}) Create(m *ice.Message, arg ...string) { s.ValueCreate(m, arg...) } -func (s {{.Option "table"}}) Remove(m *ice.Message, arg ...string) { s.ValueRemove(m, arg...) } -func (s {{.Option "table"}}) List(m *ice.Message, arg ...string) { s.ValueList(m, arg).Display("") } +func (s {{.Option "table"}}) List(m *ice.Message, arg ...string) { s.ValueList(m, arg).Display("") } func init() { ice.TeamCtxCmd({{.Option "table"}}{}) } diff --git a/src/gonganxitong/template/homework.js b/src/gonganxitong/template/homework.js index 82d5fea..e7c20b6 100644 --- a/src/gonganxitong/template/homework.js +++ b/src/gonganxitong/template/homework.js @@ -1,9 +1,9 @@ Volcanos(chat.ONIMPORT, { _init: function(can, msg) { can.onimport.myView(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: html.OUTPUT, list: [value.content]}, + {view: html.TITLE, list: [value.title||value.name]}, + {view: html.STATUS, list: [value.uid.slice(0, 6), can.onimport.timeView(can, value), value.user_name]}, + {view: html.OUTPUT, list: [value.content||value.info]}, ] }) }, }) diff --git a/src/gonganxitong/thumb.go b/src/gonganxitong/thumb.go index f4fab74..d86fe14 100644 --- a/src/gonganxitong/thumb.go +++ b/src/gonganxitong/thumb.go @@ -11,7 +11,7 @@ type thumb struct{ Table } func (s thumb) Toggle(m *ice.Message, arg ...string) { if msg := s.Select(m.Spawn(), m.OptionSimple(model.MARKET_UID, model.USER_UID)...); msg.Length() == 0 { - s.Create(m.Spawn(), kit.Simple(m.OptionSimple(model.MARKET_UID, model.USER_UID), model.STATUS, 1)...) + s.Insert(m.Spawn(), kit.Simple(m.OptionSimple(model.MARKET_UID, model.USER_UID), model.STATUS, 1)...) m.Echo("1") } else { s.AddCount(m.Spawn(), model.STATUS, "1", msg.Append(model.UID)) diff --git a/src/gonganxitong/user.go b/src/gonganxitong/user.go index 235bfed..25749aa 100644 --- a/src/gonganxitong/user.go +++ b/src/gonganxitong/user.go @@ -25,16 +25,16 @@ func (s user) Create(m *ice.Message, arg ...string) { m.OptionDefault(aaa.USERNICK, m.Option(ice.MSG_USERNICK)) } if s.Table.Select(m, m.OptionSimple(model.OPEN_ID)...).Length() == 0 { - s.Table.Create(m, kit.Simple(m.OptionSimple(model.OPEN_ID, model.AVATAR), model.NAME, m.Option(aaa.USERNICK))...) + s.Insert(m, kit.Simple(m.OptionSimple(model.OPEN_ID, model.AVATAR), model.NAME, m.Option(aaa.USERNICK))...) m.Option(model.USER_UID, m.Result()) } else { - s.Table.Update(m, kit.Dict(m.OptionSimple(model.AVATAR), model.NAME, m.Option(aaa.USERNICK)), m.AppendSimple(model.UID)...) + s.Update(m, kit.Dict(m.OptionSimple(model.AVATAR), model.NAME, m.Option(aaa.USERNICK)), m.AppendSimple(model.UID)...) m.Option(model.USER_UID, m.Append(model.UID)) } } func (s user) List(m *ice.Message, arg ...string) { if m.IsTech() { - s.Table.List(m, arg...).Table(func(value ice.Maps) { + s.Select(m, arg...).Table(func(value ice.Maps) { if value[model.UID] != m.Option(model.USER_UID) { m.PushButton(s.SetCookie) } else { diff --git a/src/huodongzuzhi/activity.go b/src/huodongzuzhi/activity.go index b36505f..5844ba5 100644 --- a/src/huodongzuzhi/activity.go +++ b/src/huodongzuzhi/activity.go @@ -4,13 +4,11 @@ import "shylinux.com/x/ice" type activity struct { Table - fields string `data:"title,content"` + fields string `data:"title,content,user_uid"` create string `name:"create title* content*" role:"leader"` remove string `name:"remove" role:"leader"` } -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 (s activity) List(m *ice.Message, arg ...string) { s.ValueList(m, arg).Display("") } func init() { ice.TeamCtxCmd(activity{}) } diff --git a/src/huodongzuzhi/activity.js b/src/huodongzuzhi/activity.js index 3be5f6e..d3e4f08 100644 --- a/src/huodongzuzhi/activity.js +++ b/src/huodongzuzhi/activity.js @@ -2,7 +2,7 @@ Volcanos(chat.ONIMPORT, { _init: function(can, msg) { can.onimport.myView(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: html.STATUS, list: [value.uid.slice(0, 6), can.onimport.timeView(can, value), value.user_name]}, {view: html.OUTPUT, list: [value.content]}, ] }) }, diff --git a/src/renzhengshouquan/auth.go b/src/renzhengshouquan/auth.go index 4f79e5f..3748d96 100644 --- a/src/renzhengshouquan/auth.go +++ b/src/renzhengshouquan/auth.go @@ -9,20 +9,22 @@ import ( type auth struct { Table - certList string `name:"certList" role:"leader,worker"` + cert cert + fields string `data:"name,auth_type,auth_status"` memberList string `name:"memberList" role:"leader,worker"` + certList string `name:"certList" role:"leader,worker"` issue string `name:"issue" role:"leader,worker"` revoke string `name:"revoke" role:"leader,worker"` } func (s auth) List(m *ice.Message, arg ...string) { if len(arg) == 1 { - s.Select(m, model.FROM_UID, arg[0]) + s.Select(m, model.FROM_UID, arg[0]).Action() } else if len(arg) == 2 { s.SelectDetail(m, model.FROM_UID, arg[0], model.UID, arg[1]).Action(s.CertList, s.MemberList) } m.Table(func(value ice.Maps) { - switch AuthStatus(kit.Int(value[model.STATUS])) { + switch AuthStatus(kit.Int(value[model.AUTH_STATUS])) { case AuthCreate: m.PushButton(s.Issue) case AuthIssued: @@ -32,15 +34,15 @@ func (s auth) List(m *ice.Message, arg ...string) { default: m.PushButton() } - }).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() - kit.If(m.Length() == 0, func() { m.Echo("没有上传证件") }) + }).Display("") } func (s auth) MemberList(m *ice.Message, arg ...string) { m.Cmdy(m.Prefix("member"), arg[0]) } +func (s auth) CertList(m *ice.Message, arg ...string) { + m.Cmdy(s.cert, arg[0]).Action() + kit.If(m.Length() == 0, func() { m.Echo("没有上传证件") }) +} func (s auth) Issue(m *ice.Message, arg ...string) { msg := m.Cmd(userAuth{}, m.Option(model.USER_UID), m.Option(model.AUTH_UID)) if !m.IsTech() || AuthType(kit.Int(msg.Append(model.AUTH_TYPE))) != AuthRoot { @@ -72,17 +74,17 @@ type AuthType int const ( AuthRoot AuthType = iota AuthCity - AuthCompany - AuthService AuthPersonal + AuthService + AuthCompany ) var AuthTypeList = map[AuthType]string{ AuthRoot: "root", AuthCity: "city", - AuthCompany: "company", - AuthService: "service", AuthPersonal: "personal", + AuthService: "service", + AuthCompany: "company", } func (s AuthType) String() string { return AuthTypeList[s] } diff --git a/src/renzhengshouquan/auth.js b/src/renzhengshouquan/auth.js index 76c37f4..c6b9c41 100644 --- a/src/renzhengshouquan/auth.js +++ b/src/renzhengshouquan/auth.js @@ -1,9 +1,8 @@ Volcanos(chat.ONIMPORT, { _init: function(can, msg) { can.onimport.myView(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: html.OUTPUT, list: [value.info||value.content]}, + {view: html.TITLE, list: [value.name, can.onimport.textView(can, value, "auth_type")]}, + {view: html.STATUS, list: [value.uid.slice(0, 6), can.onimport.timeView(can, value), can.onimport.textView(can, value, "auth_status")]}, ] }) }, }) \ No newline at end of file diff --git a/src/renzhengshouquan/cert.go b/src/renzhengshouquan/cert.go index 6e3decb..2a2b0e2 100644 --- a/src/renzhengshouquan/cert.go +++ b/src/renzhengshouquan/cert.go @@ -2,6 +2,14 @@ package renzhengshouquan import "shylinux.com/x/ice" -type cert struct{ Value } +type cert struct { + Table + fields string `data:"title,content,user_uid"` + create string `name:"create title* content*" role:"leader"` + modify string `name:"modify title* content*" role:"leader"` + remove string `name:"remove" role:"leader"` +} + +func (s cert) List(m *ice.Message, arg ...string) { s.ValueList(m, arg).Display("") } func init() { ice.TeamCtxCmd(cert{}) } diff --git a/src/renzhengshouquan/cert.js b/src/renzhengshouquan/cert.js index 3be5f6e..d3e4f08 100644 --- a/src/renzhengshouquan/cert.js +++ b/src/renzhengshouquan/cert.js @@ -2,7 +2,7 @@ Volcanos(chat.ONIMPORT, { _init: function(can, msg) { can.onimport.myView(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: html.STATUS, list: [value.uid.slice(0, 6), can.onimport.timeView(can, value), value.user_name]}, {view: html.OUTPUT, list: [value.content]}, ] }) }, diff --git a/src/renzhengshouquan/common.go b/src/renzhengshouquan/common.go index 2cb7b42..799dc39 100644 --- a/src/renzhengshouquan/common.go +++ b/src/renzhengshouquan/common.go @@ -2,6 +2,7 @@ package renzhengshouquan import ( "shylinux.com/x/ice" + "shylinux.com/x/icebergs/base/aaa" kit "shylinux.com/x/toolkits" "shylinux.com/x/community/src/renzhengshouquan/model" @@ -31,7 +32,7 @@ func (s Table) Inputs(m *ice.Message, arg ...string) { case model.FROM_UID: switch AuthType(kit.Int(m.Option(model.AUTH_TYPE))) { case AuthRoot: - m.Push(model.UID, "root").Push(model.NAME, "root") + m.Push(model.UID, aaa.ROOT).Push(model.NAME, aaa.ROOT) case AuthCity: m.Cmdy(auth{}, s.Select, model.TYPE, AuthRoot) case AuthCompany, AuthPersonal: @@ -64,16 +65,3 @@ 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).Display("") } diff --git a/src/renzhengshouquan/model/model.go b/src/renzhengshouquan/model/model.go index fc9828d..005ce79 100644 --- a/src/renzhengshouquan/model/model.go +++ b/src/renzhengshouquan/model/model.go @@ -12,12 +12,12 @@ const ( CONTENT = "content" CREATOR = "creator" USER_UID = "user_uid" - DASHBOARD_UID = "dashboard_uid" USER_AUTH_ROLE = "user_auth_role" AUTH_UID = "auth_uid" AUTH_NAME = "auth_name" AUTH_TYPE = "auth_type" AUTH_STATUS = "auth_status" + DASHBOARD_UID = "dashboard_uid" CERT_UID = "cert_uid" COMPANY_UID = "company_uid" COMPANY_NAME = "company_name" @@ -32,7 +32,7 @@ type UserAuth struct { } type Auth struct { db.ModelWithUID - DashboardUID string `gorm:"type:char(32);index"` + DashboardUID string `gorm:"type:char(32)"` CompanyUID string `gorm:"type:char(32);index"` FromUID string `gorm:"type:char(32);index"` Name string `gorm:"type:varchar(64)"` diff --git a/src/renzhengshouquan/portal.json b/src/renzhengshouquan/portal.json index 58ee69a..9fbfffc 100644 --- a/src/renzhengshouquan/portal.json +++ b/src/renzhengshouquan/portal.json @@ -34,9 +34,9 @@ "auth_type": { "root": "官方", "city": "城市", - "company": "公司", "personal": "个人", "service": "服务", + "company": "公司", "style": { "root": "danger", "city": "danger" @@ -44,9 +44,9 @@ "icons": { "root": "https://img.icons8.com/officel/80/console.png", "city": "https://img.icons8.com/officel/80/city-buildings.png", - "company": "https://img.icons8.com/officel/80/organization.png", + "personal": "https://img.icons8.com/officel/80/identification-documents--v1.png", "service": "https://img.icons8.com/officel/80/meeting-room.png", - "personal": "https://img.icons8.com/officel/80/identification-documents--v1.png" + "company": "https://img.icons8.com/officel/80/organization.png" } }, "auth_status": { diff --git a/src/template/web.code.autogen/demo.go b/src/template/web.code.autogen/demo.go index c5a00ea..e115ec0 100644 --- a/src/template/web.code.autogen/demo.go +++ b/src/template/web.code.autogen/demo.go @@ -4,13 +4,11 @@ import "shylinux.com/x/ice" type {{.Option "name"}} struct { Table - fields string `data:"title,content"` + fields string `data:"title,content,user_uid"` create string `name:"create title* content*" role:"leader"` remove string `name:"remove" role:"leader"` } -func (s {{.Option "name"}}) Create(m *ice.Message, arg ...string) { s.ValueCreate(m, arg...) } -func (s {{.Option "name"}}) Remove(m *ice.Message, arg ...string) { s.ValueRemove(m, arg...) } -func (s {{.Option "name"}}) List(m *ice.Message, arg ...string) { s.ValueList(m, arg).Display("") } +func (s {{.Option "name"}}) List(m *ice.Message, arg ...string) { s.ValueList(m, arg).Display("") } func init() { ice.TeamCtxCmd({{.Option "name"}}{}) } diff --git a/src/template/web.code.js/demo.js b/src/template/web.code.js/demo.js index 24e4ac5..9aac8a3 100644 --- a/src/template/web.code.js/demo.js +++ b/src/template/web.code.js/demo.js @@ -1,9 +1,9 @@ Volcanos(chat.ONIMPORT, { _init: function(can, msg) { can.onimport.myView(can, msg, function(value) { return [ - {view: html.TITLE, list: [value.name||value.title||value.user_name]}, - {view: html.STATUS, list: [value.uid.slice(0, 6), can.base.TimeTrim(value.created_at)]}, - {view: html.OUTPUT, list: [value.info||value.content]}, + {view: html.TITLE, list: [value.title||value.name||value.user_name]}, + {view: html.STATUS, list: [value.uid.slice(0, 6), can.onimport.timeView(can, value), value.user_name]}, + {view: html.OUTPUT, list: [value.content||value.info]}, ] }) }, }) diff --git a/src/yuehaoxitong/call.go b/src/yuehaoxitong/call.go index 5dc7432..98ab300 100644 --- a/src/yuehaoxitong/call.go +++ b/src/yuehaoxitong/call.go @@ -10,21 +10,29 @@ import ( type call struct { Schedule - call string `name:"call" help:"叫号" role:"worker"` - list string `name:"list queue_uid uid reception_uid auto" role:"worker"` - expire string `name:"expire" role:"worker"` - finish string `name:"finish" role:"worker"` + list string `name:"list queue_uid uid reception_uid auto"` } +func (s call) Call(m *ice.Message, arg ...string) { m.Cmdy(s.Schedule, m.ActionKey(), arg) } func (s call) List(m *ice.Message, arg ...string) { + role := UserQueueRole(kit.Int(m.Option(model.USER_ROLE))) if len(arg) == 1 { - 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) }) + if role != UserQueueVisitor { + s.SelectByStatus(m.Options(mdb.ORDER, model.TAKE_TIME), arg[0], kit.Format(ScheduleTake)) + kit.If(m.Length() == 0, func() { m.Echo(m.Trans("wait take", "等待取号")) }, func() { m.Action(s.Call) }) + } } else if len(arg) == 2 { - s.Schedule.List(m, arg[0], arg[1]).Action(s.Call) + s.Schedule.List(m, arg[0], arg[1]) + if role != UserQueueVisitor { + m.Action(s.Call) + } } else if len(arg) == 3 { - s.Schedule.Select(m, model.QUEUE_UID, arg[0], model.RECEPTION_UID, arg[2], model.STATUS, kit.Format(ScheduleTake)).Action(s.Call) + if role != UserQueueVisitor { + s.Schedule.Select(m, model.QUEUE_UID, arg[0], model.RECEPTION_UID, arg[2], model.STATUS, kit.Format(ScheduleTake)).Action(s.Call) + } } } +func (s call) Expire(m *ice.Message, arg ...string) { m.Cmdy(s.Schedule, m.ActionKey(), arg) } +func (s call) Finish(m *ice.Message, arg ...string) { m.Cmdy(s.Schedule, m.ActionKey(), arg) } func init() { ice.TeamCtxCmd(call{}) } diff --git a/src/yuehaoxitong/model/model.go b/src/yuehaoxitong/model/model.go index 32208e6..d35578f 100644 --- a/src/yuehaoxitong/model/model.go +++ b/src/yuehaoxitong/model/model.go @@ -8,10 +8,10 @@ const ( TYPE = "type" ROLE = "role" STATUS = "status" + TITLE = "title" CONTENT = "content" - CREATED_AT = "created_at" - OPERATOR = "operator" USER_UID = "user_uid" + USER_ROLE = "user_role" USER_QUEUE_ROLE = "user_queue_role" QUEUE_UID = "queue_uid" QUEUE_NAME = "queue_name" @@ -19,12 +19,10 @@ const ( RECEPTION_UID = "reception_uid" RECEPTION_NAME = "reception_name" VOLUME_UID = "volume_uid" + VOLUME_AMOUNT = "volume_amount" 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" diff --git a/src/yuehaoxitong/open.go b/src/yuehaoxitong/open.go index 087e827..bd17fda 100644 --- a/src/yuehaoxitong/open.go +++ b/src/yuehaoxitong/open.go @@ -3,33 +3,13 @@ package yuehaoxitong import ( "shylinux.com/x/ice" kit "shylinux.com/x/toolkits" - - "shylinux.com/x/community/src/yuehaoxitong/model" ) -type open struct { - Tables - volume Volume - create string `name:"plan reception_uid*:select volume_amount* begin_time*:select@date end_time*:select@date" role:"leader"` - list string `name:"list queue_uid uid auto" role:"leader"` -} +type open struct{ Volume } -func (s open) Create(m *ice.Message, arg ...string) { - arg = kit.TransArgKeys(arg, "volume_amount", model.AMOUNT) - m.Cmdy(s.volume, s.Create, arg, m.OptionSimple(model.QUEUE_UID)).ProcessRefresh() - s.RecordEvent(m, m.Trans("create volume", "创建服务计划")+"\n"+s.joinKV(m, model.AMOUNT, model.BEGIN_TIME, model.END_TIME), m.Result()) -} func (s open) List(m *ice.Message, arg ...string) { - m.Cmdy(s.volume, arg).PushAction(s.Market) - s.Button(m, "") + s.Volume.List(m, arg...).PushAction(s.MarketInsert) + kit.If(len(arg) == 1, func() { s.Button(m, "") }) } func init() { ice.TeamCtxCmd(open{}) } - -func (s open) joinKV(m *ice.Message, arg ...string) string { - list := []string{} - for _, k := range arg { - list = append(list, k, m.Option(k)) - } - return kit.JoinKV(": ", "\n", list...) -} diff --git a/src/yuehaoxitong/plan.go b/src/yuehaoxitong/plan.go index b2e37ad..ccd791d 100644 --- a/src/yuehaoxitong/plan.go +++ b/src/yuehaoxitong/plan.go @@ -7,11 +7,7 @@ import ( "shylinux.com/x/community/src/yuehaoxitong/model" ) -type plan struct { - Schedule - create string `name:"create reception_uid*:select volume_uid*:select" role:"void"` - cancel string `name:"cancel" role:"void"` -} +type plan struct{ Schedule } 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)...) diff --git a/src/yuehaoxitong/portal.go b/src/yuehaoxitong/portal.go index 988da47..656152a 100644 --- a/src/yuehaoxitong/portal.go +++ b/src/yuehaoxitong/portal.go @@ -15,9 +15,9 @@ type Portal struct { func (s Portal) AfterPlaceAuth(m *ice.Message, arg ...string) { s.DashboardCreate(m, "") - s.DashboardInsert(m, "3", "订单总量", Schedule{}, "", model.QUEUE_UID, m.Option(model.QUEUE_UID)) - s.DashboardInsert(m, "3", "订单已预约", Schedule{}, "", model.QUEUE_UID, m.Option(model.QUEUE_UID), model.STATUS, SchedulePlan) + s.DashboardInsert(m, "1", "订单总量", Schedule{}, "", model.QUEUE_UID, m.Option(model.QUEUE_UID)) + s.DashboardInsert(m, "2", "订单已预约", Schedule{}, "", model.QUEUE_UID, m.Option(model.QUEUE_UID), model.STATUS, SchedulePlan) s.DashboardInsert(m, "3", "订单已取号", Schedule{}, "", model.QUEUE_UID, m.Option(model.QUEUE_UID), model.STATUS, ScheduleTake) - s.DashboardInsert(m, "3", "订单已完成", Schedule{}, "", model.QUEUE_UID, m.Option(model.QUEUE_UID), model.STATUS, ScheduleFinish) + s.DashboardInsert(m, "4", "订单已完成", Schedule{}, "", model.QUEUE_UID, m.Option(model.QUEUE_UID), model.STATUS, ScheduleFinish) } func init() { gonganxitong.PortalCmd(Portal{Portal: guanlixitong.NewPortal(userQueue{}, queue{})}) } diff --git a/src/yuehaoxitong/reception.go b/src/yuehaoxitong/reception.go index cb1688d..9c4b239 100644 --- a/src/yuehaoxitong/reception.go +++ b/src/yuehaoxitong/reception.go @@ -4,19 +4,14 @@ import "shylinux.com/x/ice" type reception struct { Table - fields string `data:"name"` + fields string `data:"name,user_uid"` create string `name:"create reception_name*" role:"leader"` rename string `name:"rename name*" role:"leader"` remove string `name:"remove" role:"leader"` } -func (s reception) Create(m *ice.Message, arg ...string) { s.ValueCreate(m, arg...) } -func (s reception) Rename(m *ice.Message, arg ...string) { s.ValueModify(m, arg...) } -func (s reception) Remove(m *ice.Message, arg ...string) { s.ValueRemove(m, arg...) } func (s reception) List(m *ice.Message, arg ...string) { - if s.ValueList(m, arg); len(arg) > 0 { - m.PushAction(s.Rename, s.Remove) - } + s.ValueList(m, arg).PushAction(s.Rename, s.Remove) } func init() { ice.TeamCtxCmd(reception{}) } diff --git a/src/yuehaoxitong/schedule.go b/src/yuehaoxitong/schedule.go index f578638..8fe77d7 100644 --- a/src/yuehaoxitong/schedule.go +++ b/src/yuehaoxitong/schedule.go @@ -15,7 +15,12 @@ type Schedule struct { reception reception volume Volume models string `data:"schedule"` - plan string `name:"plan begin_time@date end_time@date"` + create string `name:"create reception_uid*:select volume_uid*:select" role:"void"` + cancel string `name:"cancel" role:"void"` + take string `name:"take" help:"取号" role:"void"` + call string `name:"call" help:"叫号" role:"leader,worker"` + expire string `name:"expire" role:"leader,worker"` + finish string `name:"finish" role:"leader,worker"` } func (s Schedule) Create(m *ice.Message, arg ...string) { @@ -26,7 +31,7 @@ func (s Schedule) Create(m *ice.Message, arg ...string) { return } s.addCount(m, mdb.COUNT, "1") - s.Table.Create(m, arg...) + s.Insert(m, arg...) }) s.SendMessage(m, m.Option(model.USER_UID), m.Option(model.USER_UID)) s.sendTemplate(m, "约号成功", m.Result()) @@ -47,8 +52,9 @@ func (s Schedule) Call(m *ice.Message, arg ...string) { return } s.changeStatus(m, ScheduleTake, ScheduleCall, model.CALL_UID, user_uid) + s.SendMessage(m, m.Append(model.USER_UID), user_uid) s.SendMessage(m, user_uid, m.Append(model.USER_UID)) - s.sendTemplate(m, "服务已叫号", m.Append(model.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) *ice.Message { @@ -127,7 +133,7 @@ func (s Schedule) SelectByStatus(m *ice.Message, arg ...string) *ice.Message { func (s Schedule) Cancel(m *ice.Message, arg ...string) { defer m.ToastProcess("取消中...")("取消成功") args := m.OptionSimple(model.USER_UID, model.UID) - if m.WarnNotFound(s.Select(m, args...).Length() == 0) { + if m.WarnNotFound(m.Cmdy(s, s.Select, args).Length() == 0) { return } s.Transaction(m, func() { @@ -139,12 +145,12 @@ func (s Schedule) Cancel(m *ice.Message, arg ...string) { func (s Schedule) Take(m *ice.Message, arg ...string) { defer m.ToastProcess("取号中...")("取号成功") args := m.OptionSimple(model.USER_UID, model.UID) - if m.WarnNotFound(s.Select(m, args...).Length() == 0) { + if m.WarnNotFound(m.Cmdy(s, s.Select, args).Length() == 0) { return } s.changeStatus(m, SchedulePlan, ScheduleTake) + s.DashboardUpdate(m) m.ProcessRefresh() - Portal{}.DashboardUpdate(m) } func (s Schedule) Expire(m *ice.Message, arg ...string) { defer m.ToastProcess("过号中...")("过号成功") @@ -157,7 +163,7 @@ func (s Schedule) Expire(m *ice.Message, arg ...string) { s.changeStatus(m, ScheduleCall, ScheduleExpire) }) s.Select(m.FieldsSetDetail(), args...) - s.sendTemplate(m, "服务已过号") + s.sendTemplate(m, "已过号") } func (s Schedule) Finish(m *ice.Message, arg ...string) { defer m.ToastProcess("完成中...")("完成成功") @@ -170,7 +176,7 @@ func (s Schedule) Finish(m *ice.Message, arg ...string) { s.changeStatus(m, ScheduleCall, ScheduleFinish) }) s.Select(m.FieldsSetDetail(), args...) - s.sendTemplate(m, "服务已完成") + s.sendTemplate(m, "已完成") Portal{}.DashboardUpdate(m) } @@ -186,8 +192,7 @@ func (s Schedule) changeStatus(m *ice.Message, from, to ScheduleStatus, arg ...s } func (s Schedule) sendTemplate(m *ice.Message, title string, arg ...string) *ice.Message { reception := m.Cmd(s.reception, s.Select, model.UID, m.Option(model.RECEPTION_UID)) - s.Table.SendTemplate(m, "", m.Append(model.USER_UID), kit.JoinWord(title, reception.Append(model.NAME)), - 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)) + s.Table.SendTemplate(m, "", m.Append(model.USER_UID), kit.JoinWord(title, reception.Append(model.NAME))) return m } diff --git a/src/yuehaoxitong/schedule.js b/src/yuehaoxitong/schedule.js index 2f49885..6db7eef 100644 --- a/src/yuehaoxitong/schedule.js +++ b/src/yuehaoxitong/schedule.js @@ -14,11 +14,8 @@ Volcanos(chat.ONIMPORT, { var _time = {view: html.STATUS, list: [can.user.trans(can, "finish_time:", "结束时间:"), value.end_time]} } return [ - {view: html.TITLE, list:[value.name||value.user_name, - value.schedule_status != "finish" && can.onimport.textView(can, value, "schedule_status"), - can.onimport.titleAction(can, value), - ]}, - {view: html.STATUS, list: [value.uid && value.uid.slice(0, 6), can.base.TimeTrim(value.created_at||value.updated_at), value.reception_name]}, + {view: html.TITLE, list:[value.name||value.user_name, value.schedule_status != "finish" && can.onimport.textView(can, value, "schedule_status"), can.onimport.titleAction(can, value)]}, + {view: html.STATUS, list: [value.uid && value.uid.slice(0, 6), can.onimport.timeView(can, value), value.reception_name]}, time, _time, ] }) diff --git a/src/yuehaoxitong/take.go b/src/yuehaoxitong/take.go index 994f07e..fb2775b 100644 --- a/src/yuehaoxitong/take.go +++ b/src/yuehaoxitong/take.go @@ -7,10 +7,7 @@ import ( "shylinux.com/x/community/src/yuehaoxitong/model" ) -type take struct { - Schedule - take string `name:"take" help:"取号" role:"void"` -} +type take struct{ Schedule } func (s take) List(m *ice.Message, arg ...string) { if len(arg) == 1 { diff --git a/src/yuehaoxitong/userQueue.go b/src/yuehaoxitong/userQueue.go index 625a298..a59013e 100644 --- a/src/yuehaoxitong/userQueue.go +++ b/src/yuehaoxitong/userQueue.go @@ -12,6 +12,7 @@ func init() { ice.TeamCtxCmd(userQueue{}) } type UserQueueRole = guanlixitong.UserGroupRole +var UserQueueVisitor = guanlixitong.UserGroupVisitor var UserQueueCreator = guanlixitong.UserGroupCreator var UserQueueLeader = guanlixitong.UserGroupLeader var UserQueueWorker = guanlixitong.UserGroupWorker diff --git a/src/yuehaoxitong/volume.go b/src/yuehaoxitong/volume.go index 5361844..a26a0d5 100644 --- a/src/yuehaoxitong/volume.go +++ b/src/yuehaoxitong/volume.go @@ -2,6 +2,7 @@ package yuehaoxitong import ( "shylinux.com/x/ice" + kit "shylinux.com/x/toolkits" "shylinux.com/x/community/src/yuehaoxitong/model" ) @@ -9,24 +10,41 @@ import ( type Volume struct { Table reception reception + models string `data:"volume"` + create string `name:"create reception_uid*:select volume_amount*=100 begin_time:select@date end_time:select@date" role:"leader"` } -func (s Volume) List(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.ArgDef(arg, model.BEGIN_TIME, m.Time(), model.END_TIME, m.Time("24h")) + s.Insert(m, kit.Simple(arg, m.OptionSimple(model.QUEUE_UID))...) + s.RecordEvent(m, "✅ "+m.Trans("create volume", "创建服务计划")+"\n"+s.joinKV(m, model.AMOUNT, model.BEGIN_TIME, model.END_TIME), m.Result()) +} +func (s Volume) List(m *ice.Message, arg ...string) *ice.Message { if len(arg) == 0 { if m.Option(model.RECEPTION_UID) != "" { s.Fields(m, model.UID, model.BEGIN_TIME, model.END_TIME, model.AMOUNT, model.COUNT) s.Select(m, m.OptionSimple(model.QUEUE_UID, model.RECEPTION_UID)...) } + return m } else if len(arg) == 1 { s.Tables(m, s.reception).FieldsWithCreatedAT(m, s, - model.RECEPTION_NAME, model.AMOUNT, model.COUNT, model.EXPIRE, model.FINISH, - 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, ).Select(m, s.Key(s, model.QUEUE_UID), arg[0]).Display("") } else if len(arg) == 2 { s.FieldsWithCreatedAT(m, Schedule{}, s.AS(model.STATUS, model.SCHEDULE_STATUS), model.USER_UID) m.Cmdy(Schedule{}, s.Select, "volume_uid = ? and status != ?", arg[1], ScheduleCancel) - s.SelectJoinUser(m) + kit.If(m.Length() == 0, func() { m.Echo("没有约号") }) } + s.SelectJoinUser(m) + return m } 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...) +}