-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #384 from go-admin-team/dev
admin中的公共中间件,提到common 495a9c5
- Loading branch information
Showing
15 changed files
with
92 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -284,4 +284,4 @@ func (e *SysDept) GetDeptTreeRoleSelect(c *gin.Context) { | |
"depts": result, | ||
"checkedKeys": menuIds, | ||
}, "") | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
2 changes: 1 addition & 1 deletion
2
app/admin/models/system/login.go → common/middleware/handler/login.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
package system | ||
package handler | ||
|
||
import ( | ||
log "github.com/go-admin-team/go-admin-core/logger" | ||
|
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package handler | ||
|
||
import "go-admin/common/models" | ||
|
||
type SysRole struct { | ||
RoleId int `json:"roleId" gorm:"primaryKey;autoIncrement"` // 角色编码 | ||
RoleName string `json:"roleName" gorm:"size:128;"` // 角色名称 | ||
Status string `json:"status" gorm:"size:4;"` // | ||
RoleKey string `json:"roleKey" gorm:"size:128;"` //角色代码 | ||
RoleSort int `json:"roleSort" gorm:""` //角色排序 | ||
Flag string `json:"flag" gorm:"size:128;"` // | ||
Remark string `json:"remark" gorm:"size:255;"` //备注 | ||
Admin bool `json:"admin" gorm:"size:4;"` | ||
DataScope string `json:"dataScope" gorm:"size:128;"` | ||
Params string `json:"params" gorm:"-"` | ||
MenuIds []int `json:"menuIds" gorm:"-"` | ||
DeptIds []int `json:"deptIds" gorm:"-"` | ||
models.ControlBy | ||
models.ModelTime | ||
} | ||
|
||
func (SysRole) TableName() string { | ||
return "sys_role" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
package handler | ||
|
||
import ( | ||
"go-admin/common/models" | ||
"gorm.io/gorm" | ||
) | ||
|
||
type SysUser struct { | ||
models.ControlBy | ||
models.ModelTime | ||
UserId int `gorm:"primaryKey;autoIncrement;comment:编码" json:"userId"` | ||
Username string `json:"username" gorm:"type:varchar(64);comment:用户名"` | ||
Password string `json:"-" gorm:"type:varchar(128);comment:密码"` | ||
NickName string `json:"nickName" gorm:"type:varchar(128);comment:昵称"` | ||
Phone string `json:"phone" gorm:"type:varchar(11);comment:手机号"` | ||
RoleId int `json:"roleId" gorm:"type:bigint(20);comment:角色ID"` | ||
Salt string `json:"-" gorm:"type:varchar(255);comment:加盐"` | ||
Avatar string `json:"avatar" gorm:"type:varchar(255);comment:头像"` | ||
Sex string `json:"sex" gorm:"type:varchar(255);comment:性别"` | ||
Email string `json:"email" gorm:"type:varchar(128);comment:邮箱"` | ||
DeptId int `json:"deptId" gorm:"type:bigint(20);comment:部门"` | ||
PostId int `json:"postId" gorm:"type:bigint(20);comment:岗位"` | ||
Remark string `json:"remark" gorm:"type:varchar(255);comment:备注"` | ||
Status string `json:"status" gorm:"type:varchar(4);comment:状态"` | ||
DeptIds []int `json:"deptIds" gorm:"-"` | ||
PostIds []int `json:"postIds" gorm:"-"` | ||
RoleIds []int `json:"roleIds" gorm:"-"` | ||
//Dept *SysDept `json:"dept"` | ||
} | ||
|
||
func (SysUser) TableName() string { | ||
return "sys_user" | ||
} | ||
|
||
func (e *SysUser) AfterFind(_ *gorm.DB) error { | ||
e.DeptIds = []int{e.DeptId} | ||
e.PostIds = []int{e.PostId} | ||
e.RoleIds = []int{e.RoleId} | ||
return nil | ||
} |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.