Przeglądaj źródła

update

add_mode
DengBiao 1 rok temu
rodzic
commit
c96758c784
3 zmienionych plików z 15 dodań i 5 usunięć
  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 Wyświetl plik

@@ -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 Wyświetl plik

@@ -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 Wyświetl plik

@@ -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")) //公告管理


Ładowanie…
Anuluj
Zapisz