This commit is contained in:
IT 老营长 @云轩领航-创始人 2024-08-06 19:10:11 +08:00
parent b099a48807
commit b4dafdd4f6
9 changed files with 119 additions and 19 deletions

View File

@ -172,4 +172,5 @@ func PortalCmd(portal ice.Any) {
cmd("apply", apply{Table: table}) cmd("apply", apply{Table: table})
cmd("order", order{Table: table}) cmd("order", order{Table: table})
cmd("event", event{Table: table}) cmd("event", event{Table: table})
cmd("service", service{})
} }

View File

@ -20,6 +20,9 @@ type email struct {
} }
func (s email) List(m *ice.Message, arg ...string) { func (s email) List(m *ice.Message, arg ...string) {
if !m.IsTech() {
return
}
if msg := m.Cmd(s.user, s.user.Select, model.UID, m.Option(model.USER_UID)); msg.Append(model.EMAIL) == "" { if msg := m.Cmd(s.user, s.user.Select, model.UID, m.Option(model.USER_UID)); msg.Append(model.EMAIL) == "" {
m.EchoInfoButton(m.Trans("please apply email", "请申请邮箱"), s.Apply) m.EchoInfoButton(m.Trans("please apply email", "请申请邮箱"), s.Apply)
} else { } else {

View File

@ -1,5 +1,5 @@
{ {
"express": "快递", "express": "收发快递",
"icons": { "icons": {
"express": "https://img.icons8.com/officel/80/shipped.png" "express": "https://img.icons8.com/officel/80/shipped.png"
}, },

View File

@ -7,4 +7,8 @@ type express struct {
portal string `data:"true"` portal string `data:"true"`
} }
func (s express) List(m *ice.Message, arg ...string) {
m.Echo("hello world")
}
func init() { ice.TeamCtxCmd(express{}) } func init() { ice.TeamCtxCmd(express{}) }

View File

@ -18,6 +18,7 @@ const (
OPERATE = "operate" OPERATE = "operate"
OPERATOR = "operator" OPERATOR = "operator"
CREATED_AT = "created_at" CREATED_AT = "created_at"
UPDATED_AT = "updated_at"
BEGIN_TIME = "begin_time" BEGIN_TIME = "begin_time"
END_TIME = "end_time" END_TIME = "end_time"
OPEN_ID = "open_id" OPEN_ID = "open_id"
@ -79,6 +80,19 @@ type City struct {
Name string `gorm:"type:char(32);index"` Name string `gorm:"type:char(32);index"`
} }
type Service struct {
db.ModelWithUID
Icon string `gorm:"type:char(32)"`
Name string `gorm:"type:char(32)"`
Index string `gorm:"type:char(32)"`
Hostname string `gorm:"type:char(32)"`
Pathname string `gorm:"type:char(255)"`
Nodename string `gorm:"type:char(32)"`
Nodetype string `gorm:"type:char(32)"`
Domain string `gorm:"type:char(255)"`
Module string `gorm:"type:char(32)"`
Version string `gorm:"type:char(32)"`
}
type Event struct { type Event struct {
db.ModelWithUID db.ModelWithUID
PlaceUID string `gorm:"type:char(32);index"` PlaceUID string `gorm:"type:char(32);index"`
@ -106,5 +120,5 @@ type Order struct {
} }
func init() { func init() {
db.CmdModels("", &Sess{}, &User{}, &UserPlace{}, &Place{}, &Street{}, &City{}, Event{}, Apply{}, Order{}) db.CmdModels("", &Sess{}, &User{}, &UserPlace{}, &Place{}, &Street{}, &City{}, Event{}, Apply{}, Order{}, Service{})
} }

View File

@ -15,23 +15,35 @@ type Portal struct {
Table Table
user user user user
city city city city
service service
export string `data:"true"` export string `data:"true"`
short string `data:"index"` short string `data:"index"`
field string `data:"time,name,icons,index,order,enable,type,role"` field string `data:"time,name,icons,index,order,enable,type,role,view"`
list string `name:"list place_uid index uid auto" role:"void"` list string `name:"list place_uid index uid auto" role:"void"`
placeCreate string `name:"placeCreate city_name* street_name* place_type*:select name* address*" role:"void"` create string `name:"create name icons index"`
placeCreate string `name:"placeCreate city_name* street_name* place_type*:select name* address*" icon:"bi bi-plus-square-dotted" role:"void"`
placeRemove string `name:"placeRemove uid*" role:"void"` placeRemove string `name:"placeRemove uid*" role:"void"`
scanQRCode string `name:"scanQRCode type text" role:"void"` scanQRCode string `name:"scanQRCode type text" icon:"bi bi-qr-code-scan" role:"void"`
setIcons string `name:"setIcons icons" icon:"bi bi-info-square"`
} }
func (s Portal) BeforeMigrate(m *ice.Message, arg ...string) { func (s Portal) BeforeMigrate(m *ice.Message, arg ...string) {
} }
func (s Portal) AfterMigrate(m *ice.Message, arg ...string) {
m.GoSleep("30ms", func() {
m.Option(ctx.INDEX, m.PrefixKey())
m.Cmdy(s.service, s.Update, m.ConfigSimple(mdb.ICON, mdb.NAME))
})
}
func (s Portal) Inputs(m *ice.Message, arg ...string) { func (s Portal) Inputs(m *ice.Message, arg ...string) {
m.Cmdy(s.Place, m.ActionKey(), arg) m.Cmdy(s.Place, m.ActionKey(), arg)
} }
func (s Portal) SetIcons(m *ice.Message, arg ...string) {
s.Hash.Modify(m, arg...)
}
func (s Portal) List(m *ice.Message, arg ...string) { func (s Portal) List(m *ice.Message, arg ...string) {
if m.Option("form") == "table" { if m.Option(mdb.VIEW) == mdb.TABLE {
s.Hash.List(m, arg...).SortInt(mdb.ORDER) s.Hash.List(m, arg...).PushAction(mdb.DETAIL, s.SetIcons, s.Remove).SortInt(mdb.ORDER)
return return
} }
if len(arg) == 0 { if len(arg) == 0 {
@ -86,6 +98,13 @@ func (s Portal) ScanQRCode(m *ice.Message, arg ...string) {
func init() { ice.TeamCtxCmd(Portal{Table: newTable()}) } func init() { ice.TeamCtxCmd(Portal{Table: newTable()}) }
type portal struct {
Portal
name string `data:"公安系统"`
}
func init() { ice.TeamCtxCmd(portal{Portal: Portal{Table: newTable()}}) }
func (s Portal) Show(m *ice.Message, arg ...string) { func (s Portal) Show(m *ice.Message, arg ...string) {
m.GoSleep("30ms", func() { m.GoSleep("30ms", func() {
cmd := m.GetCommand() cmd := m.GetCommand()

View File

@ -1,22 +1,22 @@
{ {
"portal": "用户场所", "service": "系统服务",
"portal": "用户场景",
"setIcons": "设置图标",
"scanQRCode": "扫码添加", "scanQRCode": "扫码添加",
"placeCreate": "添加场所", "placeCreate": "添加场",
"placeRemove": "删除场", "placeRemove": "删除场",
"qrcode": "场码", "qrcode": "场码",
"apply": "权限申请", "apply": "权限申请",
"order": "权限审批", "order": "权限审批",
"event": "事件流", "event": "事件流",
"email": "邮箱配置", "email": "邮箱配置",
"placeUser": "场用户", "placeUser": "场用户",
"cancel": "取消", "cancel": "取消",
"submit": "提交", "submit": "提交",
"reject": "驳回", "reject": "驳回",
"approve": "通过", "approve": "通过",
"icons": { "icons": {
"scanQRCode": "bi bi-qr-code-scan", "service": "https://img.icons8.com/officel/80/activity-grid.png",
"placeRemove": "bi bi-plus-square-dotted",
"placeCreate": "bi bi-plus-square-dotted",
"qrcode": "https://img.icons8.com/officel/80/qr-code.png", "qrcode": "https://img.icons8.com/officel/80/qr-code.png",
"apply": "https://img.icons8.com/officel/80/edit-property.png", "apply": "https://img.icons8.com/officel/80/edit-property.png",
"order": "https://img.icons8.com/officel/80/receipt-approved.png", "order": "https://img.icons8.com/officel/80/receipt-approved.png",
@ -28,7 +28,7 @@
"placeRemove": "danger" "placeRemove": "danger"
}, },
"input": { "input": {
"My Place": "我的场", "My Place": "我的场",
"apply_status": "申请状态", "apply_status": "申请状态",
"order_status": "审批状态", "order_status": "审批状态",
"begin_time": "起始时间", "begin_time": "起始时间",
@ -37,9 +37,10 @@
"user_name": "用户昵称", "user_name": "用户昵称",
"user_avatar": "用户头像", "user_avatar": "用户头像",
"user_place_role": "用户角色", "user_place_role": "用户角色",
"place_name": "场所名称", "place_uid": "场景",
"place_type": "场所类型", "place_name": "场景名称",
"place_address": "场所地址", "place_type": "场景类型",
"place_address": "场景地址",
"street_name": "街道名称", "street_name": "街道名称",
"city_name": "城市名称" "city_name": "城市名称"
}, },

View File

@ -0,0 +1,44 @@
package gonganxitong
import (
"shylinux.com/x/ice"
"shylinux.com/x/icebergs/base/ctx"
"shylinux.com/x/icebergs/base/nfs"
"shylinux.com/x/icebergs/base/tcp"
"shylinux.com/x/icebergs/base/web"
kit "shylinux.com/x/toolkits"
"shylinux.com/x/community/src/gonganxitong/model"
)
type service struct {
Table
portal string `data:"true"`
domain string `data:"gonganxitong"`
create string `name:"create name help table"`
}
func (s service) Update(m *ice.Message, arg ...string) {
uid := kit.Hashs(ice.Info.Hostname, ice.Info.Pwd, m.Option(ctx.INDEX))
s.Table.Create(m, model.UID, uid, tcp.HOSTNAME, ice.Info.Hostname, nfs.PATHNAME, ice.Info.Pwd, ctx.INDEX, m.Option(ctx.INDEX))
s.Table.Update(m, kit.Dict(arg, web.DOMAIN, ice.Info.Make.Domain,
tcp.NODENAME, ice.Info.NodeName, tcp.NODETYPE, ice.Info.NodeType,
nfs.MODULE, ice.Info.Make.Module, nfs.VERSION, ice.Info.Make.Versions(),
), model.UID, uid)
}
func (s service) List(m *ice.Message, arg ...string) {
if len(arg) == 2 {
s.Table.SelectDetail(m, model.UID, arg[1])
} else {
s.Orders(m, s.Desc(model.UPDATED_AT)).Select(m)
}
m.PushAction(s.Open, s.Conf).Display("")
}
func (s service) Open(m *ice.Message, arg ...string) {
m.ProcessOpen(web.S(m.Option(tcp.NODENAME)) + web.C(m.Option(ctx.INDEX)))
}
func (s service) Conf(m *ice.Message, arg ...string) {
m.ProcessOpen(web.S(m.Option(tcp.NODENAME)) + web.C(m.Option(ctx.INDEX)) + "?view=table")
}
func init() { ice.TeamCtxCmd(service{}) }

View File

@ -0,0 +1,14 @@
Volcanos(chat.ONIMPORT, {
_init: function(can, msg) {
can.onimport.itemcards(can, msg, function(value) { value._style = [value.nodetype]
return [
{view: html.TITLE, list: [{text: value.name}, {text: [value.nodetype, "", mdb.TYPE]}]},
{view: html.STATUS, list: [{text: value.uid.slice(0, 6)}, {text: can.base.TimeTrim(value.updated_at)}]},
{view: html.STATUS, list: [{text: value.index}]},
{view: html.STATUS, list: [{text: value.module}, {text: value.version}]},
// {view: html.STATUS, list: [{text: value.domain}]},
// {view: html.STATUS, list: [{text: value.hostname}, {text: value.pathname}]},
]
})
},
})