This commit is contained in:
IT 老营长 @云轩领航-创始人 2024-08-12 20:17:25 +08:00
parent 6f8fc7fb1e
commit fd2e13dbde
31 changed files with 176 additions and 139 deletions

View File

@ -11,6 +11,8 @@ type apply struct {
Table
user user
event event
order string `data:"3"`
role string `data:"creator"`
portal string `data:"true"`
domain string `data:"gonganxitong"`
create string `name:"create user_place_role*:select begin_time:select@date end_time:select@date" role:"void"`

View File

@ -14,21 +14,25 @@ import (
"shylinux.com/x/mysql-story/src/db"
)
type Tabler interface {
type Placer interface {
Inputs(m *ice.Message, arg ...string)
Select(m *ice.Message, arg ...string) *ice.Message
RewriteAppend(m *ice.Message, arg ...string) *ice.Message
TransValue(m *ice.Message, key string, arg ...string) string
TransRole(m *ice.Message, arg ...string) string
}
type UserPlacer interface {
Placer
User(m *ice.Message, arg ...string)
}
type Container interface {
FindOrCreateByName(m *ice.Message, arg ...string)
}
type Table struct {
db.Table
UserPlace Tabler
Place Tabler
UserPlace UserPlacer
Place Placer
Street Container
inputs string `name:"inputs" role:"void"`
list string `name:"list place_uid uid auto" role:"void"`
@ -41,6 +45,9 @@ func (s Table) Init(m *ice.Message, arg ...string) {
func (s Table) Exit(m *ice.Message, arg ...string) {
s.Table.Exit(m, arg...)
}
func (s Table) AfterMigrate(m *ice.Message, arg ...string) {
kit.If(m.Config(web.PORTAL) == ice.TRUE, func() { Portal{}.Show(m, m.PrefixKey()) })
}
func (s Table) Inputs(m *ice.Message, arg ...string) {
switch arg[0] {
case model.PLACE_TYPE:
@ -71,7 +78,7 @@ func (s Table) List(m *ice.Message, arg ...string) *ice.Message {
}
return m
}
func (s Table) TablesWithRole(m *ice.Message, arg []string, target, userPlace, place Tabler, fields ...ice.Any) *ice.Message {
func (s Table) TablesWithRole(m *ice.Message, arg []string, userPlace UserPlacer, place Placer, target Placer, fields ...ice.Any) *ice.Message {
s.Tables(m, kit.JoinWord("LEFT JOIN", s.TableName(kit.TypeName(userPlace)),
"ON", s.Key(target, model.USER_UID), "=", s.Key(userPlace, model.USER_UID),
"AND", s.Key(target, s.Keys(place, model.UID)), "=", s.Key(userPlace, s.Keys(place, model.UID)),
@ -146,13 +153,9 @@ func (s Table) SendTemplate(m *ice.Message, from, user_uid, title string, arg ..
return
}
name := kit.Select("", arg, 0)
m.Info("what %v", name)
if name == "" {
m.Info("what %v", name)
name = m.Option(s.Keys(s.Place, model.NAME)) + " " + s.Place.TransValue(m, s.Keys(s.UserPlace, model.ROLE))
m.Info("what %v", s.Keys(s.Place, model.NAME))
}
m.Info("what %v", name)
uid := kit.Select(m.Option(model.UID), arg, 1)
place_uid := kit.Select("", arg, 2)
if place_uid == "" {
@ -187,22 +190,16 @@ func (s Table) Display(m *ice.Message, file string) *ice.Message {
return file
})))
}
func (s Table) Link(m *ice.Message, arg ...string) string {
return Portal{}.Link(m, arg...)
}
type Tables struct {
Table
Portal Portal
portal string `data:"true"`
}
func (s Tables) Init(m *ice.Message, arg ...string) {
s.Portal.Show(m)
}
func (s Tables) Link(m *ice.Message, arg ...string) string {
return s.Portal.Link(m, arg...)
}
func (s Tables) BeforeMigrate(m *ice.Message, arg ...string) {
}
func (s Tables) BeforeMigrate(m *ice.Message, arg ...string) {}
func newTable() Table {
return Table{UserPlace: userPlace{}, Place: place{}, Street: street{}}
@ -210,13 +207,13 @@ func newTable() Table {
func newTables() Tables {
return Tables{Table: newTable()}
}
func NewTable(userPlace, place Tabler, street Container) Table {
func NewTable(userPlace UserPlacer, place Placer, street Container) Table {
return Table{UserPlace: userPlace, Place: place, Street: street}
}
func NewTables(userPlace, place Tabler, street Container) Tables {
func NewTables(userPlace UserPlacer, place Placer, street Container) Tables {
return Tables{Table: NewTable(userPlace, place, street)}
}
func NewPortal(userPlace, place Tabler, street Container) Portal {
func NewPortal(userPlace UserPlacer, place Placer, street Container) Portal {
return Portal{Table: Table{UserPlace: userPlace, Place: place, Street: street}}
}
func (s Portal) getTable() Table {
@ -225,17 +222,13 @@ func (s Portal) getTable() 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) {
msg := m.Cmd("web.team.gonganxitong.apply")
ice.LoadTrans(msg, m.CommandKey(), cmd)
ice.LoadTrans(m.Spawn(kit.Dict("_template", path.Join(path.Dir(base), "portal.json"))), m.CommandKey(), cmd)
ice.LoadTrans(m, m.CommandKey(), cmd)
kit.If(mdb.Config(m, web.PORTAL) == ice.TRUE, func() { Portal{}.Show(&ice.Message{Message: m}, m.PrefixKey()) })
})
cmd.Actions["afterMigrate"].Hand = icebergs.MergeHand(cmd.Actions["afterMigrate"].Hand, func(m *icebergs.Message, arg ...string) {
kit.If(mdb.Config(m, web.PORTAL) == ice.TRUE, func() { Portal{}.Show(&ice.Message{Message: m}, m.PrefixKey()) })
})
}
table := portal.(interface{ getTable() Table }).getTable()
@ -244,5 +237,6 @@ func PortalCmd(portal ice.Any) {
cmd("apply", apply{Table: table})
cmd("order", order{Table: table})
cmd("event", event{Table: table})
cmd("member", placeUser{Tables: Tables{Table: table}})
cmd("service", service{})
}

View File

@ -11,6 +11,8 @@ import (
type event struct {
Table
user user
order string `data:"2"`
role string `data:"creator"`
portal string `data:"true"`
domain string `data:"gonganxitong"`
}

View File

@ -10,11 +10,7 @@ const (
TYPE = "type"
ROLE = "role"
STATUS = "status"
TABLES = "tables"
CONTENT = "content"
ADDRESS = "address"
EMAIL = "email"
AVATAR = "avatar"
OPERATE = "operate"
OPERATOR = "operator"
CREATED_AT = "created_at"
@ -39,6 +35,10 @@ const (
APPLY_STATUS = "apply_status"
ORDER_UID = "order_uid"
ORDER_STATUS = "order_status"
TABLES = "tables"
EMAIL = "email"
AVATAR = "avatar"
ADDRESS = "address"
)
type Sess struct {
@ -71,28 +71,28 @@ type Place struct {
}
type Street struct {
db.ModelWithUID
CityUID string `gorm:"type:char(32);index"`
Name string `gorm:"type:char(64);index"`
CityUID string `gorm:"type:char(32);index:idx_city"`
Name string `gorm:"type:char(64);index:idx_city"`
Info string
}
type City struct {
db.ModelWithUID
Name string `gorm:"type:char(32);index"`
Name string `gorm:"type:char(64);index"`
}
type Event struct {
db.ModelWithUID
UserUID string `gorm:"type:char(32);index"`
PlaceUID string `gorm:"type:char(32);index"`
PlaceUID string `gorm:"type:char(32);index:idx_place"`
UserUID string `gorm:"type:char(32);index:idx_place"`
Index string `gorm:"type:char(32)"`
Operate string `gorm:"type:char(32)"`
Args string `gorm:"type:char(32)"`
Info string
Info string `gorm:"type:varchar(255)"`
}
type Apply struct {
db.ModelWithUID
UserUID string `gorm:"type:char(32);index"`
PlaceUID string `gorm:"type:char(32);index"`
PlaceUID string `gorm:"type:char(32);index:idx_place"`
UserUID string `gorm:"type:char(32);index:idx_place"`
Tables string `gorm:"type:char(32)"`
Status uint8
Role uint8
@ -102,7 +102,7 @@ type Apply struct {
type Order struct {
db.ModelWithUID
UserUID string `gorm:"type:char(32);index"`
ApplyUID string `gorm:"type:char(32)"`
ApplyUID string `gorm:"type:char(32);index"`
Status uint8
}

View File

@ -12,6 +12,8 @@ type order struct {
user user
event event
apply apply
order string `data:"4"`
role string `data:"creator"`
portal string `data:"true"`
domain string `data:"gonganxitong"`
create string `name:"create user_uid* apply_uid* status*"`

View File

@ -2,10 +2,7 @@ package gonganxitong
import "shylinux.com/x/ice"
type place struct {
Table
user user
}
type place struct{ Table }
func init() { ice.TeamCtxCmd(place{}) }

View File

@ -3,12 +3,13 @@ package gonganxitong
import "shylinux.com/x/ice"
type placeUser struct {
order string `data:"5"`
Tables
userPlace userPlace
}
func (s placeUser) List(m *ice.Message, arg ...string) {
m.Cmdy(s.userPlace, s.userPlace.User, arg).Action()
s.Display(m, "")
m.Cmdy(s.UserPlace, s.UserPlace.User, arg).Action()
}
func init() { ice.TeamCtxCmd(placeUser{}) }
func init() { ice.TeamCtxCmd(placeUser{Tables: newTables()}) }

View File

@ -21,13 +21,13 @@ $output>div.action div.item.button input:hover { background-color:var(--hover-bg
$output>div.action div.item.button i { display:none; }
$output>div.action div.item.button span { display:none; }
$output>fieldset table.content td { box-shadow:none; }
$output span.role { border:var(--box-notice); color:var(--notice-bg-color); }
$output span.type { border:var(--box-notice); color:var(--notice-bg-color); }
$output span.type { border:var(--box-notice); color:var(--notice-bg-color); padding:0 3px; }
$output span.role { border:var(--box-notice); color:var(--notice-bg-color); padding:0 3px; }
// $output span.status { border:var(--box-notice); color:var(--notice-bg-color); }
$output span.type.danger { border-color:var(--box-danger); color:var(--danger-bg-color); }
$output span.role.danger { border-color:var(--box-danger); color:var(--danger-bg-color); }
$output span.status.danger { border-color:var(--box-danger); color:var(--danger-bg-color); }
$output span.status.expire { border-color:var(--box-danger); color:var(--danger-bg-color); }
$output span.type.danger { border:var(--box-danger); color:var(--danger-bg-color); }
$output span.role.danger { border:var(--box-danger); color:var(--danger-bg-color); }
$output span.status.danger { border:var(--box-danger); color:var(--danger-bg-color); }
// $output span.status.expire { border:var(--box-danger); color:var(--danger-bg-color); }
$output table.content.detail tr.action input.icons { display:unset; }
$output table.content.detail tr.action i { display:none; }
$output table.content td.action i { display:none; }

View File

@ -2,6 +2,7 @@ package gonganxitong
import (
"shylinux.com/x/ice"
"shylinux.com/x/icebergs/base/aaa"
"shylinux.com/x/icebergs/base/ctx"
"shylinux.com/x/icebergs/base/mdb"
"shylinux.com/x/icebergs/base/web"
@ -71,7 +72,7 @@ func (s Portal) PlaceCreate(m *ice.Message, arg ...string) {
} else if s.Street.FindOrCreateByName(m, arg...); m.IsErr() {
return
}
name := m.Option(model.NAME)
name := m.Option(s.Keys(s.Place, model.NAME))
arg = kit.TransArgKeys(arg, s.Keys(s.Place, model.TYPE), model.TYPE)
arg = kit.TransArgKeys(arg, s.Keys(s.Place, model.NAME), model.NAME)
if m.Cmdy(s.Place, s.Create, arg[2:]).IsErr() {
@ -106,18 +107,20 @@ func (s Portal) SetIcons(m *ice.Message, arg ...string) {
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) Create(m *ice.Message, arg ...string) {
var _cmd *ice.Command
m.Search(m.Option(ctx.INDEX), func(key string, cmd *ice.Command) { _cmd = cmd })
args := []string{ctx.INDEX, m.Option(ctx.INDEX)}
msg := s.Hash.Select(m.Spawn(), m.Option(ctx.INDEX))
s.Hash.Create(m, ctx.INDEX, m.Option(ctx.INDEX), mdb.NAME, _cmd.Help, mdb.ICONS, _cmd.Icon, mdb.TIME, msg.Append(mdb.TIME))
if msg.Length() > 0 {
args = append(args, mdb.TIME, msg.Append(mdb.TIME))
}
m.Search(m.Option(ctx.INDEX), func(key string, cmd *ice.Command) {
args = append(args, mdb.NAME, cmd.Help, mdb.ICONS, cmd.Icon)
kit.For([]string{mdb.ORDER, mdb.TYPE, aaa.ROLE, mdb.VIEW}, func(key string) {
value := m.Conf(m.Option(ctx.INDEX), kit.Keym(key))
args = append(args, key, kit.Select(value, msg.Append(key)))
})
})
s.Hash.Create(m, args...)
}
func (s Portal) Show(m *ice.Message, arg ...string) {
key := m.PrefixKey()
@ -127,3 +130,10 @@ func (s Portal) Link(m *ice.Message, arg ...string) string {
return m.MergePodCmd("", m.Prefix(web.PORTAL)) + "?debug=true" +
"#" + kit.TrimSuffix(kit.Join([]string{arg[0], kit.Select(m.Prefix("apply"), arg, 1), kit.Select("", arg, 2)}, ":"), ":")
}
type portal struct {
Portal
name string `data:"公安系统"`
}
func init() { ice.TeamCtxCmd(portal{Portal: Portal{Table: newTable()}}) }

View File

@ -11,6 +11,7 @@
"event": "事件流",
"email": "邮箱配置",
"placeUser": "服务人员",
"member": "服务人员",
"cancel": "取消",
"submit": "提交",
"finish": "完成",
@ -28,7 +29,8 @@
"order": "https://img.icons8.com/officel/80/receipt-approved.png",
"event": "https://img.icons8.com/officel/80/property-with-timer.png",
"email": "https://img.icons8.com/officel/80/reading-confirmation.png",
"placeUser": "https://img.icons8.com/officel/80/person-at-home.png"
"placeUser": "https://img.icons8.com/officel/80/person-at-home.png",
"member": "https://img.icons8.com/officel/80/person-at-home.png"
},
"style": {
"placeRemove": "danger"

View File

@ -6,7 +6,11 @@ import (
"shylinux.com/x/community/src/gonganxitong/model"
)
type qrcode struct{ Tables }
type qrcode struct {
order string `data:"1"`
role string `data:"creator"`
Tables
}
func (s qrcode) List(m *ice.Message, arg ...string) {
m.Cmdy(s.UserPlace, m.Option(model.USER_UID), arg[0]).Cut(model.CITY_NAME, s.Keys(s.Street, model.NAME), s.Keys(s.Place, model.NAME))

View File

@ -6,6 +6,7 @@ import (
"shylinux.com/x/ice"
"shylinux.com/x/icebergs/base/aaa"
// "shylinux.com/x/icebergs/base/cli"
"shylinux.com/x/icebergs/base/ctx"
"shylinux.com/x/icebergs/base/mdb"
"shylinux.com/x/icebergs/base/nfs"
@ -19,7 +20,9 @@ import (
type service struct {
Table
order string `data:"100"`
portal string `data:"true"`
role string `data:"creator"`
domain string `data:"gonganxitong"`
update string `name:"update name icon index"`
autogen string `name:"autogen name* help* class* table*" icon:"bi bi-plus-square-dotted"`
@ -62,6 +65,7 @@ func (s service) Autogen(m *ice.Message, arg ...string) {
m.Cmd(nfs.DEFS, path.Join(p, m.Option(mdb.TABLE)+".go"), m.Template(from+"homework.go"))
m.Cmd(nfs.DEFS, path.Join(p, m.Option(mdb.TABLE)+".js"), m.Template(from+"homework.js"))
})
// m.Cmd(cli.SYSTEM, "gofmt", "-w", p)
}
func (s service) Compile(m *ice.Message, arg ...string) {
m.Cmdy(code.VIMER, code.COMPILE)

View File

@ -21,7 +21,7 @@ func (s sess) Create(m *ice.Message, arg ...string) {
}
func (s sess) Check(m *ice.Message, arg ...string) {
msg := s.Table.Select(m.Spawn(), model.UID, arg[0])
msg = m.Cmd(s.user, s.user.Select, model.UID, msg.Append(model.USER_UID))
msg = m.Cmd(s.user, s.Select, model.UID, msg.Append(model.USER_UID))
m.Option(ice.MSG_USERROLE, aaa.VOID)
m.Option(ice.MSG_USERNAME, msg.Append(model.UID))
m.Option(ice.MSG_USERNICK, msg.Append(model.NAME))

View File

@ -9,17 +9,15 @@ func init() { ice.TeamCtxCmd({{.Option "class"}}{}) }
type {{.Option "Class"}}Type int
const (
{{.Option "Class"}}Term {{.Option "Class"}}Type = iota
{{.Option "Class"}}Weekly
{{.Option "Class"}}Step
{{.Option "Class"}}Free
{{.Option "Class"}}RD {{.Option "Class"}}Type = iota
{{.Option "Class"}}OP
{{.Option "Class"}}HR
)
var {{.Option "Class"}}TypeList = map[{{.Option "Class"}}Type]string{
{{.Option "Class"}}Term: "term",
{{.Option "Class"}}Weekly: "weekly",
{{.Option "Class"}}Step: "step",
{{.Option "Class"}}Free: "free",
{{.Option "Class"}}RD: "RD",
{{.Option "Class"}}OP: "OP",
{{.Option "Class"}}HR: "HR",
}
func (s {{.Option "Class"}}Type) String() string { return {{.Option "Class"}}TypeList[s] }

View File

@ -8,10 +8,6 @@ import (
"{{.Option "module"}}/model"
)
type Tables struct {
guanlixitong.Tables
list string `name:"list {{.Option "class"}}_uid uid auto" role:"void"`
}
type Table struct {
guanlixitong.Table
list string `name:"list {{.Option "class"}}_uid uid auto" role:"void"`
@ -44,3 +40,24 @@ func (s Table) RewriteAppend(m *ice.Message, arg ...string) *ice.Message {
s.Table.RewriteAppend(m)
return m
}
func (s Table) checkRole(m *ice.Message, arg ...User{{.Option "Class"}}Role) bool {
kit.If(len(arg) == 0, func() { arg = append(arg, User{{.Option "Class"}}Leader) })
role := User{{.Option "Class"}}Role(kit.Int(m.Cmd(user{{.Option "Class"}}{}, s.Select, m.OptionSimple(model.{{.Option "CLASS"}}_UID, model.USER_UID)).Append(model.ROLE)))
for _, v := range append(arg, User{{.Option "Class"}}Creator) {
if role == v {
return true
}
}
return !m.WarnNotRight(true, role.String())
}
func (s Table) recordEvent(m *ice.Message, info string, arg ...string) *ice.Message {
s.Table.RecordEvent(m, m.Option(model.{{.Option "CLASS"}}_UID), info, kit.Select(m.Option(model.UID), arg, 0))
return m
}
type Tables struct {
Table
portal string `data:"true"`
}
func (s Tables) BeforeMigrate(m *ice.Message, arg ...string) {}

View File

@ -12,14 +12,17 @@ type {{.Option "table"}} struct {
{{.Option "class"}} {{.Option "class"}}
user{{.Option "Class"}} user{{.Option "Class"}}
portal string `data:"true"`
create string `name:"create content*" role:"void"`
create string `name:"create title* content*" role:"void"`
}
func (s {{.Option "table"}}) Create(m *ice.Message, arg ...string) {
s.Table.Create(m, kit.Simple(arg, m.OptionSimple(model.USER_UID, model.{{.Option "CLASS"}}_UID))...)
if s.checkRole(m) {
s.Table.Create(m, kit.Simple(arg, m.OptionSimple(model.USER_UID, model.{{.Option "CLASS"}}_UID))...)
s.recordEvent(m, m.Trans("create {{.Option "table"}} ", "创建场景数据 ")+m.Option(model.TITLE), m.Result())
}
}
func (s {{.Option "table"}}) List(m *ice.Message, arg ...string) {
s.TablesWithRole(m, arg, s, s.user{{.Option "Class"}}, s.{{.Option "class"}}, model.CONTENT).Display("")
s.TablesWithRole(m, arg, s.user{{.Option "Class"}}, s.{{.Option "class"}}, s, model.TITLE, model.CONTENT).Display("")
}
func init() { ice.TeamCtxCmd({{.Option "table"}}{}) }

View File

@ -1,11 +1,13 @@
Volcanos(chat.ONIMPORT, {
_init: function(can, msg) {
if (msg.IsDetail()) { var value = msg.TableDetail(); msg.Option("_share_title", value.title), msg.Option("_share_content", value.content) }
can.onimport.itemcards(can, msg, function(value) { return [
{view: html.TITLE, list: [{text: value.user_name},
{text: [can.user.transValue(can, value, "user_{{.Option "class"}}_role"), "", aaa.ROLE]},
{view: html.TITLE, list: [{text: value.title}]},
{view: html.STATUS, list: [
{text: value.uid.slice(0, 6)}, {text: can.base.TimeTrim(value.created_at)},
{text: value.user_name}, {text: [can.user.transValue(can, value, "user_{{.Option "class"}}_role"), "", [aaa.ROLE, can.onimport.roleStyle(can, value, "user_{{.Option "class"}}_role")]]},
]},
{view: html.STATUS, list: [{text: value.uid.slice(0, 6)}, {text: can.base.TimeTrim(value.created_at)},]},
{view: html.OUTPUT, list: [{text: value.content}]},
] })
},
})
})

View File

@ -7,6 +7,7 @@ const (
NAME = "name"
TYPE = "type"
ROLE = "role"
TITLE = "title"
CONTENT = "content"
USER_UID = "user_uid"
USER_{{.Option "CLASS"}}_ROLE = "user_{{.Option "class"}}_role"
@ -27,14 +28,15 @@ type User{{.Option "Class"}} struct {
type {{.Option "Class"}} struct {
db.ModelWithUID
CompanyUID string `gorm:"type:char(32);index"`
Name string `gorm:"type:varchar(255)"`
Name string `gorm:"type:char(64)"`
Type uint8
}
type {{.Option "Table"}} struct {
db.ModelWithUID
{{.Option "Class"}}UID string `gorm:"type:char(32);index"`
UserUID string `gorm:"type:char(32);index"`
Content string `gorm:"type:varchar(255)"`
Title string `gorm:"type:char(64)"`
Content string
}

View File

@ -9,7 +9,7 @@ type Portal struct {
gonganxitong.Portal
name string `data:"{{.Option "help"}}"`
list string `name:"list {{.Option "class"}}_uid index uid auto" role:"void"`
placeCreate string `name:"placeCreate city_name* company_name* name*" role:"void"`
placeCreate string `name:"placeCreate city_name* company_name* {{.Option "class"}}_name*" role:"void"`
}
func init() {

View File

@ -4,20 +4,24 @@
"placeRemove": "删除场景",
"{{.Option "table"}}": "场景应用",
"icons": {
"{{.Option "table"}}": "https://img.icons8.com/officel/80/activity-grid.png",
"service": "https://img.icons8.com/officel/80/activity-grid.png"
"{{.Option "table"}}": "https://img.icons8.com/officel/80/activity-grid.png"
},
"input": {
"My {{.Option "Class"}}": "我的场景",
"user_{{.Option "class"}}_role": "用户角色",
"{{.Option "class"}}_uid": "场景",
"{{.Option "class"}}_name": "场景名称",
"{{.Option "class"}}_type": "场景类型"
},
"value": {
"user_{{.Option "class"}}_role": {
"creator": "创建人",
"visitor": "访客"
"visitor": "访客",
"leader": "管理人员",
"worker": "工作人员",
"server": "服务人员",
"style": {
"creator": "danger"
}
},
"{{.Option "class"}}_type": {
"term": "学期制",

View File

@ -12,6 +12,7 @@ type user{{.Option "Class"}} struct {
}
func (s user{{.Option "Class"}}) User(m *ice.Message, arg ...string) {
s.FieldsWithCreatedAT(m, s, model.USER_UID, model.ROLE)
if len(arg) == 1 {
s.Select(m, model.{{.Option "CLASS"}}_UID, arg[0])
} else if len(arg) == 2 {
@ -26,12 +27,12 @@ func (s user{{.Option "Class"}}) User(m *ice.Message, arg ...string) {
func (s user{{.Option "Class"}}) List(m *ice.Message, arg ...string) {
s.Tables(m, s.{{.Option "class"}}).FieldsWithCreatedAT(m, s,
model.{{.Option "CLASS"}}_NAME, model.{{.Option "CLASS"}}_TYPE, model.USER_{{.Option "CLASS"}}_ROLE,
model.{{.Option "CLASS"}}_UID, model.COMPANY_UID,
model.COMPANY_UID, model.{{.Option "CLASS"}}_UID,
)
if len(arg) == 1 {
s.Select(m, model.USER_UID, arg[0])
} else if len(arg) == 2 {
s.SelectDetail(m, model.USER_UID, arg[0], s.Key(s.{{.Option "class"}}, model.UID), arg[1])
s.SelectDetail(m, model.USER_UID, arg[0], s.Key(s, model.{{.Option "CLASS"}}_UID), arg[1])
} else {
return
}
@ -47,11 +48,17 @@ type User{{.Option "Class"}}Role int
const (
User{{.Option "Class"}}Creator User{{.Option "Class"}}Role = iota
User{{.Option "Class"}}Visitor
User{{.Option "Class"}}Leader
User{{.Option "Class"}}Worker
User{{.Option "Class"}}Server
)
var User{{.Option "Class"}}RoleList = map[User{{.Option "Class"}}Role]string{
User{{.Option "Class"}}Creator: "creator",
User{{.Option "Class"}}Visitor: "visitor",
User{{.Option "Class"}}Leader: "leader",
User{{.Option "Class"}}Worker: "worker",
User{{.Option "Class"}}Server: "server",
}
func (s User{{.Option "Class"}}Role) String() string { return User{{.Option "Class"}}RoleList[s] }

View File

@ -6,6 +6,7 @@ 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"
@ -13,9 +14,10 @@ import (
type user struct {
Table
template string `data:"4b-Z_r8dZmm1pHdd2h4A10VVYX4OIHvemlLjsHKBj2s"`
create string `name:"create open_id* name usernick"`
email string `name:"email email*"`
community string `data:"20240724-community"`
template string `data:"4b-Z_r8dZmm1pHdd2h4A10VVYX4OIHvemlLjsHKBj2s"`
create string `name:"create open_id* name usernick"`
email string `name:"email email*"`
}
func (s user) Create(m *ice.Message, arg ...string) {
@ -43,6 +45,10 @@ func (s user) SetCookie(m *ice.Message, arg ...string) {
m.ProcessCookie(model.USER_UID, m.Option(model.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),

View File

@ -30,14 +30,10 @@ func (s userPlace) User(m *ice.Message, arg ...string) {
func (s userPlace) List(m *ice.Message, arg ...string) {
s.Tables(m, s.place, s.street, s.city).FieldsWithCreatedAT(m, s,
model.PLACE_NAME, model.PLACE_TYPE, model.USER_PLACE_ROLE,
model.PLACE_UID, model.CITY_NAME, model.STREET_NAME, model.PLACE_ADDRESS,
model.CITY_NAME, model.STREET_NAME, model.PLACE_ADDRESS, model.PLACE_UID,
)
if len(arg) == 1 {
s.Select(m, model.USER_UID, arg[0])
} else if len(arg) == 2 {
s.SelectDetail(m, model.USER_UID, arg[0], model.PLACE_UID, arg[1])
} else {
return
}
s.RewriteAppend(m)
}

View File

@ -5,8 +5,9 @@ import (
_ "shylinux.com/x/community/src/gonganxitong"
_ "shylinux.com/x/community/src/gonganxitong/express"
_ "shylinux.com/x/community/src/yuehaoxitong"
_ "shylinux.com/x/community/src/baoanxitong"
)
func main() { print(ice.Run()) }

View File

@ -1,13 +1,12 @@
package {{.Option "zone"}}
package ludengguanli
import "shylinux.com/x/ice"
type {{.Option "name"}} struct {
Table
type good struct {
Tables
}
func (s {{.Option "name"}}) List(m *ice.Message, arg ...string) {
s.Table.List(m, arg...)
func (s good) List(m *ice.Message, arg ...string) {
}
func init() { ice.TeamCtxCmd({{.Option "name"}}{}) }
func init() { ice.TeamCtxCmd(good{}) }

View File

@ -1,10 +1,10 @@
Volcanos(chat.ONIMPORT, {
_init: function(can, msg) {
can.onimport.itemcards(can, msg, function(value) {
return [
{view: html.TITLE, list:[{text: [value.name||value.user_name]}]},
{view: html.STATUS, list: [value.uid && {text: value.uid.slice(0, 6)}, {text: can.base.TimeTrim(value.created_at||value.updated_at)}]},
]
})
if (msg.IsDetail()) { var value = msg.TableDetail(); msg.Option("_share_title", value.title), msg.Option("_share_content", value.content) }
can.onimport.itemcards(can, msg, function(value) { return [
{view: html.TITLE, list: [{text: value.title}]},
{view: html.STATUS, list: [{text: value.uid.slice(0, 6)}, {text: can.base.TimeTrim(value.created_at)}, {text: value.user_name}]},
{view: html.OUTPUT, list: [{text: value.content}]},
] })
},
})

View File

@ -61,9 +61,7 @@ type Tables struct {
portal string `data:"true"`
}
func (s Tables) Init(m *ice.Message, arg ...string) {
s.Portal.Show(m)
}
func (s Tables) Init(m *ice.Message, arg ...string) { s.Portal.Show(m) }
func (s Tables) BeforeMigrate(m *ice.Message, arg ...string) {
}

View File

@ -44,13 +44,13 @@ type UserQueue struct {
type Queue struct {
db.ModelWithUID
CompanyUID string `gorm:"type:char(32);index"`
Name string `gorm:"type:varchar(64)"`
Name string `gorm:"type:char(64)"`
Type uint8
}
type Reception struct {
db.ModelWithUID
QueueUID string `gorm:"type:char(32);index"`
Name string `gorm:"type:varchar(64)"`
Name string `gorm:"type:char(64)"`
}
type Volume struct {
db.ModelWithUID

View File

@ -1,14 +0,0 @@
package yuehaoxitong
import "shylinux.com/x/ice"
type queueUser struct {
Tables
userQueue userQueue
}
func (s queueUser) List(m *ice.Message, arg ...string) {
m.Cmdy(s.userQueue, s.userQueue.User, arg)
}
func init() { ice.TeamCtxCmd(queueUser{}) }

View File

@ -18,7 +18,7 @@ type reception struct {
func (s reception) Create(m *ice.Message, arg ...string) {
if s.checkRole(m) {
s.Table.Create(m, append(arg, m.OptionSimple(model.QUEUE_UID)...)...)
s.RecordEvent(m, m.Trans("create reception ", "创建服务场所 ")+m.Option(mdb.NAME), m.Result())
s.recordEvent(m, m.Trans("create reception ", "创建服务场所 ")+m.Option(mdb.NAME), m.Result())
}
}
func (s reception) List(m *ice.Message, arg ...string) {

View File

@ -17,6 +17,8 @@ func (s userQueue) User(m *ice.Message, arg ...string) {
s.Select(m, model.QUEUE_UID, arg[0])
} else if len(arg) == 2 {
s.SelectDetail(m, model.QUEUE_UID, arg[0], model.UID, arg[1])
} else {
return
}
m.RenameAppend(model.ROLE, model.USER_QUEUE_ROLE)
s.SelectJoinUser(m)
@ -25,12 +27,10 @@ func (s userQueue) User(m *ice.Message, arg ...string) {
func (s userQueue) List(m *ice.Message, arg ...string) {
s.Tables(m, s.queue).FieldsWithCreatedAT(m, s,
model.QUEUE_NAME, model.QUEUE_TYPE, model.USER_QUEUE_ROLE,
model.QUEUE_UID, model.COMPANY_UID,
model.COMPANY_UID, model.QUEUE_UID,
)
if len(arg) == 1 {
s.Select(m, model.USER_UID, arg[0])
} else if len(arg) == 2 {
s.SelectDetail(m, model.USER_UID, arg[0], s.Key(s, model.QUEUE_UID), arg[1])
}
s.SelectJoinCompany(m)
s.SelectJoinCity(m)