mirror of
https://shylinux.com/x/community
synced 2025-07-01 13:14:44 +08:00
add some
This commit is contained in:
parent
1eb1d678b1
commit
b1715946b9
@ -4,6 +4,7 @@ import (
|
||||
"path"
|
||||
"reflect"
|
||||
"strconv"
|
||||
"strings"
|
||||
|
||||
"shylinux.com/x/ice"
|
||||
icebergs "shylinux.com/x/icebergs"
|
||||
@ -20,6 +21,7 @@ import (
|
||||
type UserPlacer interface {
|
||||
Placer
|
||||
}
|
||||
|
||||
type Placer interface {
|
||||
Inputs(m *ice.Message, arg ...string)
|
||||
Select(m *ice.Message, arg ...string) *ice.Message
|
||||
@ -41,6 +43,23 @@ type Table struct {
|
||||
list string `name:"list place_uid uid auto" role:"void"`
|
||||
}
|
||||
|
||||
func (s Table) LoadTrans(m *ice.Message, arg ...string) {
|
||||
base := kit.FileLine(1, 100)
|
||||
if m.PrefixKey() != "web.team.gonganxitong.portal" {
|
||||
ice.LoadTrans(m.Spawn(kit.Dict("_template", path.Join(path.Dir(base), "portal.json"))).Message, m.CommandKey(), m.GetCommand().Command)
|
||||
}
|
||||
h := ctx.GetCmdFile(m.Message, m.PrefixKey())
|
||||
if strings.HasPrefix(h, "/p/src/") {
|
||||
h = strings.TrimPrefix(h, "/p/")
|
||||
}
|
||||
if path.Dir(h) != path.Dir(base) && m.CommandKey() != web.PORTAL {
|
||||
ice.LoadTrans(m.Spawn(kit.Dict("_template", path.Join(path.Dir(h), "portal.json"))).Message, m.CommandKey(), m.GetCommand().Command)
|
||||
}
|
||||
}
|
||||
func (s Table) Init(m *ice.Message, arg ...string) {
|
||||
s.LoadTrans(m, arg...)
|
||||
s.Table.Init(m, arg...)
|
||||
}
|
||||
func (s Table) BeforeMigrate(m *ice.Message, arg ...string) {
|
||||
s.Table.BeforeMigrate(m, arg...)
|
||||
kit.If(m.GetCommand().Icon, func() { Portal{}.Show(m) })
|
||||
@ -54,6 +73,14 @@ func (s Table) Inputs(m *ice.Message, arg ...string) {
|
||||
s.InputsListRole(m, UserPlaceRoleList, arg...)
|
||||
case model.PLACE_TYPE:
|
||||
s.InputsList(m, PlaceTypeList, arg...)
|
||||
case model.CITY_NAME:
|
||||
if m.IsDebug() {
|
||||
m.Push(arg[0], "深圳市")
|
||||
}
|
||||
case model.COMPANY_NAME:
|
||||
if m.IsDebug() {
|
||||
m.Push(arg[0], "云境互联")
|
||||
}
|
||||
default:
|
||||
s.Table.Inputs(m, arg...)
|
||||
}
|
||||
@ -115,13 +142,21 @@ func (s Table) SelectJoinUser(m *ice.Message) *ice.Message {
|
||||
func (s Table) SelectJoinCity(m *ice.Message) *ice.Message {
|
||||
return s.SelectJoin(m, city{}, model.NAME)
|
||||
}
|
||||
func (s Table) SelectJoinAuth(m *ice.Message) *ice.Message {
|
||||
if ice.Info.NodeName == "20240724-community" {
|
||||
return s.SelectJoin(m, "web.team.renzhengshouquan.auth", model.STATUS)
|
||||
} else {
|
||||
defer m.Options(ice.MSG_USERROLE, aaa.TECH).Options(ice.MSG_USERROLE, aaa.VOID)
|
||||
return s.SelectJoin(m, []string{web.SPACE, "ops.20240724-community", "web.team.renzhengshouquan.auth"}, model.STATUS)
|
||||
func (s Table) FindSpaceCmd(m *ice.Message, cmd ice.Any) ice.Any {
|
||||
switch cmds := ice.GetTypeKey(cmd); cmds {
|
||||
case web.TEAM_GONGANXITONG_USER, web.TEAM_RENZHENGSHOUQUAN_AUTH, web.CODE_MYSQL_CLIENT:
|
||||
if ice.Info.NodeName == "20240724-community" {
|
||||
return cmd
|
||||
} else {
|
||||
m.Options(ice.MSG_USERROLE, aaa.TECH)
|
||||
return []string{web.SPACE, kit.Keys(ice.OPS, "20240724-community"), cmds}
|
||||
}
|
||||
}
|
||||
return cmd
|
||||
}
|
||||
func (s Table) SelectJoinAuth(m *ice.Message) *ice.Message {
|
||||
defer m.Options(ice.MSG_USERROLE, aaa.VOID)
|
||||
return s.SelectJoin(m, s.FindSpaceCmd(m, web.TEAM_RENZHENGSHOUQUAN_AUTH), model.STATUS)
|
||||
}
|
||||
func (s Table) RenameAppend(m *ice.Message, arg ...string) Table {
|
||||
m.RenameAppend(arg...)
|
||||
@ -231,8 +266,8 @@ func (s Portal) SendTemplate(m *ice.Message, arg ...string) {
|
||||
}
|
||||
uid, place_uid := kit.Select(m.Option(model.UID), arg, 5), kit.Select("", arg, 6)
|
||||
kit.If(place_uid == "", func() { place_uid = m.Option(s.Keys(s.Place, model.UID)) })
|
||||
link := Portal{}.Link(m, place_uid, arg[0], uid)
|
||||
m.Cmd(user{}, s.SendTemplate, arg[1], arg[2], link, arg[3], name, kit.Cut(uid, 6))
|
||||
link := s.Link(m, place_uid, arg[0], uid)
|
||||
m.Cmd(s.FindSpaceCmd(m, user{}), s.SendTemplate, arg[1], arg[2], link, arg[3], name, kit.Cut(uid, 6))
|
||||
}
|
||||
func (s Table) DisplayBase(m *ice.Message, file string) *ice.Message {
|
||||
if s.Place != nil {
|
||||
@ -313,15 +348,12 @@ func (s Portal) getTable() Table { return s.Table }
|
||||
func PortalCmd(portal ice.Any) {
|
||||
h := kit.FileLine(-1, 100)
|
||||
p := kit.Keys("web.team", kit.ModPath(-1))
|
||||
base := kit.FileLine(1, 100)
|
||||
cmd := func(name string, data ice.Any) {
|
||||
_, cmd := ice.Cmd(kit.Keys(p, name), data)
|
||||
cmd.RawHand = path.Join(path.Dir(h), name+".go")
|
||||
cmd.Actions[ice.CTX_INIT].Hand = icebergs.MergeHand(cmd.Actions[ice.CTX_INIT].Hand, func(m *icebergs.Message, arg ...string) {
|
||||
ice.LoadTrans(m.Spawn(kit.Dict("_template", path.Join(path.Dir(base), "portal.json"))), m.CommandKey(), cmd)
|
||||
ice.LoadTrans(m, m.CommandKey(), cmd)
|
||||
cmd.Actions[ice.CTX_INIT].Hand = icebergs.MergeHand(func(m *icebergs.Message, arg ...string) {
|
||||
mdb.Config(m, db.DOMAIN, "gonganxitong")
|
||||
})
|
||||
}, cmd.Actions[ice.CTX_INIT].Hand)
|
||||
}
|
||||
table := portal.(interface{ getTable() Table }).getTable()
|
||||
cmd("portal", portal)
|
||||
|
@ -5,6 +5,7 @@ import (
|
||||
"shylinux.com/x/icebergs/base/aaa"
|
||||
"shylinux.com/x/icebergs/base/ctx"
|
||||
"shylinux.com/x/icebergs/base/mdb"
|
||||
"shylinux.com/x/icebergs/base/tcp"
|
||||
"shylinux.com/x/icebergs/base/web"
|
||||
"shylinux.com/x/toolkits"
|
||||
|
||||
@ -34,8 +35,9 @@ type Portal struct {
|
||||
}
|
||||
|
||||
func (s Portal) Init(m *ice.Message, arg ...string) {
|
||||
s.Hash.Init(m, arg...)
|
||||
m.Design(s.List, "", kit.JoinWord(s.Keys(s.Place, model.UID), ctx.INDEX, model.UID, ice.AUTO))
|
||||
s.LoadTrans(m, arg...)
|
||||
s.Hash.Init(m, arg...)
|
||||
}
|
||||
func (s Portal) Exit(m *ice.Message, arg ...string) {
|
||||
mdb.HashSelectUpdate(m.Message, "", func(value ice.Map) {
|
||||
@ -50,6 +52,11 @@ func (s Portal) Exit(m *ice.Message, arg ...string) {
|
||||
s.Hash.Exit(m, arg...)
|
||||
}
|
||||
func (s Portal) BeforeMigrate(m *ice.Message, arg ...string) {
|
||||
if m.Cmd(web.CODE_MYSQL_CLIENT).Length() == 0 {
|
||||
if m.Cmd(s.FindSpaceCmd(m, web.CODE_MYSQL_CLIENT)).Table(func(value ice.Maps) { m.Cmd(web.CODE_MYSQL_CLIENT, s.Create, aaa.SESS, "", kit.Simple(value)) }).Length() == 0 {
|
||||
m.Cmd(web.CODE_MYSQL_CLIENT, s.Create, aaa.SESS, "mysql", "driver", "mysql", "database", "mysql", tcp.HOST, "localhost", tcp.PORT, "10001", aaa.USERNAME, "root", aaa.PASSWORD, "root")
|
||||
}
|
||||
}
|
||||
}
|
||||
func (s Portal) AfterMigrate(m *ice.Message, arg ...string) {
|
||||
if name := kit.Select("", kit.Split(m.PrefixKey(), "."), -2); !m.Exists("src/" + name) {
|
||||
|
@ -44,13 +44,17 @@ func (s service) Autogen(m *ice.Message, arg ...string) {
|
||||
m.Option("CLASS", strings.ToUpper(m.Option(mdb.CLASS)))
|
||||
m.Option("Class", kit.Capital(m.Option(mdb.CLASS)))
|
||||
m.Option("class", kit.LowerCapital(m.Option(mdb.CLASS)))
|
||||
m.Option("TABLE", strings.ToUpper(m.Option(mdb.TABLE)))
|
||||
m.Option("Table", kit.Capital(m.Option(mdb.TABLE)))
|
||||
m.Option("table", kit.LowerCapital(m.Option(mdb.TABLE)))
|
||||
table := m.Option(mdb.TABLE)
|
||||
m.Option("TABLE", strings.ToUpper(table))
|
||||
m.Option("Table", kit.Capital(table))
|
||||
m.Option("table", kit.LowerCapital(table))
|
||||
code.AutogenImport(m.Message, m.Option(mdb.NAME))
|
||||
m.Option(nfs.MODULE, path.Join(code.AutogenMod(m.Message), nfs.SRC, m.Option(mdb.NAME)))
|
||||
p, from := path.Join(nfs.SRC, m.Option(mdb.NAME)), "template/"
|
||||
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"))
|
||||
|
@ -14,7 +14,7 @@ const (
|
||||
{{.Option "CLASS"}}_UID = "{{.Option "class"}}_uid"
|
||||
{{.Option "CLASS"}}_NAME = "{{.Option "class"}}_name"
|
||||
{{.Option "CLASS"}}_TYPE = "{{.Option "class"}}_type"
|
||||
{{.Option "TABLE"}}_UID = "{{.Option "table"}}_uid"
|
||||
{{.Option "TABLE"}}_UID = "{{.Option "what"}}_uid"
|
||||
COMPANY_UID = "company_uid"
|
||||
CITY_UID = "city_uid"
|
||||
)
|
||||
|
@ -6,10 +6,10 @@ import (
|
||||
)
|
||||
|
||||
type Portal struct {
|
||||
gonganxitong.Portal
|
||||
placeCreate string `name:"placeCreate city_name* company_name* {{.Option "class"}}_name*" role:"void"`
|
||||
guanlixitong.Portal
|
||||
placeCreate string `name:"placeCreate city_name* company_name* {{.Option "class"}}_type*:select {{.Option "class"}}_name*" role:"void"`
|
||||
}
|
||||
|
||||
func init() {
|
||||
gonganxitong.PortalCmd(Portal{Portal: gonganxitong.NewPortal(user{{.Option "Class"}}{}, {{.Option "class"}}{}, guanlixitong.Company{})})
|
||||
gonganxitong.PortalCmd(Portal{Portal: guanlixitong.NewPortal(user{{.Option "Class"}}{}, {{.Option "class"}}{})})
|
||||
}
|
||||
|
@ -1,8 +1,8 @@
|
||||
{
|
||||
"portal": "{{.Option "help"}}",
|
||||
"{{.Option "table"}}": "场景应用",
|
||||
"{{.Option "what"}}": "场景应用",
|
||||
"icons": {
|
||||
"{{.Option "table"}}": "https://img.icons8.com/officel/80/activity-grid.png"
|
||||
"{{.Option "what"}}": "https://img.icons8.com/officel/80/activity-grid.png"
|
||||
},
|
||||
"input": {
|
||||
"My {{.Option "Class"}}": "我的场景",
|
||||
|
@ -4,7 +4,7 @@ import "shylinux.com/x/ice"
|
||||
|
||||
type user{{.Option "Class"}} struct{ Table }
|
||||
|
||||
func init() { ice.TeamCtxCmd(user{}) }
|
||||
func init() { ice.TeamCtxCmd(user{{.Option "Class"}}{}) }
|
||||
|
||||
type User{{.Option "Class"}}Role int
|
||||
|
||||
|
@ -6,7 +6,6 @@ import (
|
||||
"shylinux.com/x/ice"
|
||||
"shylinux.com/x/icebergs/base/aaa"
|
||||
"shylinux.com/x/icebergs/base/nfs"
|
||||
"shylinux.com/x/icebergs/base/web"
|
||||
kit "shylinux.com/x/toolkits"
|
||||
|
||||
"shylinux.com/x/community/src/gonganxitong/model"
|
||||
@ -51,10 +50,6 @@ func (s user) Email(m *ice.Message, arg ...string) {
|
||||
s.Table.Update(m, kit.Dict(m.OptionSimple(model.EMAIL)), model.UID, m.Option(model.USER_UID))
|
||||
}
|
||||
func (s user) SendTemplate(m *ice.Message, arg ...string) { // from uid url type name hash
|
||||
if ice.Info.NodeName != m.Config("community") {
|
||||
m.AdminCmd(web.SPACE, m.Config("community"), m.PrefixKey(), m.ActionKey(), arg, kit.Dict(ice.MSG_USERROLE, aaa.TECH))
|
||||
return
|
||||
}
|
||||
msg := s.Select(m, model.UID, kit.Select(m.Option(model.USER_UID), arg, 1))
|
||||
m.Cmdy("web.chat.wx.template", "", m.Config(nfs.TEMPLATE), msg.Append(model.OPEN_ID), kit.Select("", arg, 2),
|
||||
"thing7", kit.Select("", arg, 3), "thing12", kit.Select("", arg, 4), "character_string2", kit.Cut(kit.Select("", arg, 5), 6),
|
||||
|
@ -11,4 +11,4 @@ import (
|
||||
|
||||
func main() { print(ice.Run()) }
|
||||
|
||||
func init() { ice.Info.Titles = "云社区" }
|
||||
func init() { ice.Info.Titles = "云社区" }
|
||||
|
75
usr/local/export/web.team.development.portal/hash.json
Normal file
75
usr/local/export/web.team.development.portal/hash.json
Normal file
@ -0,0 +1,75 @@
|
||||
{
|
||||
"0bea40222e9b6e5925bebd060815779b": {
|
||||
"meta": {
|
||||
"index": "web.team.development.event",
|
||||
"order": "93",
|
||||
"role": "creator",
|
||||
"time": "2024-09-03 00:35:30.220"
|
||||
}
|
||||
},
|
||||
"2dde4851ba7e250e914790995d78f408": {
|
||||
"meta": {
|
||||
"index": "web.team.development.recent",
|
||||
"order": "101",
|
||||
"time": "2024-09-03 00:35:30.224"
|
||||
}
|
||||
},
|
||||
"317e6006aca996d98a504a6fd12328e5": {
|
||||
"meta": {
|
||||
"index": "web.team.development.release",
|
||||
"time": "2024-09-03 00:35:30.228"
|
||||
}
|
||||
},
|
||||
"4fedc06280d241291c9e826e57532333": {
|
||||
"meta": {
|
||||
"index": "web.team.development.service",
|
||||
"order": "102",
|
||||
"time": "2024-09-03 00:35:30.223"
|
||||
}
|
||||
},
|
||||
"6c38b2d75cf77d3f3be03d4755650660": {
|
||||
"meta": {
|
||||
"index": "web.team.development.support",
|
||||
"order": "103",
|
||||
"time": "2024-09-03 00:35:30.229"
|
||||
}
|
||||
},
|
||||
"90f891576bd575758a3bde4514e86e9c": {
|
||||
"meta": {
|
||||
"index": "web.team.development.qrcode",
|
||||
"order": "90",
|
||||
"role": "creator",
|
||||
"time": "2024-09-03 00:35:31.379"
|
||||
}
|
||||
},
|
||||
"ae176612af13a5cdb5b01ece8172651a": {
|
||||
"meta": {
|
||||
"index": "web.team.development.member",
|
||||
"order": "80",
|
||||
"time": "2024-09-03 00:35:31.382"
|
||||
}
|
||||
},
|
||||
"b985480805074cd9ce56b1f97dbf6c68": {
|
||||
"meta": {
|
||||
"index": "web.team.development.message",
|
||||
"order": "100",
|
||||
"time": "2024-09-03 00:35:30.225"
|
||||
}
|
||||
},
|
||||
"bc7d1f3b02ca339b1baeeda66822784e": {
|
||||
"meta": {
|
||||
"index": "web.team.development.allow",
|
||||
"order": "92",
|
||||
"role": "creator",
|
||||
"time": "2024-09-03 00:35:30.230"
|
||||
}
|
||||
},
|
||||
"dee424d13ad309aa8ec7f4247072dcb3": {
|
||||
"meta": {
|
||||
"index": "web.team.development.apply",
|
||||
"order": "91",
|
||||
"role": "creator",
|
||||
"time": "2024-09-03 00:35:30.226"
|
||||
}
|
||||
}
|
||||
}
|
75
usr/local/export/web.team.operation.portal/hash.json
Normal file
75
usr/local/export/web.team.operation.portal/hash.json
Normal file
@ -0,0 +1,75 @@
|
||||
{
|
||||
"3b0ced2e41179097e594b91c3c36536b": {
|
||||
"meta": {
|
||||
"index": "web.team.operation.member",
|
||||
"order": "80",
|
||||
"time": "2024-09-03 00:35:31.252"
|
||||
}
|
||||
},
|
||||
"53b0f8b9867485bb8864f2205e31897e": {
|
||||
"meta": {
|
||||
"index": "web.team.operation.service",
|
||||
"order": "102",
|
||||
"time": "2024-09-03 00:35:30.169"
|
||||
}
|
||||
},
|
||||
"65c0459a8b23e672deebedb5c1c76fe5": {
|
||||
"meta": {
|
||||
"index": "web.team.operation.publish",
|
||||
"time": "2024-09-03 00:35:30.166"
|
||||
}
|
||||
},
|
||||
"6ca4f1fc571350c2498bc5c1d7ac3563": {
|
||||
"meta": {
|
||||
"index": "web.team.operation.qrcode",
|
||||
"order": "90",
|
||||
"role": "creator",
|
||||
"time": "2024-09-03 00:35:31.256"
|
||||
}
|
||||
},
|
||||
"85c8678d4af08bb0c3e9560155b7c98f": {
|
||||
"meta": {
|
||||
"index": "web.team.operation.event",
|
||||
"order": "93",
|
||||
"role": "creator",
|
||||
"time": "2024-09-03 00:35:30.167"
|
||||
}
|
||||
},
|
||||
"b2d8434f3ab5340408f71c4bf087e3d9": {
|
||||
"meta": {
|
||||
"index": "web.team.operation.recent",
|
||||
"order": "101",
|
||||
"time": "2024-09-03 00:35:30.170"
|
||||
}
|
||||
},
|
||||
"ca74fb83cfd850b1ca03fe18976c253a": {
|
||||
"meta": {
|
||||
"index": "web.team.operation.message",
|
||||
"order": "100",
|
||||
"time": "2024-09-03 00:35:30.174"
|
||||
}
|
||||
},
|
||||
"d47d5d11064235734413113c7440af7f": {
|
||||
"meta": {
|
||||
"index": "web.team.operation.allow",
|
||||
"order": "92",
|
||||
"role": "creator",
|
||||
"time": "2024-09-03 00:35:30.172"
|
||||
}
|
||||
},
|
||||
"ec25b5c62a4d26688fe114d9b25f7a56": {
|
||||
"meta": {
|
||||
"index": "web.team.operation.support",
|
||||
"order": "103",
|
||||
"time": "2024-09-03 00:35:30.176"
|
||||
}
|
||||
},
|
||||
"f7484dd174d63a6800f84d1fb5fbb584": {
|
||||
"meta": {
|
||||
"index": "web.team.operation.apply",
|
||||
"order": "91",
|
||||
"role": "creator",
|
||||
"time": "2024-09-03 00:35:30.178"
|
||||
}
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user