func (this *UserController) Index() { page, _ := this.GetInt64("page") page_size, _ := this.GetInt64("rows") sort := this.GetString("sort") order := this.GetString("order") if len(order) > 0 { if order == "desc" { sort = "-" + sort } } else { sort = "Id" } users, count := m.Getuserlist(page, page_size, sort) if this.IsAjax() { this.Data["json"] = &map[string]interface{}{"total": count, "rows": &users} this.ServeJSON() return } else { // tree := this.GetTree() // this.Data["tree"] = &tree this.Data["users"] = &users if this.GetTemplatetype() != "easyui" { this.Layout = this.GetTemplatetype() + "/public/layout.tpl" } this.TplName = this.GetTemplatetype() + "/rbac/user.tpl" } }
func (this *RoleController) RoleToUserList() { roleid, _ := this.GetInt64("Id") if this.IsAjax() { users, count := m.Getuserlist(1, 1000, "Id") list, _ := m.GetUserByRoleId(roleid) for i := 0; i < len(users); i++ { for x := 0; x < len(list); x++ { if users[i]["Id"] == list[x]["Id"] { users[i]["checked"] = 1 } } } if len(users) < 1 { users = []orm.Params{} } this.Data["json"] = &map[string]interface{}{"total": count, "rows": &users} this.ServeJson() return } else { this.Data["roleid"] = roleid this.TplNames = this.GetTemplatetype() + "/rbac/roletouserlist.tpl" } }