This commit is contained in:
jingganjiaoyu 2024-10-05 19:04:12 +08:00
parent a3daf64d13
commit d439ec9fcd
10 changed files with 190 additions and 0 deletions

41
src/h5/common.go Normal file
View File

@ -0,0 +1,41 @@
package h5
import (
"shylinux.com/x/ice"
kit "shylinux.com/x/toolkits"
"shylinux.com/x/enterprise/src/guanlixitong"
"shylinux.com/x/operation/src/h5/model"
)
type Table struct {
guanlixitong.Table
list string `name:"list h5_uid uid auto" role:"void"`
}
func (s Table) Inputs(m *ice.Message, arg ...string) {
switch arg[0] {
case model.USER_H5_ROLE:
s.InputsListRole(m, UserH5RoleList, arg...)
case model.H5_TYPE:
s.InputsList(m, H5TypeList, arg...)
default:
s.Table.Inputs(m, arg...)
}
}
func (s Table) RewriteAppend(m *ice.Message, arg ...string) *ice.Message {
m.RewriteAppend(func(value, key string, index int) string {
switch key {
case model.USER_H5_ROLE:
value = UserH5Role(kit.Int(value)).String()
case model.H5_TYPE:
value = H5Type(kit.Int(value)).String()
}
return value
})
return s.Table.RewriteAppend(m)
}
type Tables struct { Table }
func (s Tables) BeforeMigrate(m *ice.Message, arg ...string) {}

23
src/h5/h5.go Normal file
View File

@ -0,0 +1,23 @@
package h5
import "shylinux.com/x/ice"
type h5 struct{ Table }
func init() { ice.TeamCtxCmd(h5{}) }
type H5Type int
const (
H5RD H5Type = iota
H5OP
H5HR
)
var H5TypeList = map[H5Type]string{
H5RD: "RD",
H5OP: "OP",
H5HR: "HR",
}
func (s H5Type) String() string { return H5TypeList[s] }

15
src/h5/h6.go Normal file
View File

@ -0,0 +1,15 @@
package h5
import "shylinux.com/x/ice"
type h6 struct {
Table
order string `data:"1"`
fields string `data:"title,content,user_uid"`
create string `name:"create title* content*" role:"leader"`
remove string `name:"remove" role:"leader"`
}
func (s h6) List(m *ice.Message, arg ...string) { s.ValueList(m, arg).Display("") }
func init() { ice.TeamCtxCmd(h6{}) }

9
src/h5/h6.js Normal file
View File

@ -0,0 +1,9 @@
Volcanos(chat.ONIMPORT, {
_init: function(can, msg) {
can.onimport.myView(can, msg, function(value) { return [
{view: html.TITLE, list: [value.title||value.name]},
{view: html.STATUS, list: [value.uid.slice(0, 6), can.onimport.timeView(can, value), value.user_name]},
{view: html.OUTPUT, list: [value.content||value.info]},
] })
},
})

34
src/h5/model/model.go Normal file
View File

@ -0,0 +1,34 @@
package model
import "shylinux.com/x/mysql-story/src/db"
const (
UID = "uid"
NAME = "name"
INFO = "info"
TYPE = "type"
TITLE = "title"
CONTENT = "content"
USER_UID = "user_uid"
USER_H5_ROLE = "user_h5_role"
H5_UID = "h5_uid"
H5_NAME = "h5_name"
H5_TYPE = "h5_type"
H6_UID = "_uid"
)
type UserH5 struct {
db.ModelUserPlace
H5UID string `gorm:"type:char(32);index"`
}
type H5 struct {
db.ModelPlace
CompanyUID string `gorm:"type:char(32);index"`
}
type H6 struct {
db.ModelContent
H5UID string `gorm:"type:char(32);index"`
}
func init() { db.CmdModels("", &UserH5{}, &H5{}, &H6{}) }

13
src/h5/portal.go Normal file
View File

@ -0,0 +1,13 @@
package h5
import (
"shylinux.com/x/community/src/gonganxitong"
"shylinux.com/x/enterprise/src/guanlixitong"
)
type Portal struct {
guanlixitong.Portal
placeCreate string `name:"placeCreate city_name* company_name* h5_name* h5_type:select" role:"void"`
}
func init() { gonganxitong.PortalCmd(Portal{Portal: guanlixitong.NewPortal(userH5{}, h5{})}) }

31
src/h5/portal.json Normal file
View File

@ -0,0 +1,31 @@
{
"portal": "h5",
"": "场景应用",
"icons": {
"": "https://img.icons8.com/officel/80/activity-grid.png"
},
"input": {
"My H5": "我的场景",
"user_h5_role": "成员角色",
"h5_name": "场景名称",
"h5_type": "场景类型"
},
"value": {
"user_h5_role": {
"visitor": "访客",
"creator": "创建人",
"leader": "管理人员",
"worker": "工作人员",
"server": "服务人员",
"style": {
"creator": "danger",
"leader": "danger"
}
},
"h5_type": {
"RD": "研发群",
"OP": "运维群",
"HR": "人力群"
}
}
}

15
src/h5/userH5.go Normal file
View File

@ -0,0 +1,15 @@
package h5
import (
"shylinux.com/x/ice"
"shylinux.com/x/enterprise/src/guanlixitong"
)
type userH5 struct{ Table }
func init() { ice.TeamCtxCmd(userH5{}) }
type UserH5Role = guanlixitong.UserGroupRole
var UserH5RoleList = guanlixitong.UserGroupRoleList

View File

@ -14,6 +14,8 @@ import (
_ "shylinux.com/x/operation/src/h2"
_ "shylinux.com/x/operation/src/h3"
_ "shylinux.com/x/operation/src/h5"
)
func main() { print(ice.Run()) }

View File

@ -48,6 +48,13 @@
"type": "hash"
}
},
"741793f8494943edd95c5c9dae13458f": {
"meta": {
"index": "web.team.h2.portal",
"time": "2024-10-05 19:03:01.418",
"type": "hash"
}
},
"91846a6751800ea3e45d73a43aad29d0": {
"meta": {
"index": "ssh.relay",