mirror of
https://shylinux.com/x/education
synced 2025-04-25 10:08:05 +08:00
add some
This commit is contained in:
parent
e3fd37dc41
commit
5d63ffdbc0
@ -9,7 +9,7 @@ import (
|
||||
|
||||
type document struct {
|
||||
Table
|
||||
create string `name:"create subject* grade* document_type*:select title* content* icon link" role:"teacher,student"`
|
||||
create string `name:"create subject* grade* document_type*:select title* content* icon link" role:"teacher"`
|
||||
}
|
||||
|
||||
func (s document) Create(m *ice.Message, arg ...string) {
|
||||
@ -25,8 +25,7 @@ func (s document) List(m *ice.Message, arg ...string) {
|
||||
} else if len(arg) == 2 {
|
||||
s.SelectDetail(m, model.LIBRARY_UID, arg[0], model.UID, arg[1])
|
||||
}
|
||||
m.PushAction(s.Remove)
|
||||
m.RenameAppend(model.TYPE, model.DOCUMENT_TYPE)
|
||||
m.RenameAppend(model.TYPE, model.DOCUMENT_TYPE).PushAction(s.Remove)
|
||||
}
|
||||
|
||||
func init() { ice.TeamCtxCmd(document{}) }
|
||||
|
@ -16,8 +16,6 @@ const (
|
||||
DOCUMENT_UID = "document_uid"
|
||||
DOCUMENT_TYPE = "document_type"
|
||||
CITY_UID = "city_uid"
|
||||
INDEX = "index"
|
||||
INIT = "init"
|
||||
LINK = "link"
|
||||
)
|
||||
|
||||
|
@ -10,6 +10,4 @@ type Portal struct {
|
||||
placeCreate string `name:"placeCreate city_name* school_name* library_type*:select library_name* link" role:"void"`
|
||||
}
|
||||
|
||||
func init() {
|
||||
gonganxitong.PortalCmd(Portal{Portal: jiaowuxitong.NewPortal(userLibrary{}, library{})})
|
||||
}
|
||||
func init() { gonganxitong.PortalCmd(Portal{Portal: jiaowuxitong.NewPortal(userLibrary{}, library{})}) }
|
||||
|
@ -12,5 +12,4 @@ func init() { ice.TeamCtxCmd(userLibrary{}) }
|
||||
|
||||
type UserLibraryRole = jiaowuxitong.UserClassRole
|
||||
|
||||
var UserLibraryCreator = jiaowuxitong.UserClassCreator
|
||||
var UserLibraryRoleList = jiaowuxitong.UserClassRoleList
|
||||
|
@ -1,6 +1,8 @@
|
||||
package jiaowuxitong
|
||||
|
||||
import (
|
||||
"strconv"
|
||||
|
||||
"shylinux.com/x/ice"
|
||||
kit "shylinux.com/x/toolkits"
|
||||
|
||||
@ -28,6 +30,9 @@ func (s Table) Inputs(m *ice.Message, arg ...string) {
|
||||
}
|
||||
func (s Table) RewriteAppend(m *ice.Message, arg ...string) *ice.Message {
|
||||
m.RewriteAppend(func(value, key string, index int) string {
|
||||
if _, e := strconv.ParseInt(value, 10, 64); e != nil {
|
||||
return value
|
||||
}
|
||||
switch key {
|
||||
case model.USER_CLASS_ROLE:
|
||||
value = UserClassRole(kit.Int(value)).String()
|
||||
@ -38,7 +43,9 @@ func (s Table) RewriteAppend(m *ice.Message, arg ...string) *ice.Message {
|
||||
})
|
||||
return s.Table.RewriteAppend(m)
|
||||
}
|
||||
|
||||
func (s Table) SelectJoinSchool(m *ice.Message) *ice.Message {
|
||||
return s.SelectJoin(m, school{}, model.NAME, model.CITY_UID)
|
||||
}
|
||||
func (s Table) CheckRole(m *ice.Message, arg ...string) *ice.Message {
|
||||
role := UserClassRole(s.UserPlaceRole(m))
|
||||
m.WarnNotRight(!kit.IsIn(role.String(), append(arg, UserClassCreator.String())...), role.String())
|
||||
@ -49,8 +56,6 @@ type Tables struct{ Table }
|
||||
|
||||
func (s Tables) BeforeMigrate(m *ice.Message, arg ...string) {}
|
||||
|
||||
func newTable() Table { return Table{Table: gonganxitong.NewTable(userClass{}, class{}, school{})} }
|
||||
|
||||
func NewPortal(userPlace gonganxitong.UserPlacer, place gonganxitong.Placer) Portal {
|
||||
return Portal{Portal: gonganxitong.NewPortal(userPlace, place, school{})}
|
||||
}
|
||||
|
@ -4,9 +4,7 @@ import "shylinux.com/x/community/src/gonganxitong"
|
||||
|
||||
type Portal struct {
|
||||
gonganxitong.Portal
|
||||
placeCreate string `name:"placeCreate city_name* school_name* grade*:select class_name*" role:"void"`
|
||||
placeCreate string `name:"placeCreate city_name* school_name* grade*:select class_type*:select class_name*" role:"void"`
|
||||
}
|
||||
|
||||
func init() {
|
||||
gonganxitong.PortalCmd(Portal{Portal: gonganxitong.NewPortal(userClass{}, class{}, school{})})
|
||||
}
|
||||
func init() { gonganxitong.PortalCmd(NewPortal(userClass{}, class{})) }
|
||||
|
@ -1,7 +1,7 @@
|
||||
{
|
||||
"portal": "教务系统",
|
||||
"member": "班级成员",
|
||||
"homework": "家庭作业",
|
||||
"member": "班级成员",
|
||||
"icons": {
|
||||
"homework": "https://img.icons8.com/officel/80/homework.png"
|
||||
},
|
||||
|
@ -23,5 +23,3 @@ func (s school) FindOrCreateByName(m *ice.Message, arg ...string) {
|
||||
}
|
||||
|
||||
func init() { ice.TeamCtxCmd(school{}) }
|
||||
|
||||
type School struct{ school }
|
||||
|
@ -4,7 +4,7 @@ import "shylinux.com/x/ice"
|
||||
|
||||
type userClass struct{ Table }
|
||||
|
||||
func init() { ice.TeamCtxCmd(userClass{Table: newTable()}) }
|
||||
func init() { ice.TeamCtxCmd(userClass{}) }
|
||||
|
||||
type UserClassRole int
|
||||
|
||||
|
@ -7,9 +7,7 @@ import (
|
||||
|
||||
type Portal struct {
|
||||
jiaowuxitong.Portal
|
||||
placeCreate string `name:"placeCreate city_name* school_name* exam_name*" role:"void"`
|
||||
placeCreate string `name:"placeCreate city_name* school_name* exam_type*:select exam_name*" role:"void"`
|
||||
}
|
||||
|
||||
func init() {
|
||||
gonganxitong.PortalCmd(Portal{Portal: jiaowuxitong.NewPortal(userExam{}, exam{})})
|
||||
}
|
||||
func init() { gonganxitong.PortalCmd(Portal{Portal: jiaowuxitong.NewPortal(userExam{}, exam{})}) }
|
||||
|
@ -12,5 +12,4 @@ func init() { ice.TeamCtxCmd(userExam{}) }
|
||||
|
||||
type UserExamRole = jiaowuxitong.UserClassRole
|
||||
|
||||
var UserExamCreator = jiaowuxitong.UserClassCreator
|
||||
var UserExamRoleList = jiaowuxitong.UserClassRoleList
|
||||
|
@ -11,7 +11,7 @@ type lesson struct {
|
||||
Table
|
||||
course course
|
||||
userCourse userCourse
|
||||
create string `name:"create title* content*" role:"leader"`
|
||||
create string `name:"create title* content*" role:"teacher"`
|
||||
}
|
||||
|
||||
func (s lesson) Create(m *ice.Message, arg ...string) {
|
||||
|
@ -7,9 +7,7 @@ import (
|
||||
|
||||
type Portal struct {
|
||||
jiaowuxitong.Portal
|
||||
placeCreate string `name:"placeCreate city_name* school_name* course_name*" role:"void"`
|
||||
placeCreate string `name:"placeCreate city_name* school_name* course_type*:select course_name*" role:"void"`
|
||||
}
|
||||
|
||||
func init() {
|
||||
gonganxitong.PortalCmd(Portal{Portal: jiaowuxitong.NewPortal(userCourse{}, course{})})
|
||||
}
|
||||
func init() { gonganxitong.PortalCmd(Portal{Portal: jiaowuxitong.NewPortal(userCourse{}, course{})}) }
|
||||
|
@ -12,5 +12,4 @@ func init() { ice.TeamCtxCmd(userCourse{}) }
|
||||
|
||||
type UserCourseRole = jiaowuxitong.UserClassRole
|
||||
|
||||
var UserCourseCreator = jiaowuxitong.UserClassCreator
|
||||
var UserCourseRoleList = jiaowuxitong.UserClassRoleList
|
||||
|
Loading…
x
Reference in New Issue
Block a user