Browse Source

update

add_mode
DengBiao 1 year ago
parent
commit
c96758c784
3 changed files with 15 additions and 5 deletions
  1. +3
    -3
      app/admin/hdl/hdl_role.go
  2. +8
    -0
      app/db/db_admin_role.go
  3. +4
    -2
      app/router/admin_router.go

+ 3
- 3
app/admin/hdl/hdl_role.go View File

@@ -105,12 +105,12 @@ func RoleList(c *gin.Context) {
for _, v := range *roleList {
var temp md.RoleListResp
temp.Data = v
adminRole, err1 := adminRoleDb.GetAdminRoleByRole(v.Id)
adminRoles, err1 := adminRoleDb.FindAdminRoleByRoleId(v.Id)
if err1 != nil {
e.OutErr(c, e.ERR_DB_ORM, err1.Error())
return
}
if adminRole != nil {
for _, adminRole := range *adminRoles {
admin, err2 := adminDb.GetAdmin(adminRole.AdmId)
if err2 != nil {
e.OutErr(c, e.ERR_DB_ORM, err2.Error())
@@ -121,8 +121,8 @@ func RoleList(c *gin.Context) {
}{
Name: admin.Username,
})
result = append(result, &temp)
}
result = append(result, &temp)
}
e.OutSuc(c, map[string]interface{}{
"list": result,


+ 8
- 0
app/db/db_admin_role.go View File

@@ -23,6 +23,14 @@ func (adminRoleDb *AdminRoleDb) FindAdminRole(id int) (*[]model.AdminRole, error
return &m, nil
}

func (adminRoleDb *AdminRoleDb) FindAdminRoleByRoleId(id int) (*[]model.AdminRole, error) {
var m []model.AdminRole
if err := adminRoleDb.Db.Where("role_id =?", id).Find(&m); err != nil {
return nil, logx.Error(err)
}
return &m, nil
}

func (adminRoleDb *AdminRoleDb) AdminDeleteBySessionForAdmId(session *xorm.Session, admId interface{}) (int64, error) {
if reflect.TypeOf(admId).Kind() == reflect.Slice {
return session.In("adm_id", admId).Delete(model.AdminRole{})


+ 4
- 2
app/router/admin_router.go View File

@@ -266,10 +266,12 @@ func AdminRoute(r *gin.RouterGroup) {
r.Use(mw.Auth) //检测登录状态
r.GET("/userInfo", hdl2.UserInfo) //用户信息
r.GET("/sysCfg", hdl2.GetSysCfg) //基础配置-获取

r.Use(mw.CheckPermission) //检测权限
rOss(r.Group("/oss"))
rComm(r.Group("/comm"))

r.Use(mw.CheckPermission) //检测权限

rHomePage(r.Group("/homePage")) //首页
rCompany(r.Group("/company")) //公司管理
rNotice(r.Group("/notice")) //公告管理


Loading…
Cancel
Save