From 99f04b17b957ac186eaa40ae7ab861f6466c15e3 Mon Sep 17 00:00:00 2001 From: jingganjiaoyu Date: Sat, 7 Sep 2024 17:11:02 +0800 Subject: [PATCH] opt some --- src/gonganxitong/comment.go | 17 ++++ src/gonganxitong/common.go | 56 +++++++++--- src/gonganxitong/common.js | 2 +- src/gonganxitong/domain.go | 25 ++++++ src/gonganxitong/favor.go | 10 +++ src/gonganxitong/market.go | 86 +++++++++++++++++++ src/gonganxitong/market.js | 57 ++++++++++++ src/gonganxitong/message.go | 18 +--- src/gonganxitong/model/model.go | 60 ++++++++++++- src/gonganxitong/notice.go | 25 ++++++ src/gonganxitong/portal.css | 22 ++++- src/gonganxitong/portal.go | 71 +++++++++++---- src/gonganxitong/portal.js | 56 ++++++------ src/gonganxitong/portal.json | 8 +- src/gonganxitong/recent.go | 2 +- src/gonganxitong/support.go | 2 +- src/gonganxitong/thumb.go | 22 +++++ src/main.go | 2 +- src/renzhengshouquan/auth.go | 3 + src/renzhengshouquan/model/model.go | 12 +-- src/template/web.code.js/demo.js | 2 +- src/yuehaoxitong/portal.go | 10 +++ src/yuehaoxitong/schedule.go | 3 + usr/local/export/web.chat.wx.menu/hash.json | 4 +- .../web.team.gonganxitong.portal/hash.json | 20 +++++ .../web.team.guanlixitong.portal/hash.json | 20 +++++ .../web.team.huodongzuzhi.portal/hash.json | 20 +++++ .../hash.json | 20 +++++ .../web.team.yuehaoxitong.portal/hash.json | 21 +++++ 29 files changed, 587 insertions(+), 89 deletions(-) create mode 100644 src/gonganxitong/comment.go create mode 100644 src/gonganxitong/domain.go create mode 100644 src/gonganxitong/favor.go create mode 100644 src/gonganxitong/market.go create mode 100644 src/gonganxitong/market.js create mode 100644 src/gonganxitong/notice.go create mode 100644 src/gonganxitong/thumb.go diff --git a/src/gonganxitong/comment.go b/src/gonganxitong/comment.go new file mode 100644 index 0000000..f56aa72 --- /dev/null +++ b/src/gonganxitong/comment.go @@ -0,0 +1,17 @@ +package gonganxitong + +import ( + "shylinux.com/x/ice" + + "shylinux.com/x/community/src/gonganxitong/model" +) + +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)...)...) +} +func (s comment) List(m *ice.Message, arg ...string) { +} + +func init() { ice.TeamCtxCmd(comment{}) } diff --git a/src/gonganxitong/common.go b/src/gonganxitong/common.go index 5ba8e13..580d89f 100644 --- a/src/gonganxitong/common.go +++ b/src/gonganxitong/common.go @@ -12,6 +12,7 @@ import ( "shylinux.com/x/icebergs/base/ctx" "shylinux.com/x/icebergs/base/mdb" "shylinux.com/x/icebergs/base/web" + "shylinux.com/x/icebergs/base/web/html" kit "shylinux.com/x/toolkits" "shylinux.com/x/community/src/gonganxitong/model" @@ -135,7 +136,10 @@ func (s Table) ValueList(m *ice.Message, arg []string, fields ...ice.Any) *ice.M kit.If(len(fields) == 0, func() { fields = kit.TransArgs(kit.Split(m.Config(mdb.FIELDS))) }) defer m.Options(db.FIELDS, fields).Set(ice.MSG_OPTION, db.FIELDS) defer m.Options(db.TARGET, m.CommandKey()).Set(ice.MSG_OPTION, db.TARGET) - return s.ValueModel(m, s.ValueList, arg...).PushAction(s.Remove).Action(s.Create) + s.ValueModel(m, s.ValueList, arg...).PushAction(s.Remove).Action(s.Create) + kit.If(m.Length() > 0, func() { s.UserPlaceInit(m) }) + s.Button(m, "") + return m } func (s Table) List(m *ice.Message, arg ...string) *ice.Message { if m.IsTech() { @@ -164,7 +168,7 @@ func (s Table) SelectJoinCity(m *ice.Message) *ice.Message { } func (s Table) SelectJoinAuth(m *ice.Message) *ice.Message { defer m.Options(ice.MSG_USERROLE, aaa.VOID) - return s.SelectJoin(m, s.FindSpaceCmd(m, web.TEAM_RENZHENGSHOUQUAN_AUTH), model.NAME, model.STATUS) + return s.SelectJoin(m, s.FindSpaceCmd(m, web.TEAM_RENZHENGSHOUQUAN_AUTH), model.NAME, model.STATUS, model.DASHBOARD_UID) } func (s Table) RenameAppend(m *ice.Message, arg ...string) Table { m.RenameAppend(arg...) @@ -238,6 +242,14 @@ 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) 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) RecordEvent(m *ice.Message, info string, arg ...string) { m.Cmd(s.Prefix(m, Portal{}), s.RecordEvent, info, arg) } @@ -283,6 +295,10 @@ func (s Portal) SendTemplate(m *ice.Message, arg ...string) { link := s.Link(m, place_uid, arg[0], uid) 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.EchoInfoButton(info, arg...) }) + return m +} func (s Table) DisplayBase(m *ice.Message, file string) *ice.Message { if s.Place != nil { m.Option("_place_uid", s.ToLower(kit.TypeName(s.Place))+"_uid") @@ -332,6 +348,19 @@ func (s Table) Prefix(m *ice.Message, target ice.Any) string { func (s Table) PrefixPortal(m *ice.Message) string { return m.Prefix(kit.TypeName(Portal{})) } +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.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] }) + return value + }) + 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.Option("field.option", kit.Format(kit.Dict(arg))) + return m +} func (s Table) SpaceCmd(m *ice.Message, space string, arg ...ice.Any) *ice.Message { if space == ice.Info.NodeName { return m.Cmd(arg...) @@ -340,14 +369,18 @@ func (s Table) SpaceCmd(m *ice.Message, space string, arg ...ice.Any) *ice.Messa } } func (s Table) FindSpaceCmd(m *ice.Message, cmd ice.Any) ice.Any { - switch cmds := ice.GetTypeKey(cmd); cmds { - case web.TEAM_GONGANXITONG_USER, web.TEAM_RENZHENGSHOUQUAN_AUTH, web.CODE_MYSQL_CLIENT: - if ice.Info.NodeName == "20240724-community" { - return cmd - } else { - m.Options(ice.MSG_USERROLE, aaa.TECH) - return []string{web.SPACE, kit.Keys(ice.OPS, "20240724-community"), cmds} - } + route := map[string]string{ + "web.team.dashboard.portal": "20240903-operation", + "web.team.dashboard.summary": "20240903-operation", + "web.team.renzhengshouquan.portal": "20240724-community", + web.TEAM_RENZHENGSHOUQUAN_AUTH: "20240724-community", + web.TEAM_GONGANXITONG_USER: "20240724-community", + web.CODE_MYSQL_CLIENT: "20240724-community", + } + cmds := ice.GetTypeKey(cmd) + if space, ok := route[cmds]; ok && space != ice.Info.NodeName { + m.Options(ice.MSG_USERROLE, aaa.TECH) + return []string{web.SPACE, kit.Keys(ice.OPS, space), cmds} } return cmd } @@ -389,7 +422,10 @@ func PortalCmd(portal ice.Any) { cmd("event", event{Table: table}) cmd("apply", apply{Table: table}) cmd("allow", allow{Table: table}) + cmd("notice", notice{Table: table}) + cmd("domain", domain{Table: table}) cmd("member", member{Tables: Tables{Table: table}}) + cmd("market", market{Table: table}) cmd("message", message{Table: table}) cmd("recent", recent{Table: table}) cmd("service", service{Table: table}) diff --git a/src/gonganxitong/common.js b/src/gonganxitong/common.js index 5dc1089..9bbc273 100644 --- a/src/gonganxitong/common.js +++ b/src/gonganxitong/common.js @@ -4,7 +4,7 @@ Volcanos(chat.ONIMPORT, { PLACE_TYPE || can.core.List(msg.append, function(key) { can.base.endWith(key, "_type") && (PLACE_TYPE = key), can.base.endWith(key, "_role") && (USER_PLACE_ROLE = key) }) can.onimport.itemcards(can, msg, function(value) { return [ {view: html.TITLE, list:[value.title||value.name||value.user_name, can.onimport.textView(can, value, PLACE_TYPE), can.onimport.textView(can, value, USER_PLACE_ROLE)]}, - {view: html.STATUS, list: [value.city_name, value.street_name, value.company_name]}, + {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)]}, value.address && {view: html.STATUS, list: [value.address]}, value.content && {view: html.OUTPUT, list: [value.content]}, diff --git a/src/gonganxitong/domain.go b/src/gonganxitong/domain.go new file mode 100644 index 0000000..a1ad1d8 --- /dev/null +++ b/src/gonganxitong/domain.go @@ -0,0 +1,25 @@ +package gonganxitong + +import ( + "shylinux.com/x/ice" + + "shylinux.com/x/community/src/gonganxitong/model" +) + +type domain struct { + Table + create string `name:"create name* info" role:"void"` + remove string `name:"remove" role:"void"` +} + +func (s domain) List(m *ice.Message, arg ...string) { + if len(arg) == 0 { + s.Select(m) + } else if len(arg) == 1 { + s.Select(m) + } else if len(arg) == 2 { + s.Select(m, model.UID, arg[1]) + } +} + +func init() { ice.TeamCtxCmd(domain{Table: newTable()}) } diff --git a/src/gonganxitong/favor.go b/src/gonganxitong/favor.go new file mode 100644 index 0000000..d61156e --- /dev/null +++ b/src/gonganxitong/favor.go @@ -0,0 +1,10 @@ +package gonganxitong + +import "shylinux.com/x/ice" + +type favor struct { + Table + thumb +} + +func init() { ice.TeamCtxCmd(favor{}) } diff --git a/src/gonganxitong/market.go b/src/gonganxitong/market.go new file mode 100644 index 0000000..a2e1007 --- /dev/null +++ b/src/gonganxitong/market.go @@ -0,0 +1,86 @@ +package gonganxitong + +import ( + "shylinux.com/x/ice" + kit "shylinux.com/x/toolkits" + + "shylinux.com/x/community/src/gonganxitong/model" +) + +type market struct { + Table + domain domain + command command + service service + thumb thumb + comment comment + favor favor + order string `data:"100"` + 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"` + 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( + model.CITY_NAME, model.STREET_NAME, model.PLACE_NAME, + model.COMMAND_UID, model.PLACE_UID, model.USER_UID, model.ARGS, + )...)...) +} +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, + s.Key(s, model.CITY_NAME), s.Key(s, model.STREET_NAME), s.Key(s, model.PLACE_NAME), model.SERVICE_NAME, + 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) != "" { + s.Select(m, m.OptionSimple(model.DOMAIN_UID)...) + } else { + s.Select(m) + } + } 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]) + } else { + return + } + s.SelectJoinUser(m, model.NAME, model.AVATAR, model.AUTH_UID) + s.SelectJoinAuth(m) + m.Action().Display("") +} +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)) + } else { + s.AddCount(m, model.THUMB_COUNT, "-1", m.Option(model.UID)) + } +} +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)) +} +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)) + } else { + s.AddCount(m, model.FAVOR_COUNT, "-1", m.Option(model.UID)) + } +} +func (s market) ShareCreate(m *ice.Message, arg ...string) { + s.AddCount(m, model.SHARE_COUNT, "1", m.Option(model.UID)) +} + +func init() { ice.TeamCtxCmd(market{Table: newTable()}) } diff --git a/src/gonganxitong/market.js b/src/gonganxitong/market.js new file mode 100644 index 0000000..023e260 --- /dev/null +++ b/src/gonganxitong/market.js @@ -0,0 +1,57 @@ +Volcanos(chat.ONIMPORT, { + _init: function(can, msg) { + can.ui = can.page.Append(can, can._output, ["tabs", "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? "": "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? "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) + }, + _data: function(can, msg) { can.onmotion.clear(can, can.ui.list) + can.onimport.itemcards(can, msg, function(value) { return [ + {view: html.STATUS, list: [{text: [value.user_name, "", "username"]}, can.onimport.authView(can, value), can.onimport.timeView(can, value)]}, + {view: html.STATUS, list: [ + // {text: [value.city_name, "", "street"]}, + {text: [value.street_name, "", "street"]}, + {text: [value.place_name, "", "place"]}, + {text: [value.service_name.split(" ")[0], "", "service"]}, + ]}, + {view: html.TITLE, list: [value.title]}, + {view: html.OUTPUT, list: [value.content]}, + {view: html.ACTION, list: [ + {view: html.ITEM, list: [{icon: "bi bi-hand-thumbs-up"}, {text: value.thumb_count||"点赞"}], onclick: function(event) { + can.onimport.thumbs(event, can, value, "thumbToggle") + }, className: value.thumb_status%2==1? "done": ""}, + {view: html.ITEM, list: [{icon: "bi bi-chat-left-text"}, {text: value.comment_count||"评论"}], onclick: function(event) { + can.onimport.thumbs(event, can, value, "commentCreate") + }}, + {view: html.ITEM, list: [{icon: "bi bi-star"}, {text: value.favor_count||"收藏"}], onclick: function(event) { + can.onimport.thumbs(event, can, value, "favorToggle") + }, className: value.favor_status%2==1? "done": ""}, + {view: html.ITEM, list: [{icon: "bi bi-box-arrow-up"}, {text: value.share_count||"分享"}], onclick: function(event) { + 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, "span") + can.run(can.request(event, value), [ctx.ACTION, 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) + }, +}) \ No newline at end of file diff --git a/src/gonganxitong/message.go b/src/gonganxitong/message.go index 1879265..04a19c0 100644 --- a/src/gonganxitong/message.go +++ b/src/gonganxitong/message.go @@ -3,8 +3,6 @@ package gonganxitong import ( "shylinux.com/x/ice" "shylinux.com/x/icebergs/base/ctx" - "shylinux.com/x/icebergs/base/web" - "shylinux.com/x/icebergs/base/web/html" kit "shylinux.com/x/toolkits" "shylinux.com/x/community/src/gonganxitong/model" @@ -14,7 +12,7 @@ type message struct { Table command command service service - order string `data:"100"` + order string `data:"103"` create string `name:"create from_user_uid to_user_uid"` read string `name:"read" role:"void"` done string `name:"done" role:"void"` @@ -23,9 +21,6 @@ type message struct { } func (s message) Create(m *ice.Message, arg ...string) { - m.Info("what %v", m.FormatChain()) - m.Info("what %v", m.Option(s.Keys(s.Place, model.UID))) - m.Info("what %v", s.Keys(s.Place, model.UID)) kit.If(m.Option(ctx.ARGS) == "", func() { arg = append(arg, ctx.ARGS, kit.Join([]string{m.Option(s.Keys(s.Place, model.UID)), m.Option(model.UID)})) }) @@ -61,16 +56,7 @@ func (s message) List(m *ice.Message, arg ...string) { s.DisplayBase(m, "") } else if len(arg) == 2 { msg := s.SelectDetail(m.Spawn(), model.TO_USER_UID, m.Option(model.USER_UID), s.Key(s, model.UID), arg[1]) - m.ProcessPodCmd(msg.Append(web.SPACE), msg.Append(ctx.INDEX), kit.Split(msg.Append(ctx.ARGS))) - 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] }) - return value - }) - if m.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.Option("field.option", kit.Format(kit.Dict(model.MESSAGE_UID, arg[1]))) + s.ProcessPodCmd(m, msg, model.MESSAGE_UID, arg[1]) if m.Option(model.MESSAGE_STATUS) == MessageCreate.String() { s.update(m.Spawn(kit.Dict(model.UID, arg[1])), kit.Dict(model.STATUS, MessageRead), model.STATUS, MessageCreate) } diff --git a/src/gonganxitong/model/model.go b/src/gonganxitong/model/model.go index 5885f8b..1a1b384 100644 --- a/src/gonganxitong/model/model.go +++ b/src/gonganxitong/model/model.go @@ -43,7 +43,12 @@ const ( ALLOW_STATUS = "allow_status" EVENT_UID = "event_uid" PORTAL_NAME = "portal_name" + DOMAIN_UID = "domain_uid" + DOMAIN_NAME = "domain_name" COMMAND_UID = "command_uid" + COMMAND_ICON = "command_icon" + COMMAND_NAME = "command_name" + MARKET_UID = "market_uid" MESSAGE_UID = "message_uid" MESSAGE_STATUS = "message_status" SERVICE_UID = "service_uid" @@ -51,6 +56,16 @@ const ( SERVICE_NAME = "service_name" SERVICE_TYPE = "service_type" SERVICE_STATUS = "service_status" + DASHBOARD_UID = "dashboard_uid" + THUMB_COUNT = "thumb_count" + FAVOR_COUNT = "favor_count" + COMMENT_COUNT = "comment_count" + SHARE_COUNT = "share_count" + THUMB_STATUS = "thumb_status" + FAVOR_STATUS = "favor_status" + CLIENT_UID = "client_uid" + CLIENT_NAME = "client_name" + CLIENT_TYPE = "client_type" FROM_UID = "from_uid" FROM_USER_UID = "from_user_uid" TO_USER_UID = "to_user_uid" @@ -65,6 +80,7 @@ const ( SPACE = "space" OPERATE = "operate" INDEX = "index" + QUERY = "query" ARGS = "args" INIT = "init" SCORE = "score" @@ -125,6 +141,46 @@ type Event struct { UserUID string `gorm:"type:char(32)"` Info string `gorm:"type:varchar(255)"` } +type Notice struct { + db.ModelContent + PlaceUID string `gorm:"type:char(32);index"` + UserUID string `gorm:"type:char(32)"` +} +type Domain struct { + db.ModelNameInfo +} +type Market struct { + db.ModelCommand + DomainUID string `gorm:"type:char(32);index"` + CommandUID string `gorm:"type:char(32)"` + PlaceUID string `gorm:"type:char(32)"` + UserUID string `gorm:"type:char(32)"` + Title string `gorm:"type:varchar(64)"` + Content string + ThumbCount int `gorm:"default:0"` + CommentCount int `gorm:"default:0"` + FavorCount int `gorm:"default:0"` + ShareCount int `gorm:"default:0"` +} +type Thumb struct { + db.ModelWithUID + MarketUID string `gorm:"type:char(32);index"` + UserUID string `gorm:"type:char(32);index"` + Status uint `gorm:"default:0"` +} +type Comment struct { + db.ModelWithUID + MarketUID string `gorm:"type:char(32);index"` + UserUID string `gorm:"type:char(32);index"` + CommentUID string `gorm:"type:char(32)"` + Content string +} +type Favor struct { + db.ModelWithUID + MarketUID string `gorm:"type:char(32);index"` + UserUID string `gorm:"type:char(32);index"` + Status uint `gorm:"default:0"` +} type Message struct { db.ModelCommand CommandUID string `gorm:"type:char(32)"` @@ -170,6 +226,8 @@ type Support struct { func init() { db.CmdModels("", &Sess{}, &User{}, &UserPlace{}, &Place{}, &Street{}, &City{}, - &Apply{}, &Allow{}, &Event{}, &Message{}, &Recent{}, &Command{}, &Service{}, &Support{}, + &Apply{}, &Allow{}, &Event{}, &Notice{}, + &Domain{}, &Market{}, &Thumb{}, &Comment{}, &Favor{}, + &Message{}, &Recent{}, &Command{}, &Service{}, &Support{}, ) } diff --git a/src/gonganxitong/notice.go b/src/gonganxitong/notice.go new file mode 100644 index 0000000..577b26d --- /dev/null +++ b/src/gonganxitong/notice.go @@ -0,0 +1,25 @@ +package gonganxitong + +import ( + "shylinux.com/x/ice" + + "shylinux.com/x/community/src/gonganxitong/model" +) + +type notice struct { + Table + order string `data:"94"` + create string `name:"create title* content" role:"void"` +} + +func (s notice) Create(m *ice.Message, arg ...string) { s.ValueCreate(m, arg...) } +func (s notice) Remove(m *ice.Message, arg ...string) { s.ValueRemove(m, arg...) } +func (s notice) List(m *ice.Message, arg ...string) { + if len(arg) == 1 { + s.Select(m, model.PLACE_UID, arg[0]) + } else if len(arg) == 2 { + s.Select(m, model.PLACE_UID, arg[0], model.UID, arg[1]) + } +} + +func init() { ice.TeamCtxCmd(notice{Table: newTable()}) } diff --git a/src/gonganxitong/portal.css b/src/gonganxitong/portal.css index 818b93d..cc1531a 100644 --- a/src/gonganxitong/portal.css +++ b/src/gonganxitong/portal.css @@ -15,14 +15,21 @@ $output>div>div.list>div.title div.action div.item.button.icons input { display: $output>div>div.list>div.role:not(.hide) { display:flex; align-items:center; justify-content:space-around; } $output>div>div.list>div.role span { padding:5px; cursor:pointer; } $output>div>div.list>div.role span.select { border-bottom:var(--box-notice); } +$output>div>div.list>div.role span.creator.select { border-bottom:var(--box-danger); } +$output>div>div.list>div.role span.landlord.select { border-bottom:var(--box-danger); } +$output>div>div.list>div.role span.teacher.select { border-bottom:var(--box-danger); } +$output>div>div.list>div.role span.leader.select { border-bottom:var(--box-danger); } +$output>div>div.list>div.role span.boss.select { border-bottom:var(--box-danger); } $output>div>div.list>div.role span:not(.select) { color:gray; } $output>div>div.list>div.output>div.item.index:not(.hide) { padding:5px 10px; display:flex; flex-direction:column; align-items:center; float:left; } $output>div>div.list>div.output>div.item.index img { height:48px; width:48px; object-fit:contain; } -$output>div>div.list>div.action { display:flex; justify-content:center; } +$output>div>div.list>div.action { display:flex; justify-content:center; display:none; } $output>div>div.list>div.action div.item { margin-right:5px; } $output>div>div.list>div.action div.item input[type=button] { color:var(--notice-bg-color); border:none; } $output>div>div.list>div.action div.item i { display:none; } // $output>div.output>div.list:last-child { margin-bottom:0; } +$output>div.action { background-color:transparent; } +$output>div.action>div.list { background-color:transparent; } $output>div.action div.item.button { margin-right:5px; } $output>div.action div.item.button input { border:none; color:var(--notice-bg-color); min-width:60px; float:left; } $output>div.action div.item.button input:hover { background-color:var(--hover-bg-color); } @@ -62,6 +69,19 @@ $output fieldset.story>div.output>div.code { text-align:center; } $output fieldset.story>div.output>div.code>img { display:block; margin:auto; width:100%; max-width:390px; } $output>fieldset.qrcode table.content td { text-align:center; } $output>fieldset.qrcode div.code { text-align:center; } +$output>fieldset.market>div.output>div.list div.item.card img { border-radius:50%; height:40px; width:40px; } +$output>fieldset.market>div.output>div.list div.item.card div.status { font-size:14px; } +$output>fieldset.market>div.output>div.list div.item.card div.status>span.username { color:var(--body-fg-color); font-size:14px; } +$output>fieldset.market>div.output>div.list div.item.card div.status>span.time { float:right; } +$output>fieldset.market>div.output>div.list div.item.card div.output div.action { color:gray; font-size:14px; width:100%; max-width:100%; display:flex; justify-content:space-around; position:relative; } +$output>fieldset.market>div.output>div.list div.item.card div.output div.action i { margin-right:5px; } +$output>fieldset.market>div.output>div.list div.item.card div.output div.action div.item.done { color:var(--notice-bg-color); } +// $output>fieldset.market>div.output>div.list div.item.card div.status>span.street { color:var(--notice-bg-color); } +// $output>fieldset.market>div.output>div.list div.item.card div.status>span.place { color:var(--notice-bg-color); } +$output>fieldset.market>div.output>div.tabs { display:flex; width:100%; overflow:auto; height:30px; position:sticky; top:0; z-index:1; } +$output>fieldset.market>div.output>div.tabs::-webkit-scrollbar { width:0 !important; height:0 !important; } +$output>fieldset.market>div.output>div.tabs>div.item { padding:5px 10px; float:left; white-space:pre; } +$output>fieldset.market>div.output>div.tabs>div.item.select { border-top:var(--box-danger); background-color:var(--output-bg-color); color:var(--danger-bg-color); font-weight:bold; position:sticky; left:0; right:0; } body.light.mobile { --plugin-bg-color:#f4f5f9; --output-bg-color:#fefefd; } body.mobile $output>div>div.list div.item.index span { font-size:12px; white-space:pre; } body.mobile fieldset.panel.Action>div.output { background-color:var(--plugin-bg-color); } diff --git a/src/gonganxitong/portal.go b/src/gonganxitong/portal.go index 834a412..a58d8e0 100644 --- a/src/gonganxitong/portal.go +++ b/src/gonganxitong/portal.go @@ -81,7 +81,7 @@ func (s Portal) Run(m *ice.Message, arg ...string) { sub, role = arg[1], action.Role } } - if kit.IsIn(role, "", aaa.VOID) { + if 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 !m.Cmdy(arg[0], s.CheckRole, role).IsErr() { @@ -111,7 +111,7 @@ func (s Portal) List(m *ice.Message, arg ...string) { default: m.PushButton(s.PlaceRemove) } - }).Action(s.PlaceCreate, s.ScanQRCode, s.PlaceSearch) + }).Action(s.PlaceCreate, s.PlaceSearch) kit.If(!m.IsErr() && m.Length() == 0, func() { m.EchoInfoButton("", s.PlaceCreate, s.ScanQRCode, s.PlaceSearch) }) } else if len(arg) == 1 { if arg[0] != "" { @@ -139,9 +139,10 @@ func (s Portal) PlaceListOption(m *ice.Message, arg ...string) *ice.Message { 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) s.SelectJoinCity(msg) + s.SelectJoinAuth(msg) } s.Place.RewriteAppend(msg) - m.Options(msg.AppendSimple(model.AUTH_STATUS, 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)) + m.Options(msg.AppendSimple(model.AUTH_STATUS, model.DASHBOARD_UID, 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)) return msg } func (s Portal) PlaceCreate(m *ice.Message, arg ...string) { @@ -160,9 +161,12 @@ func (s Portal) PlaceCreate(m *ice.Message, arg ...string) { 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) + 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)) } func (s Portal) PlaceList(m *ice.Message, arg ...string) *ice.Message { @@ -177,6 +181,10 @@ func (s Portal) PlaceList(m *ice.Message, arg ...string) *ice.Message { } else { return m } + m.Table(func(value ice.Maps) { + m.Push(model.SERVICE_ICON, ice.Info.NodeIcon) + m.Push(model.NODENAME, ice.Info.NodeName) + }) s.SelectJoin(m, s.Street, model.NAME, model.CITY_UID) s.SelectJoinCity(m) s.SelectJoinAuth(m) @@ -187,7 +195,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 := s.SpaceCmd(m, "20240724-community", "web.team.renzhengshouquan.portal", "placeCreate", m.OptionSimple(model.CITY_NAME, model.COMPANY_NAME), + msg := m.Cmd(s.FindSpaceCmd(m, "web.team.renzhengshouquan.portal"), "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) @@ -195,6 +203,7 @@ func (s Portal) PlaceAuth(m *ice.Message, arg ...string) { } m.Cmd(s.Place, s.UpdateAuth, msg.Option(model.AUTH_UID), model.UID, place_uid) s.RecordEventWithName(m.Options(model.NAME, place_name, model.UID, place_uid), "") + msg.Cmd(s.Prefix(m, s), s.AfterPlaceAuth) } else { m.ProcessHold() } @@ -213,18 +222,6 @@ func (s Portal) ScanQRCode(m *ice.Message, arg ...string) { } } } -func (s Portal) UserPlaceRole(m *ice.Message, arg ...string) { - m.Echo(m.Cmd(s.UserPlace, s.Table.Select, m.OptionSimple(s.Keys(s.Place, model.UID), model.USER_UID)).Append(model.ROLE)) -} -func (s Portal) UserPlaceCmd(m *ice.Message, arg ...string) { - m.Cmdy(s.UserPlace, arg) -} -func (s Portal) PlaceCmd(m *ice.Message, arg ...string) { - m.Cmdy(s.Place, arg) -} -func (s Portal) RecordEvent(m *ice.Message, arg ...string) { - s.event.Record(m.Spawn(kit.Dict(model.PLACE_UID, m.Option(s.Keys(s.Place, model.UID)))), arg[0], arg[1:]...) -} func (s Portal) AddRecent(m *ice.Message, arg ...string) { m.Options(m.ConfigSimple(model.SERVICE_UID)) if kit.IsIn(m.Append(model.AUTH_STATUS), "2", "issued") { @@ -233,6 +230,9 @@ func (s Portal) AddRecent(m *ice.Message, arg ...string) { m.Cmd(s.Prefix(m, s.recent), s.Create, s.GetCommands(m, model.SERVICE_UID, arg...)) } } +func (s Portal) RecordEvent(m *ice.Message, arg ...string) { + s.event.Record(m.Spawn(kit.Dict(model.PLACE_UID, m.Option(s.Keys(s.Place, model.UID)))), arg[0], arg[1:]...) +} func (s Portal) ValueCreate(m *ice.Message, arg ...string) { s.Table.Create(m, kit.Simple(arg, m.OptionSimple(model.USER_UID, s.Keys(s.Place, model.UID)))...) } @@ -245,9 +245,42 @@ func (s Portal) ValueModify(m *ice.Message, arg ...string) { func (s Portal) ValueList(m *ice.Message, arg ...string) { s.TablesWithRole(m, arg, s.UserPlace, s.Place, m.Option("target"), m.Optionv(mdb.FIELDS).([]ice.Any)...) } +func (s Portal) BeforePlaceCreate(m *ice.Message, arg ...string) {} +func (s Portal) AfterPlaceCreate(m *ice.Message, arg ...string) {} +func (s Portal) BeforePlaceRemove(m *ice.Message, arg ...string) {} +func (s Portal) AfterPlaceRemove(m *ice.Message, arg ...string) {} +func (s Portal) BeforePlaceAuth(m *ice.Message, arg ...string) {} +func (s Portal) AfterPlaceAuth(m *ice.Message, arg ...string) {} + +func (s Portal) DashboardCreate(m *ice.Message, name string, arg ...string) *ice.Message { + kit.If(name == "", func() { name = m.Option(s.Keys(s.Place, model.NAME)) }) + m.Cmdy(s.FindSpaceCmd(m, "web.team.dashboard.portal"), s.PlaceCreate, m.OptionSimple(model.CITY_NAME, model.COMPANY_NAME), model.CLIENT_NAME, name, model.CLIENT_TYPE, "0") + m.Cmd(s.FindSpaceCmd(m, web.TEAM_RENZHENGSHOUQUAN_AUTH), "dashboard", m.Option(model.AUTH_UID), m.Option(model.CLIENT_UID)) + return m +} +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, + 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)) +} +func (s Portal) DashboardUpdate(m *ice.Message, arg ...string) { + if m.Option(model.DASHBOARD_UID) != "" { + m.Cmd(s.FindSpaceCmd(m, "web.team.dashboard.summary"), "scan", kit.Dict(model.CLIENT_UID, m.Option(model.DASHBOARD_UID))) + } +} func init() { ice.TeamCtxCmd(Portal{Table: newTable()}) } +func (s Portal) UserPlaceRole(m *ice.Message, arg ...string) { + m.Echo(m.Cmd(s.UserPlace, s.Table.Select, m.OptionSimple(s.Keys(s.Place, model.UID), model.USER_UID)).Append(model.ROLE)) +} +func (s Portal) UserPlaceCmd(m *ice.Message, arg ...string) { + m.Cmdy(s.UserPlace, arg) +} +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) { @@ -271,6 +304,12 @@ 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) 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 ffd92e5..7ecea21 100644 --- a/src/gonganxitong/portal.js +++ b/src/gonganxitong/portal.js @@ -35,7 +35,6 @@ Volcanos(chat.ONIMPORT, { can.onimport.myDebug(can, msg, can.ui.mydebug) var uid = can.onimport.myPlace(can, msg, can.ui.myplace, PLACE_UID, PLACE_NAME, PLACE_TYPE) msg.Length() > 0? can.run({}, [uid], function(msg) { can._index_msg = msg - can.onimport.myCount(can, msg, can.ui.mycount) can.onimport.myIndex(can, msg, can.ui.myindex, PLACE_UID, USER_PLACE_ROLE), can.onimport.selectIndex(can, can.sup.current) can.onimport.myAllow(can, msg, can.ui.myallow, PLACE_UID, USER_PLACE_ROLE) can.onimport.myOrder(can, msg, can.ui.myorder, PLACE_UID, USER_PLACE_ROLE) @@ -53,7 +52,7 @@ Volcanos(chat.ONIMPORT, { STREET_NAME, msg.Option(STREET_NAME), CITY_NAME, msg.Option(CITY_NAME), "auth_status", msg.Option("auth_status"), )) - _msg.Option(ice.MSG_ACTION, msg.Option(USER_PLACE_ROLE) == "visitor"? '["placeSearch"]': '["placeCreate","scanQRCode","placeSearch"]') + _msg.Option(ice.MSG_ACTION, msg.Option(USER_PLACE_ROLE) == "visitor"? '[]': '["placeCreate","placeSearch"]') can.onimport.myPlace(can, _msg, can.ui.myplace, PLACE_UID, PLACE_NAME, PLACE_TYPE) can.onimport.myIndex(can, msg, can.ui.myindex, PLACE_UID, USER_PLACE_ROLE), can.onimport.selectIndex(can, can.sup.current) can.onimport.myAllow(can, msg, can.ui.myallow, PLACE_UID, USER_PLACE_ROLE) @@ -71,8 +70,7 @@ Volcanos(chat.ONIMPORT, { value._role_style = can.onimport.roleStyle(can, value, USER_PLACE_ROLE) value.icons = can.Conf(can.core.Keys("_trans.value", PLACE_TYPE, mdb.ICONS, value[PLACE_TYPE])) }, - myDebug: function(can, msg, target, PLACE_UID, USER_PLACE_ROLE) { - can.onmotion.hidden(can, target) + myDebug: function(can, msg, target, PLACE_UID, USER_PLACE_ROLE) { can.onmotion.hidden(can, target) can.page.Append(can, target, [{view: html.TITLE, list: [{text: can.user.trans(can, "My Debug", "我的调试")}]}]) can.page.Append(can, target, [{text: window.innerWidth+", "+window.innerHeight}]) }, @@ -93,28 +91,28 @@ Volcanos(chat.ONIMPORT, { })), can.page.Append(can, target, [{view: html.ACTION, _init: function(target) { can.onappend._action(can, msg.Option(ice.MSG_ACTION), target) }}]) return place_uid||"" }, - myCount: function(can, msg, target) { var dashboard_uid = msg.Option("dashboard_uid") + myCount: function(can, msg, value, target) { if (!msg) { return } can.onmotion.toggle(can, target, !!value._count) + if (can.onmotion.cache(can, function() { return value._uid }, target)) { return } if (!value.dashboard_uid) { return } can.page.Append(can, target, [{view: html.TITLE, list: [{text: can.user.trans(can, "My Count", "我的数据")}]}]) - can.onappend.plugin(can._root.Action, {width: can.ConfWidth()-40, space: "20240903-operation", index: "web.team.dashboard.summary", args: [dashboard_uid||"e61693838bfe34ab15485b0bc2355d19"]}, function() {}, target) + can.onappend.plugin(can._root.Action, {width: can.ConfWidth()-40, space: "20240903-operation", index: "web.team.dashboard.summary", args: [value.dashboard_uid]}, function(sub) { + can.onmotion.toggle(can, target, value._count = true) + }, target) }, - myInit: function(can, msg, value, target) { if (!msg) { return } can.onmotion.hidden(can, target) - return + myInit: function(can, msg, value, target) { if (!msg) { return } can.onmotion.toggle(can, target, !!value._init) + if (can.onmotion.cache(can, function() { return value._uid }, target)) { return } can.page.Append(can, target, [{view: html.TITLE, list: [{text: can.user.trans(can, "My Init", "我的初始化")}]}]) - msg.Table(function(val) { - if (parseInt(val.init) == parseInt(value.init)+1) { val.args = [value._uid], val.style = html.OUTPUT, value._init = true - debugger - can.onappend.plugin(can, val, function(sub) { var run = sub.run - sub.run = function(event, cmds, cb) { - run(can.request(event, {place_uid: value._uid, place_init: value.init}), cmds, function(msg) { - if (cmds[1] == mdb.CREATE || cmds.length == 1 && msg.Length() > 0) { can.onmotion.clearInput(can), can.Update() } else { cb(msg) } - }) - } - }, target) - } - }) + msg.Table(function(val) { if (parseInt(val.init) == parseInt(value.init)+1) { val.args = [value._uid], val.style = html.OUTPUT, value._init = true + can.onappend.plugin(can, val, function(sub) { var run = sub.run + sub.run = function(event, cmds, cb) { + run(can.request(event, {place_uid: value._uid, place_init: value.init}), cmds, function(msg) { + if (cmds[1] == mdb.CREATE || cmds.length == 1 && msg.Length() > 0) { can.onmotion.clearInput(can), can.Update() } else { cb(msg) } + }) + } + }, target), can.onmotion.toggle(can, target, !!value._init) + } }) }, myList: function(can, msg, target, PLACE_UID, USER_PLACE_ROLE) { - var width = (can.ConfWidth()-40)/parseInt((can.ConfWidth()-40)/100); can.user.isMobile && !can.user.isLandscape() && (width = (can.ConfWidth()-40)/4) + var width = (can.ConfWidth()-40)/parseInt((can.ConfWidth()-40)/100); can.user.isMobile && !can.user.isLandscape() && (width = (can.ConfWidth()-40)/5) can.page.Append(can, target, msg.Table(function(value) { if (value.enable == ice.FALSE) { return } return {view: [[html.ITEM, ctx.INDEX].concat( value.type? [mdb.TYPE]: [], can.core.Split(value.type||""), @@ -154,7 +152,7 @@ Volcanos(chat.ONIMPORT, { }, selectIndex: function(can, value, role) { role = role||value._role can.ui.role && can.onmotion.toggle(can, can.ui.role, value._role == "creator") - can.ui.role && can.onmotion.select(can, can.ui.role, html.SPAN, can.page.SelectOne(can, can.ui.role, "span."+role)) + if (isNaN(parseInt(role))) { can.ui.role && can.onmotion.select(can, can.ui.role, html.SPAN, can.page.SelectOne(can, can.ui.role, "span."+role)) } can.page.Select(can, can.ui.myindex, html.DIV_ITEM, function(target) { var list = target.className.split(" ") if (list.indexOf(mdb.TYPE) > -1 && list.indexOf(value._type) == -1) { can.onmotion.toggle(can, target, false) @@ -181,6 +179,7 @@ Volcanos(chat.ONIMPORT, { run(can.request(event, { city_name: msg.Option(CITY_NAME), street_name: msg.Option(STREET_NAME), place_name: msg.Option(PLACE_NAME), command_uid: msg.Option("command_uid"), portal_name: can.ConfHelp(), + dashboard_uid: msg.Option("dashboard_uid"), }), cmds, cb) } can.page.Appends(can, ui.action, list) @@ -260,18 +259,13 @@ Volcanos(chat.ONIMPORT, { }) }, }) Volcanos(chat.ONEXPORT, { - value: function(can, value, PLACE_UID) { if (!value) { return } - can.sup.current = value, can.onimport.selectIndex(can, can.sup.current) - can.onexport.session(can, PLACE_UID, value._uid), can.onexport.hash(can, value._uid) - can.onexport.title(can, value._name, can.ConfHelp()), can.user.agent.init(can) + value: function(can, value, PLACE_UID) { if (!value) { return } can.sup.current = value, can.onimport.selectIndex(can, can.sup.current) + can.onexport.session(can, PLACE_UID, value._uid), can.onexport.hash(can, value._uid), can.onexport.title(can, value._name, can.ConfHelp()), can.user.agent.init(can) can.page.Select(can, can.ui._target, "div.item.card.uid-"+value._uid, function(item) { can.onmotion.select(can, can.ui._target, html.DIV_ITEM, item) }) can.ui.myallow && can.onmotion.toggle(can, can.ui.myallow, can.page.Select(can, can.ui.myallow, "div.item.index.role."+value._role).length > 0) - can.ui.myinit && can.onmotion.delay(can, function() { can.onmotion.toggle(can, can.ui.myinit, !!value._init) }) - if (!can._index_msg || can.onmotion.cache(can, function() { return value._uid }, can.ui.myinit)) { return } - can.ui.myinit && can.onimport.myInit(can, can._index_msg, value, can.ui.myinit) + can.onimport.myCount(can, can._index_msg, value, can.ui.mycount), can.onimport.myInit(can, can._index_msg, value, can.ui.myinit) }, share_title: function(can, msg, title, role) { - msg.Option("_share_icons", msg.Append("user_avatar")) - msg.Option("_share_content", can.user.transValue(can, msg, role)+" "+msg.Append("user_name")) + msg.Option("_share_icons", msg.Append("user_avatar")), msg.Option("_share_content", can.user.transValue(can, msg, role)+" "+msg.Append("user_name")) }, }) diff --git a/src/gonganxitong/portal.json b/src/gonganxitong/portal.json index ad5ab80..abb2264 100644 --- a/src/gonganxitong/portal.json +++ b/src/gonganxitong/portal.json @@ -4,7 +4,8 @@ "placeSearch": "搜索", "scanQRCode": "扫码", "qrcode": "场景码", "event": "事件流", "apply": "权限申请", "allow": "权限审批", "email": "邮箱配置", "member": "场景成员", "placeUser": "场景成员", - "message": "消息待办", "recent": "最近访问", "service": "服务发现", "support": "客服支持", + "notice": "通知公告", "domain": "领域分类", + "market": "人民广场", "message": "消息待办", "recent": "最近访问", "service": "服务发现", "support": "客服支持", "cancel": "取消", "submit": "提交", "finish": "完成", "reject": "驳回", "approve": "通过", "read": "已读", "done": "完成", "sticky": "置顶", "unSticky": "取消置顶", "autogen": "生成", "compile": "编译", "oauth": "授权", "project": "项目", @@ -14,8 +15,10 @@ "apply": "https://img.icons8.com/officel/80/edit-property.png", "allow": "https://img.icons8.com/officel/80/receipt-approved.png", "email": "https://img.icons8.com/officel/80/reading-confirmation.png", + "notice": "https://img.icons8.com/officel/80/commercial.png", "member": "https://img.icons8.com/officel/80/person-at-home.png", - "placeUser": "https://img.icons8.com/officel/80/person-at-home.png", + "domain": "https://img.icons8.com/officel/80/categorize.png", + "market": "https://img.icons8.com/officel/80/square.png", "message": "https://img.icons8.com/officel/80/test-partial-passed.png", "recent": "https://img.icons8.com/officel/80/multiple-smartphones.png", "service": "https://img.icons8.com/officel/80/activity-grid.png", @@ -39,6 +42,7 @@ "company_name": "公司名称", "city_name": "城市名称", "auth_name": "认证主体", + "domain_uid": "领域分类", "auth_status": "认证状态", "service_name": "服务名称", "qrcode_type": "链接类型", diff --git a/src/gonganxitong/recent.go b/src/gonganxitong/recent.go index a864725..e530256 100644 --- a/src/gonganxitong/recent.go +++ b/src/gonganxitong/recent.go @@ -12,7 +12,7 @@ import ( type recent struct { Table service service - order string `data:"101"` + order string `data:"102"` create string `name:"create service_uid args"` remove string `name:"remove" role:"void"` open string `name:"open" role:"void"` diff --git a/src/gonganxitong/support.go b/src/gonganxitong/support.go index 4efb124..8c2fba7 100644 --- a/src/gonganxitong/support.go +++ b/src/gonganxitong/support.go @@ -4,7 +4,7 @@ import "shylinux.com/x/ice" type support struct { Table - order string `data:"103"` + order string `data:"104"` } func (s support) List(m *ice.Message, arg ...string) {} diff --git a/src/gonganxitong/thumb.go b/src/gonganxitong/thumb.go new file mode 100644 index 0000000..f4fab74 --- /dev/null +++ b/src/gonganxitong/thumb.go @@ -0,0 +1,22 @@ +package gonganxitong + +import ( + "shylinux.com/x/ice" + kit "shylinux.com/x/toolkits" + + "shylinux.com/x/community/src/gonganxitong/model" +) + +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)...) + m.Echo("1") + } else { + s.AddCount(m.Spawn(), model.STATUS, "1", msg.Append(model.UID)) + m.Echo(kit.Format(kit.Int(msg.Append(model.STATUS)) + 1)) + } +} + +func init() { ice.TeamCtxCmd(thumb{}) } diff --git a/src/main.go b/src/main.go index 330926c..b7cd093 100644 --- a/src/main.go +++ b/src/main.go @@ -11,4 +11,4 @@ import ( func main() { print(ice.Run()) } -func init() { ice.Info.Titles = "云社区" } +func init() { ice.Info.Titles = "云社区" } \ No newline at end of file diff --git a/src/renzhengshouquan/auth.go b/src/renzhengshouquan/auth.go index 1d18538..4f79e5f 100644 --- a/src/renzhengshouquan/auth.go +++ b/src/renzhengshouquan/auth.go @@ -61,6 +61,9 @@ func (s auth) Issue(m *ice.Message, arg ...string) { func (s auth) Revoke(m *ice.Message, arg ...string) { s.Update(m, kit.Dict(model.STATUS, AuthRevoked), model.FROM_UID, m.Option(model.AUTH_UID), model.UID, m.Option(model.UID)) } +func (s auth) Dashboard(m *ice.Message, arg ...string) { + s.Update(m, kit.Dict(model.DASHBOARD_UID, arg[1]), model.UID, arg[0]) +} func init() { ice.TeamCtxCmd(auth{}) } diff --git a/src/renzhengshouquan/model/model.go b/src/renzhengshouquan/model/model.go index 54fc938..fc9828d 100644 --- a/src/renzhengshouquan/model/model.go +++ b/src/renzhengshouquan/model/model.go @@ -12,6 +12,7 @@ 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" @@ -31,11 +32,12 @@ type UserAuth struct { } type Auth struct { db.ModelWithUID - CompanyUID string `gorm:"type:char(32);index"` - FromUID string `gorm:"type:char(32);index"` - Name string `gorm:"type:varchar(64)"` - Type uint8 `gorm:"default:0"` - Status uint8 `gorm:"default:0"` + DashboardUID string `gorm:"type:char(32);index"` + CompanyUID string `gorm:"type:char(32);index"` + FromUID string `gorm:"type:char(32);index"` + Name string `gorm:"type:varchar(64)"` + Type uint8 `gorm:"default:0"` + Status uint8 `gorm:"default:0"` } type Cert struct { db.ModelContent diff --git a/src/template/web.code.js/demo.js b/src/template/web.code.js/demo.js index b01fe17..fb10c96 100644 --- a/src/template/web.code.js/demo.js +++ b/src/template/web.code.js/demo.js @@ -1,5 +1,5 @@ Volcanos(chat.ONIMPORT, { - _init: function(can, msg) { can.onimport.shareTitle(can, msg) + _init: function(can, msg) { can.onimport.itemcards(can, msg, function(value) { return [ {view: html.TITLE, list: [value.name||value.title||value.user_name]}, {view: html.STATUS, list: [value.uid.slice(0, 6), can.base.TimeTrim(value.created_at)]}, diff --git a/src/yuehaoxitong/portal.go b/src/yuehaoxitong/portal.go index a7d64d6..96fa42f 100644 --- a/src/yuehaoxitong/portal.go +++ b/src/yuehaoxitong/portal.go @@ -1,7 +1,10 @@ package yuehaoxitong import ( + "shylinux.com/x/ice" + "shylinux.com/x/community/src/gonganxitong" + "shylinux.com/x/community/src/yuehaoxitong/model" "shylinux.com/x/enterprise/src/guanlixitong" ) @@ -10,4 +13,11 @@ type Portal struct { placeCreate string `name:"placeCreate city_name* company_name* queue_name* queue_type*:select" role:"void"` } +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, "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) +} func init() { gonganxitong.PortalCmd(Portal{Portal: guanlixitong.NewPortal(userQueue{}, queue{})}) } diff --git a/src/yuehaoxitong/schedule.go b/src/yuehaoxitong/schedule.go index 9615122..b1a2a84 100644 --- a/src/yuehaoxitong/schedule.go +++ b/src/yuehaoxitong/schedule.go @@ -30,6 +30,7 @@ func (s Schedule) Create(m *ice.Message, arg ...string) { }) s.SendMessage(m, m.Option(model.USER_UID), m.Option(model.USER_UID)) s.sendTemplate(m, "约号成功", m.Result()) + Portal{}.DashboardUpdate(m) m.ProcessRefresh() } func (s Schedule) Call(m *ice.Message, arg ...string) { @@ -143,6 +144,7 @@ func (s Schedule) Take(m *ice.Message, arg ...string) { } s.changeStatus(m, SchedulePlan, ScheduleTake) m.ProcessRefresh() + Portal{}.DashboardUpdate(m) } func (s Schedule) Expire(m *ice.Message, arg ...string) { defer m.ToastProcess("过号中...")("过号成功") @@ -169,6 +171,7 @@ func (s Schedule) Finish(m *ice.Message, arg ...string) { }) s.Select(m.FieldsSetDetail(), args...) s.sendTemplate(m, "服务已完成") + Portal{}.DashboardUpdate(m) } func init() { ice.TeamCtxCmd(Schedule{}) } diff --git a/usr/local/export/web.chat.wx.menu/hash.json b/usr/local/export/web.chat.wx.menu/hash.json index 524fe84..fc97a05 100644 --- a/usr/local/export/web.chat.wx.menu/hash.json +++ b/usr/local/export/web.chat.wx.menu/hash.json @@ -40,7 +40,7 @@ "river": "1", "scene": "main", "space": "20240724-community", - "storm": "3", + "storm": "4", "time": "2024-08-29 16:38:41.517", "type": "view" } @@ -158,7 +158,7 @@ "river": "1", "scene": "main", "space": "20240724-community", - "storm": "4", + "storm": "3", "time": "2024-08-29 16:38:04.352", "type": "view" } diff --git a/usr/local/export/web.team.gonganxitong.portal/hash.json b/usr/local/export/web.team.gonganxitong.portal/hash.json index e218dd2..ae9bd71 100644 --- a/usr/local/export/web.team.gonganxitong.portal/hash.json +++ b/usr/local/export/web.team.gonganxitong.portal/hash.json @@ -14,6 +14,13 @@ "time": "2024-08-06 18:49:10.193" } }, + "3971882ea4f32c86386ad04b39d3e3d4": { + "meta": { + "index": "web.team.gonganxitong.market", + "order": "100", + "time": "2024-09-07 08:23:04.093" + } + }, "8ce4dfb877e04e3be5144253fdd5d8ff": { "meta": { "index": "web.team.gonganxitong.allow", @@ -44,6 +51,19 @@ "time": "2024-08-20 10:37:42.641" } }, + "c1526ecd405021d6d47798c066bf70c0": { + "meta": { + "index": "web.team.gonganxitong.notice", + "order": "94", + "time": "2024-09-07 08:23:04.082" + } + }, + "d86e4e63183c8fae4ceb50498b0bcfde": { + "meta": { + "index": "web.team.gonganxitong.domain", + "time": "2024-09-07 08:23:04.094" + } + }, "e2117b53c036a72fe7e4885449488a6f": { "meta": { "index": "web.team.gonganxitong.qrcode", diff --git a/usr/local/export/web.team.guanlixitong.portal/hash.json b/usr/local/export/web.team.guanlixitong.portal/hash.json index 384b2b6..2d9dc7b 100644 --- a/usr/local/export/web.team.guanlixitong.portal/hash.json +++ b/usr/local/export/web.team.guanlixitong.portal/hash.json @@ -7,6 +7,12 @@ "time": "2024-08-07 08:09:16.505" } }, + "04c6ed833d5cf77fef12937a0e58f2ba": { + "meta": { + "index": "web.team.guanlixitong.domain", + "time": "2024-09-07 08:23:04.067" + } + }, "057616b7366e1930ef4e4a921fe45f1f": { "meta": { "index": "web.team.guanlixitong.service", @@ -36,6 +42,20 @@ "time": "2024-08-07 12:36:07.524" } }, + "78d29149539be88d7561b8e17bd65882": { + "meta": { + "index": "web.team.guanlixitong.market", + "order": "100", + "time": "2024-09-07 08:23:04.073" + } + }, + "809b63c1819fc3ac1452e3b71889aec5": { + "meta": { + "index": "web.team.guanlixitong.notice", + "order": "70", + "time": "2024-09-07 08:23:04.061" + } + }, "9c18032c5bc252f2986e1b20e7e77db7": { "meta": { "index": "web.team.guanlixitong.event", diff --git a/usr/local/export/web.team.huodongzuzhi.portal/hash.json b/usr/local/export/web.team.huodongzuzhi.portal/hash.json index d4e7ca1..af0463d 100644 --- a/usr/local/export/web.team.huodongzuzhi.portal/hash.json +++ b/usr/local/export/web.team.huodongzuzhi.portal/hash.json @@ -6,6 +6,12 @@ "time": "2024-08-25 12:53:13.205" } }, + "41c4e4d621c05725b5d963b25562329d": { + "meta": { + "index": "web.team.huodongzuzhi.domain", + "time": "2024-09-07 08:23:04.049" + } + }, "595eb34d7ebe62e160c02ed5b127d637": { "meta": { "index": "web.team.huodongzuzhi.message", @@ -42,6 +48,13 @@ "time": "2024-08-25 12:56:19.033" } }, + "aa74e6bf51d1d1abab57fdb03b08c5c2": { + "meta": { + "index": "web.team.huodongzuzhi.market", + "order": "100", + "time": "2024-09-07 08:23:04.054" + } + }, "baec1db59218f2da9d560fa719c6a12f": { "meta": { "index": "web.team.huodongzuzhi.apply", @@ -66,6 +79,13 @@ "time": "2024-08-25 12:53:13.191" } }, + "ee364ed77eb0383868d48260f8b5aeb2": { + "meta": { + "index": "web.team.huodongzuzhi.notice", + "order": "70", + "time": "2024-09-07 08:23:04.056" + } + }, "f77a8f8d7dfe49f8e82ecd8d0b99f233": { "meta": { "index": "web.team.huodongzuzhi.recent", diff --git a/usr/local/export/web.team.renzhengshouquan.portal/hash.json b/usr/local/export/web.team.renzhengshouquan.portal/hash.json index 0924c03..97ce06c 100644 --- a/usr/local/export/web.team.renzhengshouquan.portal/hash.json +++ b/usr/local/export/web.team.renzhengshouquan.portal/hash.json @@ -61,6 +61,12 @@ "time": "2024-08-29 12:42:12.281" } }, + "b0a322b1aeb3772b09477be3e47c8e89": { + "meta": { + "index": "web.team.renzhengshouquan.domain", + "time": "2024-09-07 08:23:04.033" + } + }, "bfecb55b11fe68186270fe1b4b8de8cf": { "meta": { "index": "web.team.renzhengshouquan.member", @@ -68,6 +74,13 @@ "time": "2024-08-29 12:42:12.278" } }, + "d9f55b517f4b2579693523ed3b5bd088": { + "meta": { + "index": "web.team.renzhengshouquan.market", + "order": "100", + "time": "2024-09-07 08:23:04.025" + } + }, "e038450591f3c8e7babc0c21b1c6fa6d": { "meta": { "index": "web.team.renzhengshouquan.recent", @@ -75,6 +88,13 @@ "time": "2024-08-29 12:42:12.297" } }, + "ecfb11fad5b4bdf21384e2e1ff571598": { + "meta": { + "index": "web.team.renzhengshouquan.notice", + "order": "70", + "time": "2024-09-07 08:23:04.024" + } + }, "f6b093d122ff3cec363b00093e0a6f19": { "meta": { "index": "web.team.renzhengshouquan.service", diff --git a/usr/local/export/web.team.yuehaoxitong.portal/hash.json b/usr/local/export/web.team.yuehaoxitong.portal/hash.json index 30f3609..4ba2973 100644 --- a/usr/local/export/web.team.yuehaoxitong.portal/hash.json +++ b/usr/local/export/web.team.yuehaoxitong.portal/hash.json @@ -15,6 +15,13 @@ "time": "2024-08-11 09:30:00.536" } }, + "2ed70cba7eb6d3cf5fbe712c63da87a7": { + "meta": { + "index": "web.team.yuehaoxitong.market", + "order": "100", + "time": "2024-09-07 08:23:04.006" + } + }, "377f3c0dae9dbf423a8e188bfd245b7a": { "meta": { "index": "web.team.yuehaoxitong.recent", @@ -38,6 +45,13 @@ "time": "2024-08-16 10:29:53.817" } }, + "6644f2fe4b9315d864e0f6d54b0dea96": { + "meta": { + "enable": "false", + "index": "web.team.yuehaoxitong.domain", + "time": "2024-09-07 08:23:04.001" + } + }, "75c5c1863c1bdaf0bcbd3065b661528d": { "meta": { "index": "web.team.yuehaoxitong.call", @@ -77,6 +91,13 @@ "time": "2024-08-11 09:30:00.509" } }, + "b66f57a7a84d982b1b3a74ac3bdc045c": { + "meta": { + "index": "web.team.yuehaoxitong.notice", + "order": "94", + "time": "2024-09-07 08:23:04.019" + } + }, "b811b4ed8b1b372958bbb4bb1b2709b8": { "meta": { "index": "web.team.yuehaoxitong.support",