feat:优化信息

This commit is contained in:
henry
2021-11-23 10:09:01 +08:00
parent ea4de49ae5
commit bcfe119972
3 changed files with 354 additions and 3 deletions

View File

@ -30,6 +30,21 @@ type (
Value string `json:"value"`
IsDeleted int `json:"is_deleted"`
}
// structForSysMenu 菜单配置
structForSysMenu struct {
ID uint64 `json:"id"`
ParentID uint64 `json:"parent_id"`
Name string `json:"name"`
Kind int `json:"kind"`
Link string `json:"link"`
Component string `json:"component"`
Icon string `json:"icon"`
Auth int `json:"auth"`
Sort int `json:"sort"`
Remark string `json:"remark"`
Status int `json:"status"`
IsDeleted int `json:"is_deleted"`
}
// structForSysRole 角色配置
structForSysRole struct {
ID uint64 `json:"id"`
@ -95,7 +110,33 @@ func initModel() {
})
return out
}},
&synchronized{iModel: model.NewSysMenu()}, &synchronized{iModel: model.NewSysAuth()},
&synchronized{iModel: model.NewSysMenu(), iValues: func() interface{} {
values := make([]*structForSysMenu, 0)
out := make([]*model.SysMenu, 0)
lib.LoadConfig("./json/sys_menu.json", &values, func(i interface{}) {
for _, v := range values {
out = append(out, &model.SysMenu{
Model: model.Model{ID: v.ID},
SysMenuBasic: model.SysMenuBasic{
ParentID: v.ParentID,
Name: v.Name,
Kind: model.SysMenuKind(v.Kind),
Link: v.Link,
Component: v.Component,
Icon: v.Icon,
},
Auth: model.SysMenuAuth(v.Auth),
Sort: v.Sort,
Remark: v.Remark,
Status: model.SysMenuStatus(v.Status),
ModelDeleted: model.ModelDeleted{IsDeleted: model.DeleteStatus(v.IsDeleted)},
})
}
})
return out
}}, &synchronized{iModel: model.NewSysAuth()},
&synchronized{iModel: model.NewSysUser(), iValues: func() interface{} {
return &model.SysUser{ModelTenant: model.ModelTenant{TenantID: 1}, Account: "admin", Name: "超级管理员",
Mobile: "13888888888", Password: "123456", IsAdmin: model.SysUserAdministratorForAdmin, Remark: "超级管理员"}