作者 唐旭辉

存储

@@ -34,7 +34,7 @@ func (c *RbacController) RoleAdd() { @@ -34,7 +34,7 @@ func (c *RbacController) RoleAdd() {
34 msg = protocol.BadRequestParam("1") 34 msg = protocol.BadRequestParam("1")
35 return 35 return
36 } 36 }
37 - err := serverbac.RoleAdd(param) 37 + _, err := serverbac.RoleAdd(param)
38 msg = protocol.NewReturnResponse(nil, err) 38 msg = protocol.NewReturnResponse(nil, err)
39 return 39 return
40 } 40 }
@@ -58,7 +58,7 @@ func (c *RbacController) RoleUpdate() { @@ -58,7 +58,7 @@ func (c *RbacController) RoleUpdate() {
58 return 58 return
59 } 59 }
60 60
61 - err := serverbac.RoleEdit(param) 61 + _, err := serverbac.RoleEdit(param)
62 msg = protocol.NewReturnResponse(nil, err) 62 msg = protocol.NewReturnResponse(nil, err)
63 return 63 return
64 } 64 }
@@ -106,3 +106,13 @@ func DeleteRole(id int) (err error) { @@ -106,3 +106,13 @@ func DeleteRole(id int) (err error) {
106 } 106 }
107 return 107 return
108 } 108 }
  109 +
  110 +func DeleteRoleByPid(pid int) (err error) {
  111 + // o := orm.NewOrm()
  112 +
  113 + // var num int64
  114 + // deleteAt = time.Now()
  115 + // o.QueryTable(&Role{}).Filter("pid", pid).Update(orm.Params{})
  116 +
  117 + return
  118 +}
@@ -17,9 +17,9 @@ func init() { @@ -17,9 +17,9 @@ func init() {
17 beego.NSRouter("/department", &controllers.CompanyController{}, "delete:DepartmentDelete"), 17 beego.NSRouter("/department", &controllers.CompanyController{}, "delete:DepartmentDelete"),
18 ), 18 ),
19 beego.NSNamespace("/rbac", 19 beego.NSNamespace("/rbac",
20 - beego.NSRouter("/role", &controllers.CompanyController{}, "post:RoleAdd"),  
21 - beego.NSRouter("/role", &controllers.CompanyController{}, "put:RoleUpdate"),  
22 - beego.NSRouter("/role", &controllers.CompanyController{}, "delete:RoleDelete"), 20 + beego.NSRouter("/role", &controllers.RbacController{}, "post:RoleAdd"),
  21 + beego.NSRouter("/role", &controllers.RbacController{}, "put:RoleUpdate"),
  22 + beego.NSRouter("/role", &controllers.RbacController{}, "delete:RoleDelete"),
23 ), 23 ),
24 ) 24 )
25 25
@@ -53,6 +53,10 @@ func RoleDelete(param protocol.RequestRoleDelete) error { @@ -53,6 +53,10 @@ func RoleDelete(param protocol.RequestRoleDelete) error {
53 log.Error(e.Error()) 53 log.Error(e.Error())
54 return protocol.NewErrWithMessage("1", e) 54 return protocol.NewErrWithMessage("1", e)
55 } 55 }
  56 + //TODO
  57 + if role.Types == models.ROLETYPES_GROUP {
  58 +
  59 + }
56 if err := models.DeleteRole(param.RoleID); err != nil { 60 if err := models.DeleteRole(param.RoleID); err != nil {
57 e := fmt.Errorf("DeleteRole err:%s", err) 61 e := fmt.Errorf("DeleteRole err:%s", err)
58 log.Error(e.Error()) 62 log.Error(e.Error())