system

package
v0.0.0-...-f9f9384 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 19, 2023 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DeleteAdmin

func DeleteAdmin(aid int) (err error)

func DeleteRole

func DeleteRole(rid int) (err error)

func I18n

func I18n() (en map[string]string, zh map[string]string)

func Migrate

func Migrate() (err error)

func NewAdmin

func NewAdmin(ad Admin, rids []int) (err error)

func NewRole

func NewRole(name string) (err error)

func UpdateAdmin

func UpdateAdmin(ad Admin, rids []int) (err error)

func UpdateRoleApis

func UpdateRoleApis(roleId int, aids []int) (err error)

func UpdateRoleFeatures

func UpdateRoleFeatures(roleId int, fids []int) (err error)

Types

type Admin

type Admin struct {
	Id       int    `json:"id"`
	Username string `json:"username"`
	Password string `json:"password"`
	Nickname string `json:"nickname"`
	Roles    []Role `gorm:"-" json:"roles"`
	// 是否启用
	Enabled bool `json:"enabled"`
}

Admin 管理员

func AdminList

func AdminList() (as []Admin, err error)

func GetAdmin

func GetAdmin(aid int) (ad Admin, err error)

func (Admin) TableName

func (Admin) TableName() string

func (Admin) ToSimple

func (r Admin) ToSimple() SimpleAdmin

type AdminRole

type AdminRole struct {
	Id    int
	Admin int
	Role  int
}

func (AdminRole) TableName

func (AdminRole) TableName() string

type Api

type Api struct {
	Id     int    `json:"id"`
	Name   string `json:"name"`
	Path   string `json:"path"`
	Method string `json:"method"`
}

func ApiList

func ApiList() (rs []Api, err error)

func Apis

func Apis(roles []int) (rs []Api, err error)

func (Api) TableName

func (Api) TableName() string

type Feature

type Feature struct {
	Id         int    `json:"id"`
	Name       string `json:"name"`
	Menu       int    `json:"menu_id"`
	MenuEntity Menu   `json:"menu" gorm:"-"`
}

func FeatureList

func FeatureList() (rm []Feature, err error)

func Features

func Features(roles []int) (rs []Feature, err error)

func SetMenuEntity

func SetMenuEntity(rm []Feature) []Feature

func (Feature) TableName

func (Feature) TableName() string

type FrontI18N

type FrontI18N struct {
	Name string
	En   string
	Zh   string
}

FrontI18N 前端i18n

func (FrontI18N) TableName

func (FrontI18N) TableName() string

type LoginParam

type LoginParam struct {
	Username string
	Password string
}

type LoginSucc

type LoginSucc struct {
	Id       int    `json:"id"`
	Token    string `json:"token"`
	Username string `json:"username"`
	Nickname string `json:"nickname"`
}

func Login

func Login(c *gin.Context, param LoginParam) (succ LoginSucc, ierr *i18n.Error)
type Menu struct {
	Id        int    `json:"id"`
	Name      string `json:"name"`
	Component string `json:"component"`
	Path      string `json:"path"`
	// 权限标识
	Auth   string `json:"auth"`
	Parent int    `json:"parent"`
}
func Menus(roles []int) (rs []Menu, err error)
func (Menu) TableName() string

type Role

type Role struct {
	Id    int    `json:"id"`
	Name  string `json:"name"`
	Menus []Menu `gorm:"-" json:"-"`
}

func RoleList

func RoleList() (rs []Role, err error)

func (Role) TableName

func (Role) TableName() string

type RoleApi

type RoleApi struct {
	Id   int
	Role int
	Api  int
}

func (RoleApi) TableName

func (RoleApi) TableName() string

type RoleFeature

type RoleFeature struct {
	Id      int
	Role    int
	Feature int
}

func (RoleFeature) TableName

func (RoleFeature) TableName() string

type RoleMenu

type RoleMenu struct {
	Id   int
	Role int
	Menu int
}

func (RoleMenu) TableName

func (RoleMenu) TableName() string

type SimpleAdmin

type SimpleAdmin struct {
	Id       int    `json:"id"`
	Username string `json:"username"`
	Nickname string `json:"nickname"`
	Rids     []int  ` json:"rids"`
	Enabled  bool   `json:"enabled"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL