diff --git a/src/gonganxitong/common.go b/src/gonganxitong/common.go index 8ae8047..e5dc247 100644 --- a/src/gonganxitong/common.go +++ b/src/gonganxitong/common.go @@ -52,6 +52,7 @@ type Table struct { marketPlaceInfo string `name:"marketPlaceInfo" role:"void"` messagePlaceInfo string `name:"messagePlaceInfo" role:"void"` applyCreate string `name:"applyCreate" role:"void"` + userInfo string `name:"userInfo" role:"worker" help:"用户信息"` } func (s Table) LoadTrans(m *ice.Message, arg ...string) { @@ -100,8 +101,7 @@ func (s Table) Inputs(m *ice.Message, arg ...string) { } } func (s Table) InputsUID(m *ice.Message, arg []string, target ice.Any, args ...string) { - s.Limit(m, 300) - s.Fields(m, model.UID, model.TITLE) + s.Fields(m, model.UID, model.TITLE, model.USER_UID).Limit(m, 300) m.Cmdy(target, s.Select, args).RenameAppend(model.UID, arg[0]) m.DisplayInputKeyNameIconTitle() } @@ -407,7 +407,6 @@ func (s Table) SettingCmdy(m *ice.Message, arg ...ice.Any) *ice.Message { return m.Cmdy(append([]ice.Any{s.Prefix(m, setting{})}, arg...)...) } func (s Table) AuthCreate(m *ice.Message, authType int, fromUID string, arg ...string) { - m.Info("what %v", m.Option(model.NAME)) s.AutoCmdy(m, api.RENZHENGSHOUQUAN_PORTAL, Portal{}.PlaceCreate, model.AUTH_NAME, m.Option(model.NAME), model.AUTH_INFO, m.Option(model.INFO), model.AUTH_TYPE, authType, model.FROM_UID, kit.Select(ice.AUTO, fromUID), @@ -621,13 +620,11 @@ func PortalCmd(portal ice.Any) { if cmd == nil { return } - cmd.RawHand = path.Join(path.Dir(h), name+".go") what := kit.FileLine(1, 100) - // cmd.Icon = path.Join(path.Dir(what), name) + ".png" nfs.Exists(ice.Pulse, path.Join(path.Dir(what), name)+".png", func(p string) { cmd.Icon = "/p/src/gonganxitong/" + name + ".png?pod=20240724-community" - // ice.Pulse.Resource(p) }) + cmd.RawHand = path.Join(path.Dir(h), name+".go") cmd.Actions[ice.CTX_INIT].Hand = icebergs.MergeHand(func(m *icebergs.Message, arg ...string) { m.Design(mdb.LIST, "", kit.JoinWord(table.Keys(table.Place, model.UID), model.UID, ice.AUTO)) mdb.Config(m, db.DOMAIN, kit.PathName(1)) @@ -644,6 +641,7 @@ func PortalCmd(portal ice.Any) { cmd("contract", contract{Table: table}) cmd("photo", photo{Table: table}) + cmd("clean", clean{Tables: tables}) cmd("credit", credit{Tables: tables}) cmd("member", member{Tables: tables}) cmd("setting", setting{Table: table}) diff --git a/src/gonganxitong/grant.go b/src/gonganxitong/grant.go index 35a1deb..bff1e60 100644 --- a/src/gonganxitong/grant.go +++ b/src/gonganxitong/grant.go @@ -37,7 +37,6 @@ func (s grant) Confirm(m *ice.Message, arg ...string) { } else if msg := s.spaceInfo(m); m.WarnNotFound(msg.Append(mdb.TYPE) == "", m.Option(web.SPACE)) { return } else { - m.Info("what %v", msg.FormatsMeta(nil)) defer m.ProcessOpen(msg.Append(mdb.TEXT)) m.Option(ice.MSG_USERIP, msg.Append(aaa.IP)) m.Option(ice.MSG_USERUA, msg.Append(aaa.UA)) diff --git a/src/gonganxitong/member.go b/src/gonganxitong/member.go index df77bc3..10edccc 100644 --- a/src/gonganxitong/member.go +++ b/src/gonganxitong/member.go @@ -20,6 +20,7 @@ type member struct { promote string `name:"promote" role:"void"` demote string `name:"demote" role:"void"` setCookie string `name:"setCookie" help:"切换"` + setInfo string `name:"setInfo info" help:"备注" role:"void"` main string `name:"main" help:"主页" role:"void"` auth string `name:"auth" help:"认证" role:"void"` } @@ -58,6 +59,9 @@ func (s member) SetCookie(m *ice.Message, arg ...string) { m.Cmdy(s.UserPlace, s.Select, model.UID, m.Option(model.UID)) m.ProcessCookie(model.USER_UID, m.Append(model.USER_UID)) } +func (s member) SetInfo(m *ice.Message, arg ...string) { + m.Cmdy(s.UserPlace, s.Modify, arg) +} func (s member) Main(m *ice.Message, arg ...string) { m.ProcessField(api.RENZHENGSHOUQUAN_PORTAL, []string{m.Option(model.AUTH_UID)}) } @@ -65,10 +69,26 @@ func (s member) Auth(m *ice.Message, arg ...string) { msg := m.Cmd(city{}, s.Select, model.NAME, m.Option(model.CITY_NAME)) m.Cmdy(user{}, s.AuthCreate, kit.Dict(msg.AppendSimple(model.AUTH_UID))) } +func (s Table) UserInfo(m *ice.Message, arg ...string) { + m.Cmdy(s.PrefixPortal(m), s.UserInfo, arg) +} +func (s Portal) UserInfo(m *ice.Message, arg ...string) { + msg := m.Cmd(s.UserPlace, s.Table.Select, s.Keys(s.Place, model.UID), m.Option(model.PLACE_UID), model.USER_UID, m.Option(model.UID)) + m.ProcessField(s.Prefix(m, member{}), []string{m.Option(model.PLACE_UID), msg.Append(model.UID)}, arg...) +} +func (s member) UserInfo(m *ice.Message, arg ...string) { + if msg := m.Cmd(api.RENZHENGSHOUQUAN_AUTH, s.Select, model.USER_UID, m.Option(model.UID)); msg.Append(model.UID) == "" { + m.ProcessHold() + } else { + m.ProcessField(api.RENZHENGSHOUQUAN_PORTAL, []string{msg.Append(model.UID)}, arg...) + } +} func (s member) List(m *ice.Message, arg ...string) { USER_PLACE_ROLE := s.Keys(s.UserPlace, model.ROLE) user_uid, isLeader, isCreator := m.Option(model.USER_UID), s.IsLeader(m), s.IsCreator(m) - s.FieldsWithCreatedAT(m, s.UserPlace, model.USER_UID, s.Keys(s.UserPlace, model.ROLE), s.AS(s.Key(s.UserPlace, model.STATUS), model.MEMBER_STATUS)) + s.FieldsWithCreatedAT(m, s.UserPlace, + model.INFO, + model.USER_UID, s.Keys(s.UserPlace, model.ROLE), s.AS(s.Key(s.UserPlace, model.STATUS), model.MEMBER_STATUS)) s.Limit(m, 300) if len(arg) == 1 { m.Cmdy(s.UserPlace, s.Select, s.Keys(s.Place, model.UID), arg[0]).Action() @@ -89,6 +109,9 @@ func (s member) List(m *ice.Message, arg ...string) { } } button := []ice.Any{} + if value[model.USER_UID] == user_uid || isLeader { + button = append(button, s.SetInfo) + } kit.If(m.IsTech() && value[model.USER_UID] != user_uid, func() { button = append(button, s.SetCookie) }) if value[model.AUTH_UID] == "" { kit.If(value[model.USER_UID] == user_uid, func() { diff --git a/src/gonganxitong/member.js b/src/gonganxitong/member.js index cff045a..c34c3e7 100644 --- a/src/gonganxitong/member.js +++ b/src/gonganxitong/member.js @@ -8,7 +8,7 @@ Volcanos(chat.ONIMPORT, { value.member_status != "normal" && can.onimport.textView(can, value, "member_status"), // can.onimport.titleAction(can, value), ]}, - {view: html.STATUS, list: [value.auth_info||value.user_info]}, + {view: html.STATUS, list: [value.info||value.auth_info||value.user_info]}, can.onimport.titleAction(can, value), ] }) diff --git a/src/gonganxitong/model/model.go b/src/gonganxitong/model/model.go index 135adc6..f6d37ac 100644 --- a/src/gonganxitong/model/model.go +++ b/src/gonganxitong/model/model.go @@ -7,6 +7,7 @@ const ( NAME = "name" INFO = "info" TYPE = "type" + HELP = "help" ROLE = "role" STATUS = "status" TITLE = "title" diff --git a/src/gonganxitong/notice.go b/src/gonganxitong/notice.go index 5d63864..8169140 100644 --- a/src/gonganxitong/notice.go +++ b/src/gonganxitong/notice.go @@ -12,23 +12,21 @@ type notice struct { order string `data:"505"` role string `data:"leader"` fields string `data:"title,content,user_uid"` - create string `name:"create title* content*" role:"void"` - remove string `name:"remove" role:"void"` + create string `name:"create title* content*" role:"leader"` + modify string `name:"modify title* content*" role:"leader"` + remove string `name:"remove" role:"leader"` } func (s notice) Create(m *ice.Message, arg ...string) { - if m.WarnNotRight(!s.IsLeader(m)) { - return - } - m.Option(model.PLACE_UID, m.Option(s.Keys(s.Place, model.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) Modify(m *ice.Message, arg ...string) { + s.Update(m, arg, m.OptionSimple(model.UID, model.PLACE_UID)...) +} func (s notice) Remove(m *ice.Message, arg ...string) { - if m.WarnNotRight(!s.IsLeader(m)) { - return - } - m.Option(model.PLACE_UID, m.Option(s.Keys(s.Place, 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, "") } @@ -37,17 +35,14 @@ func (s notice) List(m *ice.Message, arg ...string) { s.Select(m, model.PLACE_UID, arg[0]) } else if len(arg) == 2 { s.SelectDetail(m, model.PLACE_UID, arg[0], model.UID, arg[1]) - } else { - return } kit.If(s.IsLeader(m), func() { - if m.PushAction(s.Remove); m.Length() == 0 { + if m.PushAction(s.Modify, s.Remove); m.Length() == 0 { s.Button(m, "") } }, func() { m.Action() }) - s.SelectJoinUser(m) } func init() { ice.TeamCtxCmd(notice{Table: newTable()}) } diff --git a/src/gonganxitong/portal.css b/src/gonganxitong/portal.css index 3ce9f2c..c3dad65 100644 --- a/src/gonganxitong/portal.css +++ b/src/gonganxitong/portal.css @@ -1,5 +1,7 @@ -$body.dark { background-color:var(--notice-bg-color); --plugin-bg-color:#0d1117; --output-bg-color:#171a22; } +$body.dark:not(.width1) { background-color:var(--notice-bg-color); } +$body.dark { --plugin-bg-color:#0d1117; --output-bg-color:#171a22; } $body.light { background-color:#dbe7fe; --plugin-bg-color:#f3f3f4; --output-bg-color:white; --notice-bg-color:#006fff; } +$body.light { background-color:#dbe7fe; --plugin-bg-color:#f2f4f8; --output-bg-color:white; --notice-bg-color:#006fff; } $body.width1 fieldset.Action div.input.float { position:static; } $body.width1 fieldset.Action div.input.float table { width:100%; } $body.width1 div.upload.float div.action { display:flex; } @@ -7,9 +9,16 @@ $body.width1 div.upload.float div.action div.item.upload { flex-grow:1; } $body.width1 div.upload.float div.action div.item.upload input { width:100%; } $body.width1 $action div.item.text.filter { flex-grow:1; } $action { background-color:transparent; position:absolute; top:0; width:100%; z-index:1; display:none; } -$action div.item:last-child { margin-right:10px; } -$action div.item.text.filter input { width:100%; } -$action div.item { margin-left:10px; margin-right:0; padding:0; height:48px; align-items:center; } +$action div.item.filter input { border-radius:20px; border:none; } +// $action div.item:last-child { margin-right:10px; } +// $action div.item.text.filter { padding:0 10px; } +$action div.item.text.filter:last-child { margin-right:10px; } +$action div.item.text.filter i { padding-left:10px; } +$action div.item.text.filter span { right:5px; } +$action div.item.text.filter input { padding-left:32px; padding-right:32px; width:100%; } +$action div.item.text.filter input:focus { border:var(--box-border); } +// $action div.item { margin-left:5px; margin-right:0; padding:0; height:48px; align-items:center; } +$action div.item { margin-right:0; padding:0; height:48px; align-items:center; } $action div.item.button input { border:none; background-color:var(--plugin-bg-color); color:var(--notice-bg-color); min-width:60px; display:unset; } $action div.item.button input:hover { background-color:var(--hover-bg-color); } $action div.item.button span { display:none; } @@ -17,7 +26,7 @@ $action div.item.button i { display:none; } $output div.title div.action div.item.notice input { background-color:var(--notice-bg-color); color:var(--notice-fg-color); } $output { background-color:var(--plugin-bg-color); } $output>div.header { background-image:linear-gradient(var(--notice-bg-color), var(--plugin-bg-color)); height:240px; width:100%; position:absolute; left:0; } -$body.light $output>div.header { background-image:linear-gradient(#dbe7fe, var(--plugin-bg-color)); height:240px; width:100%; position:absolute; left:0; } +body.light $output>div.header { background-image:linear-gradient(#dbe7fe, var(--plugin-bg-color)); height:240px; width:100%; position:absolute; left:0; } $output>div.header img { height:100%; width:100%; object-fit:cover; } $output>div.action>div.list { margin:0 10px; } $output div.output>div.code { font-size:16px; position:relative; } @@ -45,6 +54,7 @@ body.width1 $output fieldset.story>div.output>div.place_info>div.item>div.output body.width1 $output fieldset.story>div.output>table.detail tr.user_name { display:none; } body.width1 $output fieldset.story>div.output>table.detail tr.user_avatar { display:none; } body.width1 $output fieldset.story>div.output>table.detail tr.created_at { display:none; } +body.width1 $output fieldset.story>div.output>table.detail tr.updated_at { display:none; } $output>div>div.list.myallow>div.title { border-left:var(--box-danger3); padding-left:10px; } $output>div>div.list.myorder>div.title { border-left:var(--box-danger3); padding-left:10px; } $output>div>div.list>div.title span:first-child { flex-grow:1; } @@ -69,6 +79,7 @@ $output>div>div.list>div.output>div.item.index span { font-size:12px; white-spac $output>div>div.list div.code { text-align:center; } $output>div>div.list div.code input { background-color:var(--notice-bg-color); color:var(--notice-fg-color); font-size:18px; margin:auto; min-width:200px; display:block; margin-top:10px; } $output>div>div.list fieldset.story>div.output { background-color:var(--plugin-bg-color); } +// $output>div>div.list fieldset.story.web.team.dashboard.summary>div.output { min-height:64px; background-color:var(--output-bg-color); } $output div.head>img { height:200px; width:100%; object-fit:cover; } $output div.head div.item.card img { border-radius:25px; } $output div.head>div.item.card div.title div.item.button i { display:none; } @@ -87,6 +98,7 @@ $output div.item.card div.title span.auth { font-size:14px; padding:3px; } $output div.item.card div.title span.time { position:absolute; right:0; font-size:12px; color:gray; } $output div.item.card div.title span:first-child { word-break:break-all; } $output fieldset.story>div.item.card div.title span { line-height:26px; } +$output fieldset.story>div.output { background-color:var(--plugin-bg-color); } $output div.item.title { border-left:var(--box-notice3); margin-left:10px; padding:10px; background-color:var(--plugin-bg-color); } $output div.item.title.dealList { border-left:var(--box-danger3); } $output div.item.title.meetList { border-left:var(--box-danger3); } @@ -96,11 +108,12 @@ $output div.item.card div.status span { word-break:break-all; } $output div.item.card img { border-radius:5px; padding:0; margin:0; margin-right:10px; height:48px; width:48px; min-width:48px; object-fit:cover; } $output div.item.card div.container img { margin-right:0; height:100%; width:100%; } $output div.item.card div.container>div.action { position:relative; float:right; } +$output div.item.card div.container>div.action input { padding:0 10px; margin-left:0; margin-right:0; } body:not(.mobile) $output div.item.card div.container>div.action { display:none; } body.mobile $output div.item.card div.container>div.title>span.status { margin-left:auto; } $output div.item.card.sticky>div.output { background-color:var(--plugin-bg-color); color:var(--notice-bg-color); } // $action div.item.notice input[type=button] { border:var(--box-notice); color:var(--notice-bg-color); } -$action div.item input[type=button] { min-width:20px; padding:0 5px; } +$action div.item input[type=button] { min-width:20px; padding:0 10px; } $action div.item input[type=button] { color:var(--notice-bg-color); } // $action div.item input[type=button] { border:var(--box-notice); color:var(--notice-bg-color); } // $action div.item.text input { border:var(--box-notice); color:var(--notice-bg-color); } @@ -124,13 +137,15 @@ $output table.content { background-color:var(--output-bg-color); } $output table.content td.action input.icons { display:unset; } $output table.content td.action i { display:none; } $output table.content.detail thead { display:none; } -$output table.content.detail td.action input { padding:0 10px; min-width:60px; } +// $output table.content.detail td.action input { padding:0 10px; min-width:60px; margin-right:0; } $output table.content.detail tr.action input.icons { display:unset; } $output table.content.detail tr.action i { display:none; } +$output table.content.detail tr.action input[type=button] { padding:0 10px; margin-right:0; } $output table.content.detail tr.uid { display:none; } $output table.content.detail input { border:none; } $output fieldset.story.otherList>div.output { max-height:unset !important; } +$output fieldset.story.otherList>div.output>div.list { height:unset !important; } $output fieldset.story>div.output>div.tabs { background-color:var(--plugin-bg-color); display:flex; overflow:auto; position:sticky; top:0; z-index:2; } $output fieldset.story>div.output>div.tabs>div.item { white-space:pre; line-height:22px; padding:5px; } $output fieldset.story>div.output>div.tabs>div.item.select { border-top:var(--box-notice); background-color:var(--output-bg-color); } @@ -196,7 +211,7 @@ body:not(.width1) $output div.item.card { flex-direction:row-reverse; } body:not(.width1) $output div.item.card>div.action { position:static; flex-shrink:0; } body:not(.width1) $output div.item.card>div.output { flex-grow:1; } body:not(.width1) $output div.item.card div.title div.action { display:none; } -body:not(.mobile) $output>fieldset.story>div.output div.item.card:not(:hover) { background-color:var(--output-bg-color); } +body:not(.mobile) $output fieldset.story>div.output div.item.card:not(:hover) { background-color:var(--output-bg-color); } body:not(.mobile) $output div.tabs span:hover { background-color:var(--hover-bg-color); } body:not(.mobile) $output>div>div.list>div.role span:hover { background-color:var(--hover-bg-color); } body:not(.mobile) $output fieldset.story>div.output>div.code>input[type=button]:hover { border:var(--box-notice); background-color:transparent; color:var(--notice-bg-color); } diff --git a/src/gonganxitong/portal.go b/src/gonganxitong/portal.go index 48c32e3..2614f6f 100644 --- a/src/gonganxitong/portal.go +++ b/src/gonganxitong/portal.go @@ -110,11 +110,11 @@ func (s Portal) Run(m *ice.Message, arg ...string) { if s.UserPlaceRole(m); kit.IsIn(role, "", aaa.VOID, aaa.TECH, aaa.ROOT) { kit.If(!ctx.PodCmd(m.Message, arg) && aaa.Right(m.Message, arg), func() { m.Cmdy(arg) }) } else { - if role == "worker" { + if kit.IsIn(role, "worker") { if !m.WarnNotRight(!s.IsWorker(m)) { m.Cmdy(arg) } - } else if role == "leader" { + } else if kit.IsIn(role, "leader") { if !m.WarnNotRight(!s.IsLeader(m)) { m.Cmdy(arg) } diff --git a/src/gonganxitong/portal.js b/src/gonganxitong/portal.js index 17ed4b1..da1d3bd 100644 --- a/src/gonganxitong/portal.js +++ b/src/gonganxitong/portal.js @@ -264,7 +264,6 @@ Volcanos(chat.ONEXPORT, { place: function(can, value) { return can.onexport.session(can, PLACE_UID, value) }, value: function(can, value) { if (!value || !value._uid) { return } can.sup.current = value, can.onexport.index(can, can.sup.current) can.onexport.place(can, value._uid), can.onexport.hash(can, value._uid), can.onexport.title(can, value._name, can.ConfHelp()) - // can.user.agent.init(can, value.city_name+" "+value._street) can.page.Select(can, can.ui._target, "div.item.card.uid-"+value._uid, function(target) { can.onmotion.select(can, can.ui._target, html.DIV_ITEM, target) can.onmotion.scrollIntoView(can, target) diff --git a/src/gonganxitong/portal.json b/src/gonganxitong/portal.json index e4baeec..4a7d715 100644 --- a/src/gonganxitong/portal.json +++ b/src/gonganxitong/portal.json @@ -35,6 +35,7 @@ "approve": "notice", "disable": "danger", "enable": "notice", + "userInfo": "notice", "placeRemove": "danger", "authPersonal": "notice" }, diff --git a/src/gonganxitong/service.go b/src/gonganxitong/service.go index eecbb09..7dc4abe 100644 --- a/src/gonganxitong/service.go +++ b/src/gonganxitong/service.go @@ -97,6 +97,9 @@ func (s service) Autogen(m *ice.Message, arg ...string) { func (s service) Compile(m *ice.Message, arg ...string) { m.Cmdy(code.VIMER, code.COMPILE) } +func (s service) Remove(m *ice.Message, arg ...string) { + s.Delete(m, m.OptionSimple(model.UID)...) +} func (s service) List(m *ice.Message, arg ...string) { if len(arg) < 2 { s.Orders(m, s.Desc(model.STATUS), s.Desc(model.UPDATED_AT)).Select(m) @@ -107,10 +110,10 @@ func (s service) List(m *ice.Message, arg ...string) { button := []ice.Any{s.Open} defer func() { m.PushButton(button...) }() if m.IsTech() { - button = append(button, s.Conf, s.Code, s.Data) + button = append(button, s.Conf, s.Code, s.Data, s.Clean) switch ServiceStatus(kit.Int(value[model.STATUS])) { case ServiceOffline: - button = append(button, s.Online) + button = append(button, s.Online, s.Remove) case ServiceOnline: button = append(button, s.Offline) } @@ -134,6 +137,9 @@ func (s service) Code(m *ice.Message, arg ...string) { func (s service) Data(m *ice.Message, arg ...string) { s.spaceOpen(m, web.CODE_MYSQL_QUERY, aaa.SESS, "mysql", mdb.DATABASE, s.name(m)) } +func (s service) Clean(m *ice.Message, arg ...string) { + s.spaceOpen(m, strings.ReplaceAll(m.Option(ctx.INDEX), "portal", "clean")) +} func (s service) Online(m *ice.Message, arg ...string) { s.Table.Update(m, kit.Simple(model.STATUS, ServiceOnline), m.OptionSimple(model.UID)...) } diff --git a/src/gonganxitong/service.js b/src/gonganxitong/service.js index c2c49f1..8051b13 100644 --- a/src/gonganxitong/service.js +++ b/src/gonganxitong/service.js @@ -1,11 +1,8 @@ Volcanos(chat.ONIMPORT, { _init: function(can, msg) { - can.onimport.myView(can, msg, function(value) { - value._style = value.service_status + can.onimport.myView(can, msg, function(value) { value._style = value.service_status value.icons = can.misc.Resource(can, value.icon.split("?")[0], value.space) - if (value.service_status == "offline" && !msg.IsTech()) { - return - } + if (value.service_status == "offline" && !msg.IsTech()) { return } return [ {view: html.TITLE, list: [value.name]}, {view: html.STATUS, list: [value.index]}, diff --git a/src/gonganxitong/setting.go b/src/gonganxitong/setting.go index f0565ae..195fbfa 100644 --- a/src/gonganxitong/setting.go +++ b/src/gonganxitong/setting.go @@ -14,8 +14,8 @@ type setting struct { order string `data:"103"` role string `data:"leader,worker,server"` short string `data:"name"` - field string `data:"name,type,help"` - fields string `data:"name,value"` + field string `data:"name,type,help,scope"` + fields string `data:"name,value,user_uid"` create string `name:"create name* type* help" role:"tech"` update string `name:"update" role:"void"` placeTrash string `name:"placeTrash" help:"删除数据" style:"danger" role:"leader"` @@ -28,20 +28,48 @@ func (s setting) Init(m *ice.Message, arg ...string) { func (s setting) Create(m *ice.Message, arg ...string) { s.Hash.Create(m, arg...) } +func (s Table) SettingCreate(m *ice.Message, arg ...string) { + m.Cmdy(s.Prefix(m, setting{}), s.Create, model.NAME, arg[0], model.TYPE, arg[1], arg[2:]) +} +func (s Table) SettingSelect(m *ice.Message, arg ...string) { + m.Cmd(s.Prefix(m, setting{}), s.Select, m.OptionSimple(model.PLACE_UID)).Table(func(value ice.Maps) { + m.Info("what %v", value) + if value[model.USER_UID] != "" && value[model.USER_UID] != m.Option(model.USER_UID) { + return + } + m.Option(value[model.NAME], value[model.VALUE]) + }) +} func (s setting) Update(m *ice.Message, arg ...string) { - m.OptionDefault(model.PLACE_UID, m.Option(s.Keys(s.Place, model.UID))) - if s.Table.Select(m.Spawn(), m.OptionSimple(model.PLACE_UID, model.USER_UID, model.NAME)...).Length() == 0 { - s.Table.Insert(m, m.OptionSimple(model.PLACE_UID, model.USER_UID, model.NAME, model.VALUE)...) + msg := s.Hash.Select(m.Spawn(), m.Option(model.NAME)) + args := m.OptionSimple(model.PLACE_UID, model.USER_UID, model.NAME) + kit.If(msg.Append("scope") == "place" && s.IsCreator(m), func() { args = m.OptionSimple(model.PLACE_UID, model.NAME) }) + // m.OptionDefault(model.PLACE_UID, m.Option(s.Keys(s.Place, model.UID))) + if s.Table.Select(m.Spawn(), args...).Length() > 0 { + s.Table.Update(m, kit.Dict(m.OptionSimple(model.VALUE)), args...) } else { - s.Table.Update(m, kit.Dict(m.OptionSimple(model.VALUE)), m.OptionSimple(model.PLACE_UID, model.USER_UID, model.NAME)...) + s.Table.Insert(m, kit.Simple(m.OptionSimple(model.VALUE), args)...) } } func (s setting) List(m *ice.Message, arg ...string) { if len(arg) == 1 { data := ice.Maps{} - msg := s.Select(m.Spawn(), model.PLACE_UID, arg[0], model.USER_UID, m.Option(model.USER_UID)) + args := kit.Simple("place_uid = ? AND user_uid = ?", arg[0], m.Option(model.USER_UID)) + if s.IsCreator(m) { + args = kit.Simple("place_uid = ? AND (user_uid = ? OR user_uid IS NULL OR user_uid = '')", arg[0], m.Option(model.USER_UID)) + } + msg := s.Select(m.Spawn(), args...) msg.Table(func(value ice.Maps) { data[value[model.NAME]] = value[model.VALUE] }) - s.Hash.List(m).Table(func(value ice.Maps) { m.Push(model.VALUE, data[value[model.NAME]]) }).Action() + s.Hash.List(m.Spawn()).Table(func(value ice.Maps) { + if value["scope"] == "place" && !s.IsCreator(m) { + // m.Push(model.VALUE, "") + } else { + m.Push(model.NAME, value[model.NAME]) + m.Push(model.TYPE, value[model.TYPE]) + m.Push(model.HELP, value[model.HELP]) + m.Push(model.VALUE, data[value[model.NAME]]) + } + }).Action() } else if len(arg) == 2 { s.SelectDetail(m, model.PLACE_UID, arg[0], model.USER_UID, m.Option(model.USER_UID), model.NAME, arg[1]) } diff --git a/src/gonganxitong/setting.js b/src/gonganxitong/setting.js index 53b4e91..f298700 100644 --- a/src/gonganxitong/setting.js +++ b/src/gonganxitong/setting.js @@ -1,7 +1,7 @@ Volcanos(chat.ONIMPORT, { _init: function(can, msg) { can.page.Append(can, can._output, msg.Table(function(value) { - return {view: html.ITEM, list: [{text: [can.user.trans(can, value.name, null, "value.setting"), "", mdb.NAME]}, can.onimport[value.type](can, value)]} + return {view: html.ITEM, list: [{text: [value.help||can.user.trans(can, value.name, null, "value.setting"), "", mdb.NAME]}, can.onimport[value.type](can, value)]} })) }, radio: function(can, value) { diff --git a/src/renzhengshouquan/external/tencentcloud/smh/smh.go b/src/renzhengshouquan/external/tencentcloud/smh/smh.go index 36988b6..88e9abe 100644 --- a/src/renzhengshouquan/external/tencentcloud/smh/smh.go +++ b/src/renzhengshouquan/external/tencentcloud/smh/smh.go @@ -159,7 +159,6 @@ func (s smh) spaceSize(m, msg *ice.Message, arg ...string) { } func (s smh) Rename(m *ice.Message, arg ...string) { msg := s.token(m) - m.Info("what %v", m.FormatChain()) s.spide(m, http.MethodPut, kit.MergeURL(kit.Format("file/%s/%s/%s", msg.Append(model.LIBRARY_ID), arg[1], m.Option("newname")), msg.AppendSimple(model.ACCESS_TOKEN)), "from", m.Option(model.NAME)) } func (s smh) Trash(m *ice.Message, arg ...string) {