admin

package
v0.0.0-...-d43a9a6 Latest Latest
Warning

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

Go to latest
Published: Aug 27, 2019 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Overview

Copyright 2017 by rabbit author: gdccmcm14@live.com. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License

Copyright 2017 by rabbit author: gdccmcm14@live.com. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License

Copyright 2017 by rabbit author: gdccmcm14@live.com. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License

Copyright 2017 by rabbit author: gdccmcm14@live.com. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License

Copyright 2017 by rabbit author: gdccmcm14@live.com. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AccessList

func AccessList(uid int64) (list []orm.Params, err error)

func AddGroup

func AddGroup(g *Group) (int64, error)

func AddNode

func AddNode(n *Node) (int64, error)

func AddRole

func AddRole(r *Role) (int64, error)

func AddRoleNode

func AddRoleNode(roleid int64, nodeid int64) (int64, error)

func AddRoleUser

func AddRoleUser(roleid int64, userid int64) (int64, error)

func AddUser

func AddUser(u *User) (int64, error)

func DelGroupById

func DelGroupById(Id int64) (status int64, err error)

func DelGroupNode

func DelGroupNode(roleid int64, groupid int64) error

func DelNodeById

func DelNodeById(Id int64) (int64, error)

func DelRoleById

func DelRoleById(Id int64) (int64, error)

func DelUserById

func DelUserById(Id int64) (int64, error)

func DelUserRole

func DelUserRole(roleid int64) error

func GetGrouplist

func GetGrouplist(page int64, page_size int64, sort string) (groups []orm.Params, count int64)

func GetNodeTree

func GetNodeTree(pid int64, level int64) ([]orm.Params, error)

func GetNodelist

func GetNodelist(page int64, page_size int64, sort string) (nodes []orm.Params, count int64)

func GetNodelistByGroupid

func GetNodelistByGroupid(Groupid int64) (nodes []orm.Params, count int64)

func GetNodelistByRoleId

func GetNodelistByRoleId(Id int64) (nodes []orm.Params, count int64)

func GetRolelist

func GetRolelist(page int64, page_size int64, sort string) (roles []orm.Params, count int64)

func GetUserByRoleId

func GetUserByRoleId(roleid int64) (users []orm.Params, count int64)

func Getuserlist

func Getuserlist(page int64, page_size int64, sort string) (users []orm.Params, count int64)

列出用户

func GroupList

func GroupList() (groups []orm.Params)

func InitData

func InitData()

func InsertCategory

func InsertCategory()

func InsertConfig

func InsertConfig()

插入网站配置

func InsertGroup

func InsertGroup()

模组数据

func InsertNodes

func InsertNodes()

节点数据

func InsertPaper

func InsertPaper()

func InsertRole

func InsertRole()

角色数据

func InsertRoll

func InsertRoll()

func InsertUser

func InsertUser()

用户数据

func UpdateGroup

func UpdateGroup(g *Group) (int64, error)

func UpdateNode

func UpdateNode(n *Node) (int64, error)

func UpdateRole

func UpdateRole(r *Role) (int64, error)

func UpdateUser

func UpdateUser(u *User) (int64, error)

func UpdateUserPasswd

func UpdateUserPasswd(u *User) (int64, error)

Types

type Group

type Group struct {
	Id     int64
	Name   string  `orm:"size(100)" form:"Name"  valid:"Required"`
	Title  string  `orm:"size(100)" form:"Title"  valid:"Required"`
	Status int     `orm:"default(2)" form:"Status" valid:"Range(1,2)"`
	Sort   int     `orm:"default(1)" form:"Sort"`
	Nodes  []*Node `orm:"reverse(many)"`
}

func (*Group) Delete

func (m *Group) Delete() error

func (*Group) Insert

func (m *Group) Insert() error

func (*Group) Query

func (m *Group) Query() orm.QuerySeter

func (*Group) Read

func (m *Group) Read(fields ...string) error

func (*Group) TableName

func (g *Group) TableName() string

func (*Group) Update

func (m *Group) Update(fields ...string) error

type Node

type Node struct {
	Id     int64
	Title  string  `orm:"size(100)" form:"Title"  valid:"Required"`
	Name   string  `orm:"size(100)" form:"Name"  valid:"Required"`
	Level  int     `orm:"default(1)" form:"Level"  valid:"Required"`
	Pid    int64   `form:"Pid"  valid:"Required"`
	Remark string  `orm:"null;size(200)" form:"Remark" valid:"MaxSize(200)"`
	Status int     `orm:"default(2)" form:"Status" valid:"Range(1,2)"`
	Group  *Group  `orm:"rel(fk)"`
	Role   []*Role `orm:"rel(m2m)"`
}

func ReadNode

func ReadNode(nid int64) (Node, error)

func (*Node) Delete

func (m *Node) Delete() error

func (*Node) Insert

func (m *Node) Insert() error

func (*Node) Query

func (m *Node) Query() orm.QuerySeter

func (*Node) Read

func (m *Node) Read(fields ...string) error

func (*Node) TableName

func (n *Node) TableName() string

func (*Node) Update

func (m *Node) Update(fields ...string) error

type Role

type Role struct {
	Id     int64
	Title  string  `orm:"size(100)" form:"Title"  valid:"Required"`
	Name   string  `orm:"size(100)" form:"Name"  valid:"Required"`
	Remark string  `orm:"null;size(200)" form:"Remark" valid:"MaxSize(200)"`
	Status int     `orm:"default(2)" form:"Status" valid:"Range(1,2)"`
	Node   []*Node `orm:"reverse(many)"`
	User   []*User `orm:"reverse(many)"`
}

角色表

func (*Role) Delete

func (m *Role) Delete() error

func (*Role) Insert

func (m *Role) Insert() error

func (*Role) Query

func (m *Role) Query() orm.QuerySeter

func (*Role) Read

func (m *Role) Read(fields ...string) error

func (*Role) TableName

func (r *Role) TableName() string

func (*Role) Update

func (m *Role) Update(fields ...string) error

type User

type User struct {
	Id            int64
	Logincount    int
	Username      string    `orm:"unique;size(32)" form:"Username"  valid:"Required;MaxSize(20);MinSize(6)"`
	Password      string    `orm:"size(32)" form:"Password" valid:"Required;MaxSize(20);MinSize(6)"`
	Repassword    string    `orm:"-" form:"Repassword" valid:"Required"`
	Nickname      string    `orm:"unique;size(32)" form:"Nickname" valid:"Required;MaxSize(20);MinSize(2)"`
	Email         string    `orm:"size(32)" form:"Email" valid:"Email"`
	Remark        string    `orm:"null;size(200)" form:"Remark" valid:"MaxSize(200)"`
	Status        int       `orm:"default(2)" form:"Status" valid:"Range(1,2)"`
	Lastlogintime time.Time `orm:"null;type(datetime)" form:"-"`
	Createtime    time.Time `orm:"type(datetime)" `
	Lastip        string
	Role          []*Role `orm:"rel(m2m)"`
}

func GetUserByUsername

func GetUserByUsername(username string) (user User)

func UpdateLoginTime

func UpdateLoginTime(u *User) User

func (*User) Delete

func (m *User) Delete() error

func (*User) Insert

func (m *User) Insert() error

func (*User) Query

func (m *User) Query() orm.QuerySeter

func (*User) Read

func (m *User) Read(fields ...string) error

func (*User) TableName

func (u *User) TableName() string

func (*User) Update

func (m *User) Update(fields ...string) error

func (*User) Valid

func (u *User) Valid(v *validation.Validation)

Jump to

Keyboard shortcuts

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