mirror of
https://shylinux.com/x/enterprise
synced 2025-04-25 09:08:06 +08:00
opt portal
This commit is contained in:
parent
2dad729845
commit
6746ab1c88
5
Makefile
5
Makefile
@ -1,12 +1,13 @@
|
|||||||
binarys = bin/ice.bin
|
binarys = bin/ice.bin
|
||||||
version = src/version.go
|
version = src/version.go
|
||||||
binpack = src/binpack.go
|
binpack = src/binpack.go
|
||||||
|
option = src/option.go
|
||||||
flags = -ldflags "-w -s" -v
|
flags = -ldflags "-w -s" -v
|
||||||
|
|
||||||
all: def
|
all: def
|
||||||
@date +"%Y-%m-%d %H:%M:%S"
|
@date +"%Y-%m-%d %H:%M:%S"
|
||||||
go build ${flags} -o ${binarys} src/main.go ${version} ${binpack} && ./${binarys} forever restart &>/dev/null
|
go build ${flags} -o ${binarys} src/main.go ${option} ${version} ${binpack} && ./${binarys} forever restart &>/dev/null
|
||||||
|
|
||||||
def:
|
def:
|
||||||
@[ -f ${version} ] || echo "package main">${version}
|
@[ -f ${version} ] || echo "package main">${version}
|
||||||
@[ -f ${binpack} ] || echo "package main">${binpack}
|
@[ -f ${binpack} ] || echo "package main">${binpack}
|
||||||
|
10
README.md
10
README.md
@ -1,11 +1,11 @@
|
|||||||
# Contexts
|
# Enterprise
|
||||||
Contexts 通过模块化、集群化、自动化的方式,只用一个 20M 大小的程序文件,就可以在各种设备上,一键启动完整的云计算服务与云研发环境。
|
Enterprise 通过模块化、集群化、自动化的方式,只用一个 20M 大小的程序文件,就可以在各种设备上,一键启动完整的云计算服务与云研发环境。
|
||||||
|
|
||||||
## 源码安装
|
## 源码安装
|
||||||
### 克隆编译
|
### 克隆编译
|
||||||
```sh
|
```sh
|
||||||
git clone https://shylinux.com/x/contexts
|
git clone https://shylinux.com/x/enterprise
|
||||||
cd contexts; source etc/miss.sh
|
cd enterprise; source etc/miss.sh
|
||||||
```
|
```
|
||||||
|
|
||||||
### 启动服务
|
### 启动服务
|
||||||
@ -16,4 +16,4 @@ ish_miss_serve
|
|||||||
### 访问网页
|
### 访问网页
|
||||||
```sh
|
```sh
|
||||||
open http://localhost:9020
|
open http://localhost:9020
|
||||||
```
|
```
|
||||||
|
@ -12,4 +12,6 @@ ish_miss_prepare_project
|
|||||||
ish_miss_prepare_contexts
|
ish_miss_prepare_contexts
|
||||||
ish_miss_prepare_resource
|
ish_miss_prepare_resource
|
||||||
|
|
||||||
ish_miss_make; [ -z "$*" ] || ish_miss_serve "$@"
|
ish_miss_prepare community
|
||||||
|
|
||||||
|
ish_miss_make; [ -z "$*" ] || ish_miss_serve "$@"
|
||||||
|
7
go.mod
7
go.mod
@ -1,8 +1,9 @@
|
|||||||
module shylinux.com/x/enterprise
|
module shylinux.com/x/enterprise
|
||||||
|
|
||||||
go 1.13
|
go 1.20
|
||||||
|
|
||||||
require (
|
require (
|
||||||
shylinux.com/x/ice v1.5.40
|
shylinux.com/x/ice v1.5.41
|
||||||
shylinux.com/x/icebergs v1.9.38
|
shylinux.com/x/icebergs v1.9.39
|
||||||
|
shylinux.com/x/mysql-story v0.6.14 // indirect
|
||||||
)
|
)
|
||||||
|
55
go.sum
55
go.sum
@ -1,13 +1,68 @@
|
|||||||
|
github.com/go-sql-driver/mysql v1.7.0 h1:ueSltNNllEqE3qcWBTD0iQd3IpL/6U+mJxLkazJ7YPc=
|
||||||
|
github.com/go-sql-driver/mysql v1.7.0/go.mod h1:OXbVy3sEdcQ2Doequ6Z5BW6fXNQTmx+9S1MCJN5yJMI=
|
||||||
|
github.com/jinzhu/inflection v1.0.0 h1:K317FqzuhWc8YvSVlFMCCUb36O/S9MCKRDI7QkRKD/E=
|
||||||
|
github.com/jinzhu/inflection v1.0.0/go.mod h1:h+uFLlag+Qp1Va5pdKtLDYj+kHp5pxUVkryuEj+Srlc=
|
||||||
|
github.com/jinzhu/now v1.1.5 h1:/o9tlHleP7gOFmsnYNz3RGnqzefHA47wQpKrrdTIwXQ=
|
||||||
|
github.com/jinzhu/now v1.1.5/go.mod h1:d3SSVoowX0Lcu0IBviAWJpolVfI5UJVZZ7cO71lE/z8=
|
||||||
|
github.com/mattn/go-sqlite3 v1.14.22/go.mod h1:Uh1q+B4BYcTPb+yiD3kU8Ct7aC0hY9fxUwlHK0RXw+Y=
|
||||||
|
github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY=
|
||||||
|
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
|
||||||
|
golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
|
||||||
|
golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4=
|
||||||
|
golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs=
|
||||||
|
golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
|
||||||
|
golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
|
||||||
|
golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c=
|
||||||
|
golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs=
|
||||||
|
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||||
|
golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||||
|
golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||||
|
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||||
|
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||||
|
golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||||
|
golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||||
|
golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||||
|
golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||||
|
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
|
||||||
|
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
|
||||||
|
golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k=
|
||||||
|
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
||||||
|
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
|
||||||
|
golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ=
|
||||||
|
golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8=
|
||||||
|
golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ=
|
||||||
|
golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU=
|
||||||
|
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
|
||||||
|
golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
|
||||||
|
golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc=
|
||||||
|
golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU=
|
||||||
|
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||||
|
gorm.io/driver/mysql v1.5.7 h1:MndhOPYOfEp2rHKgkZIhJ16eVUIRf2HmzgoPmh7FCWo=
|
||||||
|
gorm.io/driver/mysql v1.5.7/go.mod h1:sEtPWMiqiN1N1cMXoXmBbd8C6/l+TESwriotuRRpkDM=
|
||||||
|
gorm.io/driver/sqlite v1.5.6/go.mod h1:U+J8craQU6Fzkcvu8oLeAQmi50TkwPEhHDEjQZXDah4=
|
||||||
|
gorm.io/gorm v1.25.7-0.20240204074919-46816ad31dde/go.mod h1:hbnx/Oo0ChWMn1BIhpy1oYozzpM15i4YPuHDmfYtwg8=
|
||||||
|
gorm.io/gorm v1.25.7/go.mod h1:hbnx/Oo0ChWMn1BIhpy1oYozzpM15i4YPuHDmfYtwg8=
|
||||||
|
gorm.io/gorm v1.25.11 h1:/Wfyg1B/je1hnDx3sMkX+gAlxrlZpn6X0BXRlwXlvHg=
|
||||||
|
gorm.io/gorm v1.25.11/go.mod h1:xh7N7RHfYlNc5EmcI/El95gXusucDrQnHXe0+CgWcLQ=
|
||||||
shylinux.com/x/go-git/v5 v5.6.7 h1:WD5QSco7m3QooPCgdvQ6/GyGIFPun8C+hex5N41LYlk=
|
shylinux.com/x/go-git/v5 v5.6.7 h1:WD5QSco7m3QooPCgdvQ6/GyGIFPun8C+hex5N41LYlk=
|
||||||
shylinux.com/x/go-git/v5 v5.6.7/go.mod h1:Qb0lA+uIrofZg8NQerhYcJHgGWixFqvS6p3aJ/L5Nlk=
|
shylinux.com/x/go-git/v5 v5.6.7/go.mod h1:Qb0lA+uIrofZg8NQerhYcJHgGWixFqvS6p3aJ/L5Nlk=
|
||||||
shylinux.com/x/go-qrcode v0.0.3 h1:RMo+Vidbgq3HatLBj7DDXcTbTLFUwzis5K7TqBkD38U=
|
shylinux.com/x/go-qrcode v0.0.3 h1:RMo+Vidbgq3HatLBj7DDXcTbTLFUwzis5K7TqBkD38U=
|
||||||
shylinux.com/x/go-qrcode v0.0.3/go.mod h1:KAbtU+KwiiABMZ/CJ0zh9PI2AX82Uf9rRYcQ4ODm4po=
|
shylinux.com/x/go-qrcode v0.0.3/go.mod h1:KAbtU+KwiiABMZ/CJ0zh9PI2AX82Uf9rRYcQ4ODm4po=
|
||||||
|
shylinux.com/x/go-sql-mysql v0.0.2/go.mod h1:lHjRMZz5Lii6U+49fhkbCWgsnL+yux54SYJYWqASN8Y=
|
||||||
shylinux.com/x/ice v1.5.40 h1:OC++Fb1CxOU1R0Vlrfm+J9pf1mg5uH1n1trXFIHQHaw=
|
shylinux.com/x/ice v1.5.40 h1:OC++Fb1CxOU1R0Vlrfm+J9pf1mg5uH1n1trXFIHQHaw=
|
||||||
shylinux.com/x/ice v1.5.40/go.mod h1:nYLBfYfOacaxvIRgD4ryknBJTqUIZD0zkV72it7iHqU=
|
shylinux.com/x/ice v1.5.40/go.mod h1:nYLBfYfOacaxvIRgD4ryknBJTqUIZD0zkV72it7iHqU=
|
||||||
|
shylinux.com/x/ice v1.5.41 h1:kqu+OOxT+CHkgEAuM+gby6lVZV33rYUM+Vk2UBDlefg=
|
||||||
|
shylinux.com/x/ice v1.5.41/go.mod h1:hMhVMhUlsimwFcsPIH+J/tO8O8I0WEqg1NYyqdhULxE=
|
||||||
shylinux.com/x/icebergs v1.9.38 h1:LS4n8KE3qV8uvdpWwnrgStgkU90f6Ww6prSpv7Eztyw=
|
shylinux.com/x/icebergs v1.9.38 h1:LS4n8KE3qV8uvdpWwnrgStgkU90f6Ww6prSpv7Eztyw=
|
||||||
shylinux.com/x/icebergs v1.9.38/go.mod h1:zLsVvLKuFEyFRwKoa3li75nSqbJo/GVIYacAQVdTsxA=
|
shylinux.com/x/icebergs v1.9.38/go.mod h1:zLsVvLKuFEyFRwKoa3li75nSqbJo/GVIYacAQVdTsxA=
|
||||||
|
shylinux.com/x/icebergs v1.9.39 h1:EAAWxEBWFF0CtO7Tm1pX+s/fi0lk0RMbe9EJV/aLuWo=
|
||||||
|
shylinux.com/x/icebergs v1.9.39/go.mod h1:rUqDj1pzd6uPj7+klEn+doqXiWlb/24/batRyBB5ppo=
|
||||||
|
shylinux.com/x/mysql-story v0.6.14 h1:qf5dj+k9o13mCLUXpgGE42n4nfXVI0S0hNmrYdrMXtc=
|
||||||
|
shylinux.com/x/mysql-story v0.6.14/go.mod h1:AvzKCyuN/zYMYRky3YjCsX1RLwCZFAL4zuQ5jzZidsM=
|
||||||
shylinux.com/x/toolkits v0.7.10/go.mod h1:CHDJarGlDkg60kVsvMLYL/a5hAnRLEOShiEsMOuEp0Q=
|
shylinux.com/x/toolkits v0.7.10/go.mod h1:CHDJarGlDkg60kVsvMLYL/a5hAnRLEOShiEsMOuEp0Q=
|
||||||
shylinux.com/x/toolkits v1.0.12 h1:dwskBNtOLBfis1XtjEGfJhrjBXiwga3M/wNCERsXsyo=
|
shylinux.com/x/toolkits v1.0.12 h1:dwskBNtOLBfis1XtjEGfJhrjBXiwga3M/wNCERsXsyo=
|
||||||
shylinux.com/x/toolkits v1.0.12/go.mod h1:CHDJarGlDkg60kVsvMLYL/a5hAnRLEOShiEsMOuEp0Q=
|
shylinux.com/x/toolkits v1.0.12/go.mod h1:CHDJarGlDkg60kVsvMLYL/a5hAnRLEOShiEsMOuEp0Q=
|
||||||
|
shylinux.com/x/toolkits v1.0.13 h1:oXuXNnsP8/iDCqJmsa5HJew7NZoPd8aMTuJkCZdpOlQ=
|
||||||
|
shylinux.com/x/toolkits v1.0.13/go.mod h1:CHDJarGlDkg60kVsvMLYL/a5hAnRLEOShiEsMOuEp0Q=
|
||||||
shylinux.com/x/websocket v0.0.4 h1:AJpwblePoOpiE6C8NrvgNYpKTotXMLrDDX2chTvx44Q=
|
shylinux.com/x/websocket v0.0.4 h1:AJpwblePoOpiE6C8NrvgNYpKTotXMLrDDX2chTvx44Q=
|
||||||
shylinux.com/x/websocket v0.0.4/go.mod h1:3UGWkjTu3ie5NAZen7J+uLPBrO7DFeKloj6Jxo13Oiw=
|
shylinux.com/x/websocket v0.0.4/go.mod h1:3UGWkjTu3ie5NAZen7J+uLPBrO7DFeKloj6Jxo13Oiw=
|
||||||
|
29
src/guanlixitong/common.go
Normal file
29
src/guanlixitong/common.go
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
package guanlixitong
|
||||||
|
|
||||||
|
import (
|
||||||
|
"strings"
|
||||||
|
|
||||||
|
"shylinux.com/x/ice"
|
||||||
|
"shylinux.com/x/icebergs/base/mdb"
|
||||||
|
"shylinux.com/x/icebergs/base/web"
|
||||||
|
kit "shylinux.com/x/toolkits"
|
||||||
|
|
||||||
|
"shylinux.com/x/enterprise/src/guanlixitong/model"
|
||||||
|
"shylinux.com/x/mysql-story/src/db"
|
||||||
|
)
|
||||||
|
|
||||||
|
type Table struct{ db.Table }
|
||||||
|
|
||||||
|
func (s Table) Init(m *ice.Message, arg ...string) {
|
||||||
|
kit.If(m.Config(web.PORTAL) == ice.TRUE, func() { m.GoSleep("30ms", func() { portal{}.Show(m) }) })
|
||||||
|
}
|
||||||
|
func (s Table) Inputs(m *ice.Message, arg ...string) {
|
||||||
|
switch arg[0] {
|
||||||
|
case model.USER_UID, model.COMPANY_UID:
|
||||||
|
m.Optionv(mdb.SELECT, model.UID, model.NAME)
|
||||||
|
m.Cmdy(m.Prefix(strings.TrimSuffix(arg[0], "_uid"))).RenameAppend(model.UID, arg[0])
|
||||||
|
m.DisplayInputKeyNameIconTitle()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func prefixKey() string { return kit.Keys("web.team", kit.PathName(-1), kit.FileName(-1)) }
|
7
src/guanlixitong/company.go
Normal file
7
src/guanlixitong/company.go
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
package guanlixitong
|
||||||
|
|
||||||
|
import "shylinux.com/x/ice"
|
||||||
|
|
||||||
|
type company struct{ Table }
|
||||||
|
|
||||||
|
func init() { ice.Cmd(prefixKey(), company{}) }
|
11
src/guanlixitong/group.go
Normal file
11
src/guanlixitong/group.go
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
package guanlixitong
|
||||||
|
|
||||||
|
import "shylinux.com/x/ice"
|
||||||
|
|
||||||
|
type group struct{ Table }
|
||||||
|
|
||||||
|
func (s group) List(m *ice.Message, arg ...string) {
|
||||||
|
s.Table.List(m, arg...)
|
||||||
|
}
|
||||||
|
|
||||||
|
func init() { ice.Cmd(prefixKey(), group{}) }
|
47
src/guanlixitong/model/model.go
Normal file
47
src/guanlixitong/model/model.go
Normal file
@ -0,0 +1,47 @@
|
|||||||
|
package model
|
||||||
|
|
||||||
|
import (
|
||||||
|
"shylinux.com/x/ice"
|
||||||
|
"shylinux.com/x/mysql-story/src/db"
|
||||||
|
)
|
||||||
|
|
||||||
|
const (
|
||||||
|
UID = "uid"
|
||||||
|
NAME = "name"
|
||||||
|
OPENID = "openid"
|
||||||
|
OPEN_ID = "open_id"
|
||||||
|
USER_UID = "user_uid"
|
||||||
|
GROUP_UID = "group_uid"
|
||||||
|
GROUP_NAME = "group_name"
|
||||||
|
COMPANY_UID = "company_uid"
|
||||||
|
COMPANY_NAME = "company_name"
|
||||||
|
)
|
||||||
|
|
||||||
|
type UserGroup struct {
|
||||||
|
db.Model
|
||||||
|
UserUID string `gorm:"type:char(32);index"`
|
||||||
|
GroupUID string `gorm:"type:char(32)"`
|
||||||
|
}
|
||||||
|
type Group struct {
|
||||||
|
db.ModelWithUID
|
||||||
|
CompanyUID string `gorm:"type:char(32)"`
|
||||||
|
Name string `gorm:"type:char(32)"`
|
||||||
|
}
|
||||||
|
type Company struct {
|
||||||
|
db.ModelWithUID
|
||||||
|
Name string `gorm:"type:varchar(256)"`
|
||||||
|
Info string
|
||||||
|
}
|
||||||
|
type Target struct {
|
||||||
|
db.ModelWithUID
|
||||||
|
Name string `gorm:"type:varchar(256)"`
|
||||||
|
Info string
|
||||||
|
}
|
||||||
|
|
||||||
|
type models struct{ db.Models }
|
||||||
|
|
||||||
|
func (s models) Init(m *ice.Message, arg ...string) {
|
||||||
|
s.Models.Register(m, "guanlixitong", &UserGroup{}, &Group{}, &Company{}, &Target{})
|
||||||
|
}
|
||||||
|
|
||||||
|
func init() { ice.Cmd("web.team.enterprise.guanlixitong.models", models{}) }
|
1
src/guanlixitong/model/model.sql
Normal file
1
src/guanlixitong/model/model.sql
Normal file
@ -0,0 +1 @@
|
|||||||
|
CREATE DATABASE IF NOT EXISTS guanlixitong CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci;
|
1
src/guanlixitong/portal.css
Normal file
1
src/guanlixitong/portal.css
Normal file
@ -0,0 +1 @@
|
|||||||
|
$output { background-color:var(--plugin-bg-color); }
|
73
src/guanlixitong/portal.go
Normal file
73
src/guanlixitong/portal.go
Normal file
@ -0,0 +1,73 @@
|
|||||||
|
package guanlixitong
|
||||||
|
|
||||||
|
import (
|
||||||
|
"shylinux.com/x/ice"
|
||||||
|
"shylinux.com/x/icebergs/base/ctx"
|
||||||
|
"shylinux.com/x/icebergs/base/mdb"
|
||||||
|
"shylinux.com/x/toolkits"
|
||||||
|
|
||||||
|
"shylinux.com/x/community/src/gonganxitong"
|
||||||
|
"shylinux.com/x/enterprise/src/guanlixitong/model"
|
||||||
|
)
|
||||||
|
|
||||||
|
const (
|
||||||
|
EVENT_GROUP_CREATE = "web.team.enterprise.group.create"
|
||||||
|
EVENT_GROUP_REMOVE = "web.team.enterprise.group.remove"
|
||||||
|
)
|
||||||
|
|
||||||
|
type portal struct {
|
||||||
|
gonganxitong.Portal
|
||||||
|
user gonganxitong.User
|
||||||
|
userGroup userGroup
|
||||||
|
group group
|
||||||
|
company company
|
||||||
|
export string `data:"true"`
|
||||||
|
short string `data:"index"`
|
||||||
|
field string `data:"time,name,icons,index,order,enable"`
|
||||||
|
list string `name:"list group_uid index uid auto" role:"void"`
|
||||||
|
groupCreate string `name:"groupCreate company_uid* name*" role:"void"`
|
||||||
|
groupRemove string `name:"groupRemove group_uid*" role:"void" style:"danger"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s portal) Inputs(m *ice.Message, arg ...string) {
|
||||||
|
s.group.Inputs(m, arg...)
|
||||||
|
}
|
||||||
|
func (s portal) List(m *ice.Message, arg ...string) {
|
||||||
|
if len(arg) == 0 {
|
||||||
|
m.Cmdy(s.userGroup, s.userGroup.MyGroup, s.user.UserUID(m)).Action(s.GroupCreate).PushAction(s.GroupRemove)
|
||||||
|
kit.If(m.Length() == 0, func() { m.EchoInfoButton(m.Trans("Please Create Your Group", "请创建团队"), s.GroupCreate) })
|
||||||
|
m.Display("").DisplayCSS("")
|
||||||
|
} else {
|
||||||
|
s.Portal.List(m, arg...)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
func (s portal) GroupCreate(m *ice.Message, arg ...string) {
|
||||||
|
m.ToastProcess()
|
||||||
|
msg := m.Cmd(s.company, s.company.Select, model.UID, m.Option(model.COMPANY_UID))
|
||||||
|
if !m.WarnNotFound(msg.Length() == 0, "company") {
|
||||||
|
if !m.Cmdy(s.group, s.group.Create, arg).IsErr() {
|
||||||
|
args := kit.Simple(model.USER_UID, s.user.UserUID(m), model.GROUP_UID, m.Result())
|
||||||
|
m.Cmd(s.userGroup, s.userGroup.Create, args)
|
||||||
|
m.Event(EVENT_GROUP_CREATE, args, model.GROUP_NAME, m.Option(model.NAME))
|
||||||
|
m.ProcessRefresh().ToastSuccess()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
func (s portal) GroupRemove(m *ice.Message, arg ...string) {
|
||||||
|
m.ToastProcess()
|
||||||
|
args := kit.Simple(model.USER_UID, s.user.UserUID(m), m.OptionSimple(model.GROUP_UID))
|
||||||
|
msg := m.Cmd(s.userGroup, s.userGroup.Select, args)
|
||||||
|
if !m.WarnNotFound(msg.Length() == 0, "group") {
|
||||||
|
m.Cmdy(s.userGroup, s.userGroup.Delete, args)
|
||||||
|
m.Cmdy(s.group, s.group.Delete, model.UID, m.Option(model.GROUP_UID))
|
||||||
|
m.Event(EVENT_GROUP_REMOVE, args)
|
||||||
|
m.ProcessRefresh().ToastSuccess()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func init() { ice.Cmd(prefixKey(), portal{}) }
|
||||||
|
|
||||||
|
func (s portal) Show(m *ice.Message, arg ...string) {
|
||||||
|
cmd := m.GetCommand()
|
||||||
|
m.Cmd(s, s.Create, mdb.NAME, cmd.Help, mdb.ICONS, cmd.Icon, ctx.INDEX, m.PrefixKey())
|
||||||
|
}
|
17
src/guanlixitong/portal.js
Normal file
17
src/guanlixitong/portal.js
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
var UID = "uid", GROUP_UID = "group_uid", GROUP_NAME = "group_name"
|
||||||
|
Volcanos(chat.ONIMPORT, {
|
||||||
|
_init: function(can, msg) {
|
||||||
|
can.require([
|
||||||
|
"usr/community/src/gonganxitong/portal.js",
|
||||||
|
"usr/community/src/gonganxitong/portal.css?render=replace&index="+can.ConfIndex(),
|
||||||
|
], function() {
|
||||||
|
can.onimport.myPortal(can, msg, GROUP_UID, GROUP_NAME, "我的团队")
|
||||||
|
})
|
||||||
|
},
|
||||||
|
myValue: function(can, value) {
|
||||||
|
return [
|
||||||
|
{view: html.TITLE, list: [{text: value.group_name}]},
|
||||||
|
{view: html.STATUS, list: [{text: value.group_uid.slice(0, 8)}, {text: value.company_name}]},
|
||||||
|
]
|
||||||
|
},
|
||||||
|
})
|
27
src/guanlixitong/portal.json
Normal file
27
src/guanlixitong/portal.json
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
{
|
||||||
|
"user": "用户",
|
||||||
|
"group": "团队",
|
||||||
|
"company": "公司",
|
||||||
|
"groupCreate": "创建团队",
|
||||||
|
"groupRemove": "解散团队",
|
||||||
|
"portal": "管理系统",
|
||||||
|
"icons": {
|
||||||
|
"groupCreate": "bi bi-plus-square-dotted"
|
||||||
|
},
|
||||||
|
"style": {
|
||||||
|
"groupRemove": "danger"
|
||||||
|
},
|
||||||
|
"input": {
|
||||||
|
"migrate": "迁移",
|
||||||
|
"uid": "主键",
|
||||||
|
"info": "信息",
|
||||||
|
"open_id": "外键",
|
||||||
|
"user_uid": "用户",
|
||||||
|
"user_name": "用户名",
|
||||||
|
"group_uid": "团队",
|
||||||
|
"group_name": "团队名称",
|
||||||
|
"company_uid": "公司",
|
||||||
|
"company_name": "公司名称"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
11
src/guanlixitong/target.go
Normal file
11
src/guanlixitong/target.go
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
package guanlixitong
|
||||||
|
|
||||||
|
import "shylinux.com/x/ice"
|
||||||
|
|
||||||
|
type target struct {
|
||||||
|
Table
|
||||||
|
portal string `data:"true"`
|
||||||
|
list string `name:"list group_uid uid auto" help:"目标管理"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func init() { ice.Cmd(prefixKey(), target{}) }
|
20
src/guanlixitong/userGroup.go
Normal file
20
src/guanlixitong/userGroup.go
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
package guanlixitong
|
||||||
|
|
||||||
|
import (
|
||||||
|
"shylinux.com/x/ice"
|
||||||
|
|
||||||
|
"shylinux.com/x/enterprise/src/guanlixitong/model"
|
||||||
|
)
|
||||||
|
|
||||||
|
type userGroup struct {
|
||||||
|
group group
|
||||||
|
company company
|
||||||
|
Table
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s userGroup) MyGroup(m *ice.Message, arg ...string) {
|
||||||
|
s.Fields(m, "groups.created_at", model.COMPANY_NAME, model.GROUP_NAME, model.GROUP_UID, model.COMPANY_UID).Tables(m, s.group, s.company)
|
||||||
|
s.Select(m, model.USER_UID, arg[0])
|
||||||
|
}
|
||||||
|
|
||||||
|
func init() { ice.Cmd(prefixKey(), userGroup{}) }
|
@ -1,7 +1,12 @@
|
|||||||
package main
|
package main
|
||||||
|
|
||||||
import "shylinux.com/x/ice"
|
import (
|
||||||
|
"shylinux.com/x/ice"
|
||||||
|
|
||||||
|
_ "shylinux.com/x/enterprise/src/guanlixitong"
|
||||||
|
_ "shylinux.com/x/mysql-story/src/db/mysql"
|
||||||
|
)
|
||||||
|
|
||||||
func main() { print(ice.Run()) }
|
func main() { print(ice.Run()) }
|
||||||
|
|
||||||
func init() { ice.Info.Titles = "Enterprise" }
|
func init() { ice.Info.Titles = "云办公" }
|
13
src/template/web.code.autogen/demo.go
Normal file
13
src/template/web.code.autogen/demo.go
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
package {{.Option "zone"}}
|
||||||
|
|
||||||
|
import "shylinux.com/x/ice"
|
||||||
|
|
||||||
|
type {{.Option "name"}} struct {
|
||||||
|
Table
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s {{.Option "name"}}) List(m *ice.Message, arg ...string) {
|
||||||
|
s.Table.List(m, arg...)
|
||||||
|
}
|
||||||
|
|
||||||
|
func init() { ice.Cmd(prefixKey(), {{.Option "name"}}{}) }
|
Loading…
x
Reference in New Issue
Block a user