Pārlūkot izejas kodu

update

add_mode
DengBiao pirms 1 gada
vecāks
revīzija
c96758c784
3 mainītis faili ar 15 papildinājumiem un 5 dzēšanām
  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 Parādīt failu

@@ -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 Parādīt failu

@@ -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 Parādīt failu

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


Notiek ielāde…
Atcelt
Saglabāt