21 |
22 |
23 |
24 |
USERNAME
25 |
27 |
PASSWORD
28 |
30 |
31 |
35 |
36 |
41 |
42 |
43 |
45 |
46 |
47 |
48 |
49 |
72 |
73 |
74 |
--------------------------------------------------------------------------------
/static/js/themes/icon.css:
--------------------------------------------------------------------------------
1 | .icon-blank{
2 | background:url('icons/blank.gif') no-repeat center center;
3 | }
4 | .icon-add{
5 | background:url('icons/edit_add.png') no-repeat center center;
6 | }
7 | .icon-edit{
8 | background:url('icons/pencil.png') no-repeat center center;
9 | }
10 | .icon-clear{
11 | background:url('icons/clear.png') no-repeat center center;
12 | }
13 | .icon-remove{
14 | background:url('icons/edit_remove.png') no-repeat center center;
15 | }
16 | .icon-save{
17 | background:url('icons/filesave.png') no-repeat center center;
18 | }
19 | .icon-cut{
20 | background:url('icons/cut.png') no-repeat center center;
21 | }
22 | .icon-ok{
23 | background:url('icons/ok.png') no-repeat center center;
24 | }
25 | .icon-no{
26 | background:url('icons/no.png') no-repeat center center;
27 | }
28 | .icon-cancel{
29 | background:url('icons/cancel.png') no-repeat center center;
30 | }
31 | .icon-reload{
32 | background:url('icons/reload.png') no-repeat center center;
33 | }
34 | .icon-search{
35 | background:url('icons/search.png') no-repeat center center;
36 | }
37 | .icon-print{
38 | background:url('icons/print.png') no-repeat center center;
39 | }
40 | .icon-help{
41 | background:url('icons/help.png') no-repeat center center;
42 | }
43 | .icon-undo{
44 | background:url('icons/undo.png') no-repeat center center;
45 | }
46 | .icon-redo{
47 | background:url('icons/redo.png') no-repeat center center;
48 | }
49 | .icon-back{
50 | background:url('icons/back.png') no-repeat center center;
51 | }
52 | .icon-sum{
53 | background:url('icons/sum.png') no-repeat center center;
54 | }
55 | .icon-tip{
56 | background:url('icons/tip.png') no-repeat center center;
57 | }
58 | .icon-filter{
59 | background:url('icons/filter.png') no-repeat center center;
60 | }
61 | .icon-man{
62 | background:url('icons/man.png') no-repeat center center;
63 | }
64 | .icon-lock{
65 | background:url('icons/lock.png') no-repeat center center;
66 | }
67 | .icon-more{
68 | background:url('icons/more.png') no-repeat center center;
69 | }
70 | .icon-home{
71 | background:url('icons/home.png') no-repeat center center;
72 | }
73 |
74 |
75 | .icon-mini-add{
76 | background:url('icons/mini_add.png') no-repeat center center;
77 | }
78 | .icon-mini-edit{
79 | background:url('icons/mini_edit.png') no-repeat center center;
80 | }
81 | .icon-mini-refresh{
82 | background:url('icons/mini_refresh.png') no-repeat center center;
83 | }
84 |
85 | .icon-large-picture{
86 | background:url('icons/large_picture.png') no-repeat center center;
87 | }
88 | .icon-large-clipart{
89 | background:url('icons/large_clipart.png') no-repeat center center;
90 | }
91 | .icon-large-shapes{
92 | background:url('icons/large_shapes.png') no-repeat center center;
93 | }
94 | .icon-large-smartart{
95 | background:url('icons/large_smartart.png') no-repeat center center;
96 | }
97 | .icon-large-chart{
98 | background:url('icons/large_chart.png') no-repeat center center;
99 | }
100 |
--------------------------------------------------------------------------------
/views/role/roleList.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 | | 权限ID |
19 | 权限名称 |
20 | 权限地址 |
21 | 模块名称 |
22 | 操作名称 |
23 | 是否为菜单 |
24 | 权限说明 |
25 | 操作 |
26 |
27 |
28 |
29 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
--------------------------------------------------------------------------------
/static/js/admusergroup/admUserGroupList.js:
--------------------------------------------------------------------------------
1 | $(function () {
2 | searAdmUserGroupObj = {
3 | search: function () {
4 | $('#admusergroup_list').datagrid('load', {
5 | groupName: $('input[name="searchAdmUserGroupName"]').val()
6 | });
7 | }
8 | }
9 | //datagrid初始化
10 | $('#admusergroup_list').datagrid({
11 | url: 'admusergroup/gridlist',
12 | // queryParams: { roleid: 0 },
13 | iconCls: 'icon-edit',//图标
14 | width: 700,
15 | height: 'auto',
16 | nowrap: false,
17 | striped: true,
18 | border: true,
19 | collapsible: false,//是否可折叠的
20 | fit: true,//自动大小
21 | //sortName: 'code',
22 | //sortOrder: 'desc',
23 | remoteSort: false,
24 | idField: 'id',
25 | singleSelect: false,//是否单选
26 | pagination: true,//分页控件
27 | rownumbers: true,//行号
28 | fitColumns: true,//列宽自适应(列设置width=100)
29 | frozenColumns: [[
30 | { field: 'ck', checkbox: true }
31 | ]],//设置表单复选框
32 | toolbar: admusergroup_toolbar
33 | });
34 | })
35 |
36 | //添加修改按钮
37 | function admUserGrouproupOpt(val, row, index) {
38 | return '
修改';
39 | }
40 |
41 | //加载表格
42 | function loadAdmUserGroupDatagrid() {
43 | $('#admusergroup_list').datagrid('load', {
44 | });
45 | }
46 |
47 | //打开添加管理员组窗口
48 | function openAddAdmUserGroupWin() {
49 | $('#addadmusergroup').window({
50 | width: 800,
51 | height: 600,
52 | modal: true,
53 | // maximizable: false,
54 | minimizable: false,
55 | collapsible: false,//是否可折叠的
56 | href: "/admusergroup/toadd"
57 | });
58 | }
59 |
60 | //打开修改管理员组窗口
61 | function openModifyAdmUserGroupWin(admusergroupid) {
62 | $('#modifyadmusergroup').window({
63 | width: 800,
64 | height: 600,
65 | modal: true,
66 | // maximizable: false,
67 | minimizable: false,
68 | collapsible: false,//是否可折叠的
69 | href: "/admusergroup/tomodify?admusergroupid=" + admusergroupid
70 | });
71 | }
72 |
73 | //删除方法
74 | function deleteAdmUserGroup() {
75 | var selections = $('#admusergroup_list').datagrid('getSelections')
76 | if (selections.length == 0) {
77 | alert("请先选择要删除的记录")
78 | return false
79 | }
80 |
81 | if (!confirm("确定要删除选中的数据吗?")) {
82 | return false
83 | }
84 | var idArray = new Array(selections.length)
85 | for (var i = 0; i < selections.length; i++) {
86 | idArray[i] = selections[i].id
87 | }
88 | ids = idArray.join(",")
89 |
90 | url = "/admusergroup/delete"
91 | var data = { ids: ids };
92 |
93 | $.post(url, data, function (result) {
94 | if (result == "success") {
95 | loadAdmUserGroupDatagrid()
96 | $.messager.alert('操作提示', "删除成功", 'info');
97 | selections=0;
98 | } else {
99 | $.messager.alert('操作提示', result, 'warning');
100 | selections=0;
101 | }
102 | });
103 | }
--------------------------------------------------------------------------------
/static/js/admUser/modifyAdmuser.js:
--------------------------------------------------------------------------------
1 | $(function () {
2 | modifyAdmUserObj = {
3 | search: function () {
4 | $('#updateAdmUserGroup').datagrid('load', {
5 | groupName: $('input[name="modifyAdmUser_UserGroupName"]').val()
6 | });
7 | }
8 | }
9 | //datagrid初始化
10 | $('#updateAdmUserGroup').datagrid({
11 | url: 'admuser/gridgrouplist',
12 | queryParams: { admUserId: $("input[name='admUserId']").val() },
13 | iconCls: 'icon-edit',//图标
14 | width: 700,
15 | height: 'auto',
16 | nowrap: false,
17 | striped: true,
18 | border: true,
19 | collapsible: false,//是否可折叠的
20 | fit: true,//自动大小
21 | //sortName: 'code',
22 | //sortOrder: 'desc',
23 | remoteSort: false,
24 | idField: 'id',
25 | singleSelect: false,//是否单选
26 | pagination: true,//分页控件
27 | rownumbers: true,//行号
28 | fitColumns: true,//列宽自适应(列设置width=100)
29 | frozenColumns: [[
30 | { field: 'ck', checkbox: true }
31 | ]],//设置表单复选框
32 | toolbar: modifyAdmUser_toolbar,
33 | onLoadSuccess:function(row){//当表格成功加载时执行
34 | var rowData = row.rows;
35 | $.each(rowData,function(idx,val){//遍历JSON
36 | if(val.check==true){
37 | $("#updateAdmUserGroup").datagrid("selectRow", idx);//如果数据行为已选中则选中改行
38 | }
39 | });
40 | }
41 | });
42 | })
43 |
44 |
45 |
46 | function submitModifyAmdUserForm() {
47 | var selections = $('#updateAdmUserGroup').datagrid('getSelections')
48 | if (selections.length == 0) {
49 | $.messager.alert('操作提示', "请至少选择一个组", 'info');
50 | return false
51 | }
52 |
53 | var idArray = new Array(selections.length)
54 | for (var i = 0; i < selections.length; i++) {
55 | idArray[i] = selections[i].id
56 | }
57 | ids = idArray.join(",")
58 |
59 | url = "/admuser/modifyyadmuser"
60 | var data = {
61 | groupids: ids,
62 | userId:$("input[name='admUserId']").val(),
63 | account: $("input[name='modifyAdmUserAcout']").val(),
64 | name: $("input[name='modifyAdmUserName']").val(),
65 | phone: $("input[name='modifyAdmUserPhone']").val(),
66 | department: $("input[name='modifyAdmUserDepartment']").val(),
67 | password: $("input[name='modifyAdmUserPassword']").val(),
68 | mail: $("input[name='modifyAdmUserEmail']").val()
69 | };
70 |
71 | if (data.account.length < 1 || data.name.length < 1 || data.phone.length < 1 || data.department.length < 1 || data.mail.length < 1) {
72 | $.messager.alert('操作提示', "信息填写不完整,请补充后重新提交", 'info');
73 | return
74 | }
75 |
76 |
77 | $.post(url, data, function (result) {
78 | if (result == "success") {
79 | $('#modifyAdmUser').window("close")
80 | $.messager.alert('操作提示', "修改成功", 'info');
81 | loadModifyAdmUserGrid()
82 | } else {
83 | $.messager.alert('操作提示', result, 'info');
84 | }
85 | });
86 | }
87 |
88 |
89 | function clearModifyAmdUserForm() {
90 | $('#modifyAdmUser').form('clear');
91 | }
92 |
93 |
94 | function loadModifyAdmUserGrid() {
95 | $('#admUser_list').datagrid('load', {
96 | });
97 | }
--------------------------------------------------------------------------------
/static/js/admUser/admUserList.js:
--------------------------------------------------------------------------------
1 | $(function () {
2 | searAdmUserObj = {
3 | search: function () {
4 | $('#admUser_list').datagrid('load', {
5 | admaccout: $('input[name="searchAdmUserAccount"]').val(),
6 | admusername: $('input[name="searchAdmUserName"]').val(),
7 | admusermail: $('input[name="searchAdmUserEmail"]').val(),
8 | admuserphone: $('input[name="searchAdmUserPhone"]').val(),
9 | admuserid: $('input[name="searchAdmUserId"]').val()
10 | });
11 | }
12 | }
13 | //datagrid初始化
14 | $('#admUser_list').datagrid({
15 | url: 'admuser/gridlist',
16 |
17 | iconCls: 'icon-edit',//图标
18 | width: 700,
19 | height: 'auto',
20 | nowrap: false,
21 | striped: true,
22 | border: true,
23 | collapsible: false,//是否可折叠的
24 | fit: true,//自动大小
25 | //sortName: 'code',
26 | //sortOrder: 'desc',
27 | remoteSort: false,
28 | idField: 'id',
29 | singleSelect: false,//是否单选
30 | pagination: true,//分页控件
31 | rownumbers: true,//行号
32 | fitColumns: true,//列宽自适应(列设置width=100)
33 | frozenColumns: [[
34 | {field: 'ck', checkbox: true}
35 | ]],//设置表单复选框
36 | toolbar: admUser_toolbar
37 | });
38 | })
39 |
40 | //添加修改按钮
41 | function admUserOpt(val, row, index) {
42 | return '
修改';
43 | }
44 |
45 | //打开添加管理员组窗口
46 | function openAddAdmUserWin() {
47 | $('#addAdmUser').window({
48 | width: 800,
49 | height: 600,
50 | modal: true,
51 | // maximizable: false,
52 | minimizable: false,
53 | collapsible: false,//是否可折叠的
54 | href: "/admuser/toaddadmuser"
55 | });
56 | }
57 |
58 | //打开修改管理员组窗口
59 | function openModifyAdmUserWin(admUserId) {
60 | $('#modifyAdmUser').window({
61 | width: 800,
62 | height: 600,
63 | modal: true,
64 | // maximizable: false,
65 | minimizable: false,
66 | collapsible: false,//是否可折叠的
67 | href: "/admuser/tomodifyadmuser?admUserId=" + admUserId
68 | });
69 | }
70 |
71 | deleteAdmUser
72 |
73 |
74 | //删除方法
75 | function deleteAdmUser() {
76 | var selections = $('#admUser_list').datagrid('getSelections')
77 | if (selections.length == 0) {
78 | alert("请先选择要删除的记录")
79 | return false
80 | }
81 |
82 | if (!confirm("确定要删除选中的数据吗?")) {
83 | return false
84 | }
85 | var idArray = new Array(selections.length)
86 | for (var i = 0; i < selections.length; i++) {
87 | idArray[i] = selections[i].id
88 | }
89 | ids = idArray.join(",")
90 |
91 | url = "/admuser/delete"
92 | var data = { userids: ids };
93 |
94 | $.post(url, data, function (result) {
95 | if (result == "success") {
96 | loadModifyAdmUserGrid()
97 | $.messager.alert('操作提示', "删除成功", 'info');
98 | selections=0;
99 | } else {
100 | $.messager.alert('操作提示', result, 'warning');
101 | selections=0;
102 | }
103 | });
104 | }
105 |
106 | function loadModifyAdmUserGrid() {
107 | $('#admUser_list').datagrid('load', {
108 | });
109 | }
--------------------------------------------------------------------------------
/views/admUser/addAdmUser.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 | | 管理员组ID |
57 | 管理员组名称 |
58 | 描述信息 |
59 | 添加时间 |
60 |
61 |
62 |
63 |
71 |
72 |
73 |
74 |
75 |
--------------------------------------------------------------------------------
/views/admUser/modifyAdmUser.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 | | 管理员组ID |
61 | 管理员组名称 |
62 | 描述信息 |
63 | 添加时间 |
64 |
65 |
66 |
67 |
75 |
76 |
77 |
78 |
79 |
--------------------------------------------------------------------------------
/static/js/role/roleList.js:
--------------------------------------------------------------------------------
1 | $(function () {
2 | searRoleObj = {
3 | search: function () {
4 | $('#role_list').datagrid('load', {
5 | roleName: $('input[name="searchRoleName"]').val(),
6 | roleUrl: $('input[name="searchRoleUrl"]').val(),
7 | roleid: $("input[name='searchRolepid']").val()
8 | });
9 | }
10 | }
11 | //datagrid初始化
12 | $('#role_list').datagrid({
13 | url: 'role/gridlist',
14 | // queryParams: { roleid: 0 },
15 | iconCls: 'icon-edit',//图标
16 | width: 700,
17 | height: 'auto',
18 | nowrap: false,
19 | striped: true,
20 | border: true,
21 | collapsible: false,//是否可折叠的
22 | fit: true,//自动大小
23 | //sortName: 'code',
24 | //sortOrder: 'desc',
25 | remoteSort: false,
26 | idField: 'id',
27 | singleSelect: false,//是否单选
28 | pagination: true,//分页控件
29 | rownumbers: true,//行号
30 | fitColumns: true,//列宽自适应(列设置width=100)
31 | frozenColumns: [[
32 | { field: 'ck', checkbox: true }
33 | ]],//设置表单复选框
34 | toolbar: role_toolbar
35 | });
36 | })
37 |
38 | //添加修改按钮
39 | function roleOpt(val, row, index) {
40 | return '
修改';
41 | }
42 | //判断是否是菜单
43 | function roleIsMenu(val, row, index) {
44 | if (row.ismenu == 0) {
45 | return "是"
46 | } else if (row.ismenu == 1) {
47 | return "否"
48 | }
49 |
50 | }
51 |
52 |
53 | //设置tree的初始化参数
54 | var rolesetting = {
55 | data: {
56 | simpleData: {
57 | enable: true
58 | }
59 | }
60 | ,
61 | callback: {
62 | onClick: changeRoleList
63 | }
64 | };
65 |
66 | //初始化左边tree
67 | $(document).ready(loadTree());
68 | function loadTree(id) {
69 | url = "/role/listtree"
70 | // var zNodes = [{ id: 0, name: "Root", open: true }]
71 | var data = { id: id };
72 | $.post(url, data, function (result) {
73 | // zNodes = result
74 | $.fn.zTree.init($("#roletree"), rolesetting, result);
75 | });
76 | }
77 | // 点击tree节点的时候 重新加载右边的权限列表
78 | function changeRoleList(event, treeId, treeNode) {
79 | loaddatagrid(treeNode.id)
80 | $('#searchRolepid').val(treeNode.id)
81 | }
82 |
83 | //加载表格
84 | function loaddatagrid(id) {
85 | $('#role_list').datagrid('load', {
86 | roleid: id
87 | });
88 | }
89 |
90 | //打开添加权限目录窗口
91 | function openAddRoleWin() {
92 | $('#addRole').window({
93 | width: 400,
94 | height: 300,
95 | modal: true,
96 | maximizable: false,
97 | minimizable: false,
98 | collapsible: false,//是否可折叠的
99 | href: "/role/toadd"
100 | });
101 | }
102 |
103 | //打开添加权限目录窗口
104 | function openAddRoleDirWin() {
105 | $('#addRoleDir').window({
106 | width: 400,
107 | height: 300,
108 | modal: true,
109 | maximizable: false,
110 | minimizable: false,
111 | collapsible: false,//是否可折叠的
112 | href: "/role/toadddir"
113 | });
114 | }
115 |
116 | //打开修改权限窗口
117 | function openModifyRoleWin(roleid) {
118 | $("#roleid").attr("value", roleid);
119 | $('#modifyrole').window({
120 | width: 400,
121 | height: 300,
122 | modal: true,
123 | maximizable: false,
124 | minimizable: false,
125 | collapsible: false,//是否可折叠的
126 | href: "/role/tomodify?roleid=" + roleid
127 | });
128 | }
129 |
130 | //删除方法
131 | function deleteRole() {
132 | var selections = $('#role_list').datagrid('getSelections')
133 | if (selections.length == 0) {
134 | alert("请先选择要删除的列")
135 | return false
136 | }
137 |
138 | if (!confirm("确定要删除选中的数据吗?")) {
139 | return false
140 | }
141 | var idArray = new Array(selections.length)
142 | for (var i = 0; i < selections.length; i++) {
143 | idArray[i] = selections[i].id
144 | }
145 | ids = idArray.join(",")
146 |
147 | url = "/role/deleterole"
148 | var data = { ids: ids };
149 |
150 | var pid = $("input[name='searchRolepid']").val()
151 | $.post(url, data, function (result) {
152 | loadTree(pid)
153 | loaddatagrid(pid)
154 | selections.length = 0;
155 | if (result == "success") {
156 | $.messager.alert('操作提示', "删除成功", 'info');
157 | } else {
158 | $.messager.alert('操作提示', result, 'warning');
159 | }
160 | });
161 | }
--------------------------------------------------------------------------------
/src/controllers/roleController.go:
--------------------------------------------------------------------------------
1 | package controllers
2 |
3 | import (
4 | "cms/src/common"
5 | "cms/src/model"
6 | "cms/src/service"
7 |
8 | "github.com/astaxie/beego"
9 | "github.com/astaxie/beego/validation"
10 | )
11 |
12 | type RoleController struct {
13 | BaseController
14 | }
15 |
16 | /**
17 | 进入分页展示页面
18 | */
19 | func (this *RoleController) List() {
20 | this.show("role/roleList.html")
21 | }
22 |
23 | /**
24 | 获取分页展示数据
25 | */
26 | func (this *RoleController) Gridlist() {
27 | pageNum, _ := this.GetInt("page")
28 | rowsNum, _ := this.GetInt("rows")
29 | p := common.NewPager(pageNum, rowsNum)
30 | roleid, _ := this.GetInt("roleid")
31 |
32 | roleName := this.GetString("roleName")
33 | roleUrl := this.GetString("roleUrl")
34 |
35 | count, roles := service.RoleService.Gridlist(p, roleid, roleName, roleUrl)
36 | this.jsonResultPager(count, roles)
37 | }
38 |
39 | /**
40 | 加载权限树
41 | */
42 | func (this *RoleController) Listtree() {
43 | id, _ := this.GetInt64("id")
44 | roles := service.RoleService.Listtree(true)
45 | //展开一级目录和当前添加节点的父节点(权限菜单一般只会有两级所以这样可以让当前添加的节点及时的展示出来)
46 | for i, role := range roles {
47 | if role.Pid == 0 {
48 | roles[i].Open = true
49 | }
50 | if role.Id == id {
51 | roles[i].Open = true
52 | }
53 | }
54 | this.jsonResult(roles)
55 | }
56 |
57 | /**
58 | 进入添加权限页面
59 | */
60 | func (this *RoleController) Toadd() {
61 | this.show("role/addRole.html")
62 | }
63 |
64 | /**
65 | 进入添加权限目录页面
66 | */
67 | func (this *RoleController) Toadddir() {
68 | this.show("role/addRoleDir.html")
69 | }
70 |
71 | /**
72 | 添加权限
73 | */
74 | func (this *RoleController) Addrole() {
75 | pid, _ := this.GetInt64("pid")
76 | name := this.GetString("name")
77 | roleurl := this.GetString("roleurl")
78 | ismenu, _ := this.GetInt8("ismenu")
79 | describe := this.GetString("describe")
80 | module := this.GetString("module")
81 | action := this.GetString("action")
82 |
83 | //参数校验
84 | valid := validation.Validation{}
85 | valid.Required(name, "权限名称").Message("不能为空")
86 | valid.MaxSize(name, 20, "权限名称").Message("长度不能超过20个字符")
87 | valid.Required(describe, "描述信息").Message("不能为空")
88 | valid.MaxSize(describe, 50, "描述信息").Message("长度不能超过50个字符")
89 |
90 | if valid.HasErrors() {
91 | // 如果有错误信息,证明验证没通过
92 | // 打印错误信息
93 | for _, err := range valid.Errors {
94 | this.jsonResult((err.Key + err.Message))
95 | }
96 | }
97 |
98 | role := &model.Role{
99 | Pid: pid,
100 | Name: name,
101 | Roleurl: roleurl,
102 | Ismenu: ismenu,
103 | Des: describe,
104 | Module: module,
105 | Action: action}
106 | beego.Debug("add role:", role)
107 |
108 | if err := service.RoleService.AddRole(role); err != nil {
109 | this.jsonResult(err.Error())
110 | }
111 | this.jsonResult(SUCCESS)
112 | }
113 |
114 | /**
115 | 进入修改页面,根据ID查询权限对象
116 | */
117 | func (this *RoleController) Tomodify() {
118 | id, _ := this.GetInt64("roleid")
119 | role, err := service.RoleService.GetRoleById(id)
120 | if err != nil {
121 | this.jsonResult(err.Error())
122 | }
123 | //this.jsonResult(role)
124 | this.Data["role"] = role
125 | this.show("role/modifyRole.html")
126 | }
127 |
128 | /**
129 | 修改权限
130 | */
131 | func (this *RoleController) Modify() {
132 | id, _ := this.GetInt64("id")
133 | pid, _ := this.GetInt64("pid")
134 | name := this.GetString("name")
135 | roleurl := this.GetString("roleurl")
136 | ismenu, _ := this.GetInt8("ismenu")
137 | describe := this.GetString("describe")
138 | module := this.GetString("module")
139 | action := this.GetString("action")
140 |
141 | //参数校验
142 | valid := validation.Validation{}
143 | valid.Required(name, "权限名称").Message("不能为空")
144 | valid.MaxSize(name, 20, "权限名称").Message("长度不能超过20个字符")
145 | valid.Required(describe, "描述信息").Message("不能为空")
146 | valid.MaxSize(describe, 50, "描述信息").Message("长度不能超过50个字符")
147 |
148 | if valid.HasErrors() {
149 | // 如果有错误信息,证明验证没通过
150 | // 打印错误信息
151 | for _, err := range valid.Errors {
152 | this.jsonResult((err.Key + err.Message))
153 | }
154 | }
155 |
156 | role := &model.Role{
157 | Id: id,
158 | Pid: pid,
159 | Name: name,
160 | Roleurl: roleurl,
161 | Ismenu: ismenu,
162 | Des: describe,
163 | Module: module,
164 | Action: action}
165 | beego.Debug(role)
166 | if err := service.RoleService.ModifyRole(role); err != nil {
167 | this.jsonResult("修改失败!")
168 | }
169 | this.jsonResult(SUCCESS)
170 | }
171 |
172 | /**
173 | 删除权限
174 | */
175 | func (this *RoleController) Deleterole() {
176 | ids := this.GetStrings("ids")
177 |
178 | if err := service.RoleService.DeleteRole(ids); err != nil {
179 | this.jsonResult(err.Error())
180 | }
181 | this.jsonResult(SUCCESS)
182 | }
183 |
--------------------------------------------------------------------------------
/src/controllers/admuserGroupController.go:
--------------------------------------------------------------------------------
1 | package controllers
2 |
3 | import (
4 | "cms/src/common"
5 | "cms/src/model"
6 | "cms/src/service"
7 | "time"
8 |
9 | "github.com/astaxie/beego/validation"
10 | )
11 |
12 | type AdmUserGroupController struct {
13 | BaseController
14 | }
15 |
16 | /**
17 | 进入管理员组管理页面
18 | */
19 | func (this *AdmUserGroupController) List() {
20 | this.show("admusergroup/admUserGroupList.html")
21 | }
22 |
23 | /**
24 | 获取管理员组列表数据
25 | */
26 | func (this *AdmUserGroupController) Gridlist() {
27 | groupName := this.GetString("groupName")
28 | pageNum, _ := this.GetInt("page")
29 | rowsNum, _ := this.GetInt("rows")
30 | p := common.NewPager(pageNum, rowsNum)
31 |
32 | count, admuserGroup := service.AdmUserGroupService.Gridlist(groupName, p)
33 | this.jsonResultPager(count, admuserGroup)
34 | }
35 |
36 | /**
37 | 进入添加页面
38 | */
39 | func (this *AdmUserGroupController) Toadd() {
40 | this.show("admusergroup/addAdmusergroup.html")
41 | }
42 |
43 | /**
44 | 添加管理员组
45 | */
46 | func (this *AdmUserGroupController) Addadmusergroup() {
47 | ids := this.GetString("ids")
48 | groupname := this.GetString("groupname")
49 | describe := this.GetString("describe")
50 |
51 | //参数校验
52 | valid := validation.Validation{}
53 | valid.Required(groupname, "管理员组名称").Message("不能为空")
54 | valid.MaxSize(groupname, 20, "管理员组名称").Message("长度不能超过20个字符")
55 | valid.Required(describe, "描述信息").Message("不能为空")
56 | valid.MaxSize(describe, 50, "描述信息").Message("长度不能超过50个字符")
57 | valid.MinSize(ids, 1, "权限").Message("请至少选择一个")
58 |
59 | if valid.HasErrors() {
60 | // 如果有错误信息,证明验证没通过
61 | // 打印错误信息
62 | for _, err := range valid.Errors {
63 | this.jsonResult((err.Key + err.Message))
64 | }
65 | }
66 |
67 | admusergroup := &model.Admusergroup{
68 | Groupname: groupname,
69 | Des: describe,
70 | Createtime: time.Now(),
71 | Updatetime: time.Now(),
72 | Isdel: 1}
73 | if err := service.AdmUserGroupService.AddAdmUserGroup(admusergroup, ids); err != nil {
74 | this.jsonResult(err.Error())
75 | }
76 | this.jsonResult(SUCCESS)
77 | }
78 |
79 | /**
80 | 进入修改管理员组页面
81 | */
82 | func (this *AdmUserGroupController) Tomodify() {
83 | id, _ := this.GetInt64("admusergroupid")
84 | admusergroup := service.AdmUserGroupService.GetAdmUserGroupById(id)
85 | this.Data["admusergroup"] = admusergroup
86 | this.show("admusergroup/modifyAdmusergroup.html")
87 | }
88 |
89 | /**
90 | 修改管理员组
91 | */
92 | func (this *AdmUserGroupController) Modifyadmusergroup() {
93 | ids := this.GetString("ids")
94 | groupname := this.GetString("groupname")
95 | describe := this.GetString("describe")
96 | id, _ := this.GetInt64("id")
97 |
98 | //参数校验
99 | valid := validation.Validation{}
100 | valid.Required(groupname, "管理员组名称").Message("不能为空")
101 | valid.MaxSize(groupname, 20, "管理员组名称").Message("长度不能超过20个字符")
102 | valid.Required(describe, "描述信息").Message("不能为空")
103 | valid.MaxSize(describe, 50, "描述信息").Message("长度不能超过50个字符")
104 | valid.MinSize(ids, 1, "权限").Message("请至少选择一个")
105 |
106 | if valid.HasErrors() {
107 | // 如果有错误信息,证明验证没通过
108 | // 打印错误信息
109 | for _, err := range valid.Errors {
110 | this.jsonResult((err.Key + err.Message))
111 | }
112 | }
113 |
114 | admusergroup := &model.Admusergroup{
115 | Id: id,
116 | Groupname: groupname,
117 | Des: describe,
118 | Createtime: time.Now(),
119 | Updatetime: time.Now(),
120 | Isdel: 1}
121 | if err := service.AdmUserGroupService.Modifyadmusergroup(admusergroup, ids); err != nil {
122 | this.jsonResult(err.Error())
123 | }
124 | this.jsonResult(SUCCESS)
125 | }
126 |
127 | /**
128 | 删除管理员组
129 | */
130 | func (this *AdmUserGroupController) Delete() {
131 | ids := this.GetString("ids")
132 | if err := service.AdmUserGroupService.Delete(ids); err != nil {
133 | this.jsonResult(err.Error())
134 | }
135 | this.jsonResult(SUCCESS)
136 | }
137 |
138 | /**
139 | 加载权限树(用于添加管理员组的时候选择权限)
140 | */
141 | func (this *AdmUserGroupController) Loadtreewithoutroot() {
142 | //查询树结构不加载root节点
143 | roles := service.RoleService.Listtree(false)
144 | //展开一级目录
145 | for i, role := range roles {
146 | if role.Pid == 0 {
147 | roles[i].Open = true
148 | }
149 | }
150 | this.jsonResult(roles)
151 | }
152 |
153 | /**
154 | 加载权限树(用于修改管理员组的时候选择权限-添加时选择的权限在修改的时候需要选中)
155 | */
156 | func (this *AdmUserGroupController) Loadtreechecked() {
157 | admgroupuserid, _ := this.GetInt64("admgroupuserid")
158 | roleIdMap := service.AdmUserGroupService.GetAllRoleByGroupId(admgroupuserid)
159 | //查询树结构不加载root节点
160 | roles := service.RoleService.Listtree(false)
161 | if roleIdMap == nil {
162 | //展开一级目录
163 | for i, role := range roles {
164 | if role.Pid == 0 {
165 | roles[i].Open = true
166 | }
167 | }
168 | } else {
169 | for i, role := range roles {
170 | if role.Pid == 0 {
171 | roles[i].Open = true
172 | }
173 | if _, ok := roleIdMap[role.Id]; ok {
174 | roles[i].Checked = true
175 | }
176 | }
177 | }
178 | this.jsonResult(roles)
179 | }
180 |
--------------------------------------------------------------------------------
/src/controllers/baseController.go:
--------------------------------------------------------------------------------
1 | package controllers
2 |
3 | import (
4 | "cms/src/common"
5 | "cms/src/model"
6 | "cms/src/service"
7 | "fmt"
8 | "strconv"
9 | "strings"
10 |
11 | "github.com/astaxie/beego"
12 | )
13 |
14 | const (
15 | SUCCESS = "success"
16 | )
17 |
18 | type BaseController struct {
19 | beego.Controller
20 | admUser *model.Admuser // 当前登录的用户id
21 | controllerName string // 控制器名
22 | actionName string // 动作名
23 | openPerm map[string]bool // 公开的权限
24 | }
25 |
26 | /*
27 | 登陆鉴权等操作,
28 | 测试开发的时候可以注释这个方法,方便测试
29 | */
30 | func (this *BaseController) Prepare() {
31 | this.Ctx.Output.Header("Author", "CrazyWolf")
32 | this.Ctx.Output.Header("Access-Control-Allow-Origin", "")
33 |
34 | //获取请求方法名称
35 | controllerName, actionName := this.GetControllerAndAction()
36 | this.controllerName = controllerName
37 | this.actionName = actionName
38 |
39 | //判断是否是不需要鉴权的公共操作
40 | if this.isOpenPerm() {
41 | return
42 | }
43 |
44 | //登录校验
45 | token := this.Ctx.GetCookie("token")
46 | if admUser := validateToken(token, this.getClientIp()); admUser == nil {
47 | this.redirect(beego.URLFor("LoginController.Tologin"))
48 | } else {
49 | this.admUser = admUser
50 | }
51 |
52 | // //TODO 暂时判断如果是admin账号登陆就不执行任何权限校验,后续改为在某个组的用户都不做校验
53 | // if strings.EqualFold(service.RoleService.IsAdministrator(this.admUser.Id)) {
54 | // return
55 | // }
56 |
57 | if strings.EqualFold(controllerName, "MainController") {
58 | return
59 | }
60 |
61 | //操作权限校验
62 | if ok, err := this.validateRole(); !ok {
63 | if this.IsAjax() {
64 | this.jsonResult(err.Error())
65 | } else {
66 | this.redirect(beego.URLFor("MainController.Norole"))
67 | }
68 | }
69 |
70 | }
71 |
72 | /**
73 | 初始化开放权限(不需要权限校验的操作,后续如果有不需要权限校验的操作都可以写在这里)
74 | */
75 | func (this *BaseController) initOpenPerm() {
76 | this.openPerm = map[string]bool{
77 | "MainController.LeftMenu": true,
78 | "MainController.Norole": true,
79 | }
80 | }
81 |
82 | /**
83 | 判断是否是不需要鉴权的公共操作
84 | */
85 | func (this *BaseController) isOpenPerm() bool {
86 | //如果是登陆相关操作则不进行登陆鉴权和权限鉴权等操作
87 | if strings.EqualFold(this.controllerName, "logincontroller") {
88 | return true
89 | }
90 | this.initOpenPerm()
91 | key := this.controllerName + "." + this.actionName
92 | if this.openPerm[key] {
93 | return true
94 | }
95 | return false
96 | }
97 |
98 | /**
99 | token 校验,判断是否登录
100 | */
101 | func validateToken(token, currentIp string) *model.Admuser {
102 |
103 | Dtoken, err := common.DecryptAes(token)
104 | if err != nil {
105 | beego.Debug("token 解密失败")
106 | return nil
107 | }
108 | array := strings.Split(Dtoken, "|")
109 | if len(array) != 3 {
110 | beego.Debug("token 校验失败")
111 | return nil
112 | }
113 | userid := array[0]
114 | ip := array[2]
115 | if !strings.EqualFold(ip, currentIp) {
116 | //IP发生变化 强制重新登录
117 | beego.Debug("ip chenged")
118 | return nil
119 | }
120 | intid, _ := strconv.ParseInt(userid, 10, 64)
121 | admuser, err := service.AdmUserService.GetUserById(intid)
122 | if err != nil || admuser.Id < 0 {
123 | beego.Debug("ID error")
124 | return nil
125 | }
126 | return admuser
127 | }
128 |
129 | /**
130 | 校验权限
131 | */
132 | func (this *BaseController) validateRole() (bool, error) {
133 | if err := service.RoleService.ValidateRole(this.controllerName, this.actionName, this.admUser.Id); err != nil {
134 | return false, err
135 | }
136 | return true, nil
137 | }
138 |
139 | /**
140 | 重定向
141 | */
142 | func (this *BaseController) redirect(url string) {
143 | this.Redirect(url, 302)
144 | this.StopRun()
145 | }
146 |
147 | /*
148 | 指定页面,并且返回公共参数
149 | */
150 | func (this *BaseController) show(url string) {
151 | this.Data["staticUrl"] = beego.AppConfig.String("staticUrl")
152 | this.TplName = url
153 | }
154 |
155 | /**
156 | 把需要返回的结构序列化成json 输出
157 | */
158 | func (this *BaseController) jsonResult(result interface{}) {
159 | this.Data["json"] = result
160 | this.ServeJSON()
161 | this.StopRun()
162 | }
163 |
164 | /**
165 | 获取IP
166 | */
167 | func (this *BaseController) getClientIp() string {
168 | ip := this.Ctx.Request.Header.Get("Remote_addr")
169 | if ip == "" {
170 | ip = this.Ctx.Request.RemoteAddr
171 | }
172 | fmt.Println(ip)
173 | if strings.Contains(ip, ":") {
174 | ip = common.Substr(ip, 0, strings.Index(ip, ":"))
175 | }
176 | fmt.Println(ip)
177 | return ip
178 | }
179 |
180 | type Empty struct {
181 | }
182 |
183 | /*
184 | 用于分页展示列表的时候的 输出json
185 | */
186 | func (this *BaseController) jsonResultPager(count int, roles interface{}) {
187 | beego.Debug("分页数据:", count, roles)
188 | resultMap := make(map[string]interface{}, 1)
189 | if count == 0 || roles == nil {
190 | beego.Debug("查询分页数据为空,返回默认json")
191 | //这里默认totle设置为1是因为easyui分页控件如果totle 为0会出现错乱
192 | resultMap["total"] = 1
193 | resultMap["rows"] = make([]Empty, 0)
194 | } else {
195 | resultMap["total"] = count
196 | resultMap["rows"] = roles
197 | }
198 | this.Data["json"] = resultMap
199 | this.ServeJSON()
200 | this.StopRun()
201 | }
202 |
--------------------------------------------------------------------------------
/src/service/admuserGroupService.go:
--------------------------------------------------------------------------------
1 | package service
2 |
3 | import (
4 | "cms/src/common"
5 | "cms/src/model"
6 | "strconv"
7 | "strings"
8 |
9 | "github.com/astaxie/beego"
10 | "github.com/astaxie/beego/orm"
11 | )
12 |
13 | type admUserGroupService struct{}
14 |
15 | /**
16 | 查询管理员组分页列表
17 | */
18 | func (this *admUserGroupService) Gridlist(groupName string, pager *common.Pager) (count int, admUserGroup []model.Admusergroup) {
19 | coutsql := "select count(1) from t_admusergroup t "
20 | condition := genAdmUserGroupCondition(groupName)
21 | if err := o.Raw(coutsql + condition).QueryRow(&count); err != nil || count < 1 {
22 | //如果查询出错或者查询结果为空返回默认空值
23 | return
24 | }
25 |
26 | listsql := "SELECT id,groupname,des,createtime,updatetime,isdel from t_admusergroup t "
27 | if num, err := o.Raw(listsql+condition+common.LIMIT, pager.GetBegin(), pager.GetLen()).QueryRows(&admUserGroup); err != nil || num < 1 {
28 | //如果查询出错返回默认空值
29 | return
30 | }
31 | return
32 | }
33 |
34 | func genAdmUserGroupCondition(groupName string) (condition string) {
35 | condition = " where t.isdel = 1 "
36 | if groupName != "" {
37 | condition += " and t.groupname = " + groupName
38 | }
39 | return
40 | }
41 |
42 | /**
43 | 添加管理员组
44 | */
45 | func (this *admUserGroupService) AddAdmUserGroup(admusergroup *model.Admusergroup, ids string) error {
46 | id, err := o.Insert(admusergroup)
47 | if err != nil || id < 1 {
48 | return &common.BizError{"添加失败"}
49 | }
50 | flag := false
51 | idArray := strings.Split(ids, ",")
52 | for _, roleId := range idArray {
53 | beego.Debug("给ID为", id, "的管理员组添加", roleId, "权限")
54 | roleIdInt, err := strconv.ParseInt(roleId, 10, 64)
55 | if err != nil {
56 | beego.Warn(roleId, "不是数字")
57 | flag = true
58 | continue
59 | }
60 | groupRoleRel := &model.GroupRoleRel{
61 | Groupid: id,
62 | Roleid: roleIdInt,
63 | Isdel: 1}
64 | if _, err := o.Insert(groupRoleRel); err != nil {
65 | beego.Warn("给ID为", id, "的管理员组添加", groupRoleRel.Roleid, "权限失败")
66 | flag = true
67 | continue
68 | }
69 | }
70 | if flag {
71 | return &common.BizError{"出现异常,部分权限添加失败,请补充添加权限。"}
72 | }
73 | return nil
74 | }
75 |
76 | /**
77 | 修改管理员组
78 | */
79 | func (this *admUserGroupService) Modifyadmusergroup(admusergroup *model.Admusergroup, ids string) error {
80 | //修改基础信息
81 | if _, err := o.Update(admusergroup); err != nil {
82 | beego.Warn("update admusergroup db error.", err.Error())
83 | return &common.BizError{"修改失败"}
84 | }
85 |
86 | id := admusergroup.Id
87 | //删除当前组关联的所有权限
88 | delsql := "update t_group_role_rel t set t.isdel = 0 where t.groupid = ? and t.isdel =1"
89 | if _, err := o.Raw(delsql, id).Exec(); err != nil {
90 | beego.Warn("del group's role fail.", err.Error())
91 | return &common.BizError{"修改失败"}
92 | }
93 |
94 | //重新添加权限
95 | flag := false
96 | idArray := strings.Split(ids, ",")
97 | for _, roleId := range idArray {
98 | beego.Debug("给ID为", id, "的管理员组添加", roleId, "权限")
99 | roleIdInt, err := strconv.ParseInt(roleId, 10, 64)
100 | if err != nil {
101 | beego.Warn(roleId, "不是数字")
102 | flag = true
103 | continue
104 | }
105 | groupRoleRel := &model.GroupRoleRel{
106 | Groupid: id,
107 | Roleid: roleIdInt,
108 | Isdel: 1}
109 | if _, err := o.Insert(groupRoleRel); err != nil {
110 | beego.Warn("给ID为", id, "的管理员组添加", groupRoleRel.Roleid, "权限失败", err.Error())
111 | flag = true
112 | continue
113 | }
114 | }
115 | if flag {
116 | return &common.BizError{"出现异常,部分权限添加失败,请补充添加权限。"}
117 | }
118 | return nil
119 | }
120 |
121 | /**
122 | 删除管理员组
123 | */
124 | func (this *admUserGroupService) Delete(ids string) error {
125 | delsql := "update t_admusergroup t set t.isdel = 0 where t.id in (" + ids + ")"
126 | if _, err := o.Raw(delsql).Exec(); err != nil {
127 | beego.Warn("delete fail id:", ids, err.Error())
128 | return &common.BizError{"删除失败"}
129 | }
130 |
131 | //删除当前组关联的所有权限
132 | delrolesql := "update t_group_role_rel t set t.isdel = 0 where t.groupid in (" + ids + ") and t.isdel =1"
133 | if _, err := o.Raw(delrolesql).Exec(); err != nil {
134 | beego.Warn("del group's role fail.", err.Error())
135 | return &common.BizError{"删除失败"}
136 | }
137 | return nil
138 | }
139 |
140 | /**
141 | 根据ID获取管理员组信息
142 | */
143 | func (this *admUserGroupService) GetAdmUserGroupById(id int64) model.Admusergroup {
144 | admusergroup := model.Admusergroup{Id: id}
145 | if err := o.Read(&admusergroup); err != nil {
146 | return model.Admusergroup{}
147 | }
148 | return admusergroup
149 | }
150 |
151 | /**
152 | 根据管理员组ID获取所有的权限列表
153 | */
154 | func (this *admUserGroupService) GetAllRoleByGroupId(id int64) map[int64]bool {
155 | var list orm.ParamsList
156 | num, err := o.Raw("SELECT roleid from t_group_role_rel t where t.groupid = ? and t.isdel =1", id).ValuesFlat(&list)
157 | if err != nil || num < 1 {
158 | return nil
159 | }
160 | roleIdMap := make(map[int64]bool, len(list))
161 | for i := 0; i < len(list); i++ {
162 | idStr := list[i].(string)
163 | id, _ := strconv.ParseInt(idStr, 10, 64)
164 | roleIdMap[id] = true
165 | }
166 | return roleIdMap
167 | }
168 |
--------------------------------------------------------------------------------
/src/service/roleService.go:
--------------------------------------------------------------------------------
1 | package service
2 |
3 | import (
4 | "bytes"
5 | "cms/src/common"
6 | "cms/src/model"
7 | "strconv"
8 | "strings"
9 |
10 | "github.com/astaxie/beego"
11 | "github.com/astaxie/beego/orm"
12 | )
13 |
14 | type roleService struct{}
15 |
16 | /**
17 | 添加权限
18 | */
19 | func (this *roleService) AddRole(role *model.Role) error {
20 | if _, err := o.Insert(role); err != nil {
21 | return &common.BizError{"添加失败"}
22 | }
23 | return nil
24 | }
25 |
26 | /**
27 | 查询列表的分页数据
28 | */
29 | func (this *roleService) Gridlist(pager *common.Pager, roleid int, roleName, roleUrl string) (int, []model.Role) {
30 | //查询总数
31 | contsql := "SELECT count(1) from t_role t where t.pid = ?"
32 | condition := genCondition(roleName, roleUrl)
33 | var count int
34 | err := o.Raw(contsql+condition, roleid).QueryRow(&count)
35 | if err != nil {
36 | beego.Error("查询Pid为", roleid, "的role总数异常,error message:", err.Error())
37 | }
38 | beego.Debug("pid 为", roleid, "的role有", count, "个")
39 |
40 | if count < 1 {
41 | beego.Info("没有pid 为", roleid, "的role")
42 | return 0, nil
43 | }
44 |
45 | // 从数据库查询数据
46 | var roles []model.Role
47 | listsql := "SELECT id, pid, name, roleurl, module, action, ismenu, des from t_role t where t.pid = ? "
48 | _, err = o.Raw(listsql+condition+common.LIMIT, roleid, pager.GetBegin(), pager.GetLen()).QueryRows(&roles)
49 | if err != nil {
50 | beego.Error("查询Pid为", roleid, "的role列表异常,error message:", err.Error())
51 | }
52 |
53 | return count, roles
54 | }
55 |
56 | func genCondition(roleName, roleUrl string) (condition string) {
57 | if !strings.EqualFold(roleName, "") {
58 | condition += " and t.name = '" + roleName + "'"
59 | }
60 | if !strings.EqualFold(roleUrl, "") {
61 | condition += " and t.roleurl = '" + roleUrl + "'"
62 | }
63 | return
64 | }
65 |
66 | /**
67 | 查询树
68 | @param needRoot:查询的数据集中是否需要包含root节点
69 | */
70 | func (this *roleService) Listtree(needRoot bool) []model.RoleTree {
71 | var buf bytes.Buffer
72 | buf.WriteString("SELECT id, pid, name, roleurl, ismenu, des from t_role t ")
73 | if !needRoot {
74 | buf.WriteString(" where t.id != 0")
75 | }
76 | var roles []model.RoleTree
77 | beego.Debug("查询权限树sql:", buf.String())
78 | _, err := o.Raw(buf.String()).QueryRows(&roles)
79 | if err != nil {
80 | beego.Error("查询权限树的role列表异常,error message:", err.Error())
81 | }
82 | beego.Debug("生成权限树的数据:", roles)
83 | return roles
84 | }
85 |
86 | /**
87 | 根据ID查询role
88 | */
89 | func (this *roleService) GetRoleById(id int64) (model.Role, error) {
90 | role := model.Role{Id: id}
91 | if err := o.Read(&role); err != nil {
92 | return model.Role{}, err
93 | }
94 | return role, nil
95 | }
96 |
97 | /**
98 | 修改权限
99 | */
100 | func (this *roleService) ModifyRole(r *model.Role) error {
101 | role := model.Role{Id: r.Id}
102 | //根据ID读取
103 | if err := o.Read(&role); err != nil {
104 | return err
105 | }
106 | //修改
107 | if num, err := o.Update(r); num <= 0 && err != nil {
108 | return err
109 | }
110 | return nil
111 | }
112 |
113 | /**
114 | 删除权限
115 | */
116 | func (this *roleService) DeleteRole(ids []string) error {
117 | idstr := strings.Join(ids, ",")
118 |
119 | var count int
120 | countSubRoleSql := "select count(1) from t_role where pid in (" + idstr + ")"
121 | o.Raw(countSubRoleSql).QueryRow(&count)
122 | if count > 0 {
123 | return &common.BizError{"不能删除有子节点的权限,请先删除所有子节点!"}
124 | }
125 |
126 | sql := "DELETE from t_role where id in (" + idstr + ")"
127 | if _, err := o.Raw(sql).Exec(); err != nil {
128 | return &common.BizError{"删除失败!"}
129 | }
130 | return nil
131 | }
132 |
133 | /**
134 | 权限校验
135 | */
136 | func (this *roleService) ValidateRole(controllerName, actionName string, id int64) error {
137 | if this.isAdministrator(id) {
138 | beego.Debug("用户属于超级管理员,不用校验权限")
139 | return nil
140 | }
141 | selectSql := "SELECT COUNT(1) FROM t_user_group_rel ur,t_role r ,t_group_role_rel gr where r.module = ? and r.action = ? and ur.userid = ? and ur.groupid = gr.groupid and r.id = gr.roleid and ur.isdel = 1 and gr.isdel = 1"
142 | var count int
143 | o.Raw(selectSql, controllerName, actionName, id).QueryRow(&count)
144 | if count > 0 {
145 | return nil
146 | }
147 | return &common.BizError{"您没有权限执行此操作,请联系系统管理员。"}
148 | }
149 |
150 | /**
151 | 加载权限树
152 | */
153 | func (this *roleService) LoadMenu(id int64) []model.RoleTree {
154 |
155 | var roles []model.RoleTree
156 | if this.isAdministrator(id) {
157 | selectSql := "SELECT t.id, pid, name, roleurl , ismenu, des from t_role t where t.id != 0 and t.ismenu = 0"
158 | if _, err := o.Raw(selectSql).QueryRows(&roles); err != nil {
159 | beego.Error("查询权限树的role列表异常,error message:", err.Error())
160 | return roles
161 | }
162 | } else {
163 | selectSql := "SELECT DISTINCT t.id, pid, name, roleurl , ismenu, des from t_role t,t_user_group_rel ug,t_group_role_rel gr where t.id != 0 and t.ismenu = 0 and t.id = gr.roleid and ug.userid=? and ug.groupid = gr.groupid and ug.isdel=1 and gr.isdel =1"
164 | if _, err := o.Raw(selectSql, id).QueryRows(&roles); err != nil {
165 | beego.Error("查询权限树的role列表异常,error message:", err.Error())
166 | return roles
167 | }
168 | }
169 |
170 | pidMap := make(map[int64]bool, 10)
171 | for _, role := range roles {
172 | pidMap[role.Pid] = true
173 | }
174 |
175 | for i, role := range roles {
176 | //展开所有父节点
177 | if pidMap[role.Id] {
178 | roles[i].Open = true
179 | continue
180 | }
181 | if !strings.EqualFold(role.Roleurl, "") {
182 | click := "click: addTab('" + roles[i].Name + "','" + roles[i].Roleurl + "')"
183 | roles[i].Click = click
184 | }
185 | }
186 |
187 | return roles
188 | }
189 |
190 | /*
191 | 判断当前用户是否属于 超级管理员
192 | */
193 | func (this *roleService) isAdministrator(id int64) bool {
194 |
195 | flag := false
196 | var list orm.ParamsList
197 | num, err := o.Raw("SELECT groupid from t_user_group_rel t where t.userid = ? and t.isdel =1", id).ValuesFlat(&list)
198 | if err != nil || num < 1 {
199 | return flag
200 | }
201 | for i := 0; i < len(list); i++ {
202 | groupId := list[i].(string)
203 | if id, err := strconv.ParseInt(groupId, 10, 64); err == nil {
204 | if id == 1 {
205 | return true
206 | }
207 | }
208 | }
209 | return flag
210 | }
211 |
--------------------------------------------------------------------------------
/static/css/zTreeStyle/zTreeStyle.css:
--------------------------------------------------------------------------------
1 | /*-------------------------------------
2 | zTree Style
3 |
4 | version: 3.5.19
5 | author: Hunter.z
6 | email: hunter.z@263.net
7 | website: http://code.google.com/p/jquerytree/
8 |
9 | -------------------------------------*/
10 |
11 | .ztree * {padding:0; margin:0; font-size:12px; font-family: Verdana, Arial, Helvetica, AppleGothic, sans-serif}
12 | .ztree {margin:0; padding:5px; color:#333}
13 | .ztree li{padding:0; margin:0; list-style:none; line-height:14px; text-align:left; white-space:nowrap; outline:0}
14 | .ztree li ul{ margin:0; padding:0 0 0 18px}
15 | .ztree li ul.line{ background:url(./img/line_conn.gif) 0 0 repeat-y;}
16 |
17 | .ztree li a {padding:1px 3px 0 0; margin:0; cursor:pointer; height:17px; color:#333; background-color: transparent;
18 | text-decoration:none; vertical-align:top; display: inline-block}
19 | .ztree li a:hover {text-decoration:underline}
20 | .ztree li a.curSelectedNode {padding-top:0px; background-color:#FFE6B0; color:black; height:16px; border:1px #FFB951 solid; opacity:0.8;}
21 | .ztree li a.curSelectedNode_Edit {padding-top:0px; background-color:#FFE6B0; color:black; height:16px; border:1px #FFB951 solid; opacity:0.8;}
22 | .ztree li a.tmpTargetNode_inner {padding-top:0px; background-color:#316AC5; color:white; height:16px; border:1px #316AC5 solid;
23 | opacity:0.8; filter:alpha(opacity=80)}
24 | .ztree li a.tmpTargetNode_prev {}
25 | .ztree li a.tmpTargetNode_next {}
26 | .ztree li a input.rename {height:14px; width:80px; padding:0; margin:0;
27 | font-size:12px; border:1px #7EC4CC solid; *border:0px}
28 | .ztree li span {line-height:16px; margin-right:2px}
29 | .ztree li span.button {line-height:0; margin:0; width:16px; height:16px; display: inline-block; vertical-align:middle;
30 | border:0 none; cursor: pointer;outline:none;
31 | background-color:transparent; background-repeat:no-repeat; background-attachment: scroll;
32 | background-image:url("./img/zTreeStandard.png"); *background-image:url("./img/zTreeStandard.gif")}
33 |
34 | .ztree li span.button.chk {width:13px; height:13px; margin:0 3px 0 0; cursor: auto}
35 | .ztree li span.button.chk.checkbox_false_full {background-position:0 0}
36 | .ztree li span.button.chk.checkbox_false_full_focus {background-position:0 -14px}
37 | .ztree li span.button.chk.checkbox_false_part {background-position:0 -28px}
38 | .ztree li span.button.chk.checkbox_false_part_focus {background-position:0 -42px}
39 | .ztree li span.button.chk.checkbox_false_disable {background-position:0 -56px}
40 | .ztree li span.button.chk.checkbox_true_full {background-position:-14px 0}
41 | .ztree li span.button.chk.checkbox_true_full_focus {background-position:-14px -14px}
42 | .ztree li span.button.chk.checkbox_true_part {background-position:-14px -28px}
43 | .ztree li span.button.chk.checkbox_true_part_focus {background-position:-14px -42px}
44 | .ztree li span.button.chk.checkbox_true_disable {background-position:-14px -56px}
45 | .ztree li span.button.chk.radio_false_full {background-position:-28px 0}
46 | .ztree li span.button.chk.radio_false_full_focus {background-position:-28px -14px}
47 | .ztree li span.button.chk.radio_false_part {background-position:-28px -28px}
48 | .ztree li span.button.chk.radio_false_part_focus {background-position:-28px -42px}
49 | .ztree li span.button.chk.radio_false_disable {background-position:-28px -56px}
50 | .ztree li span.button.chk.radio_true_full {background-position:-42px 0}
51 | .ztree li span.button.chk.radio_true_full_focus {background-position:-42px -14px}
52 | .ztree li span.button.chk.radio_true_part {background-position:-42px -28px}
53 | .ztree li span.button.chk.radio_true_part_focus {background-position:-42px -42px}
54 | .ztree li span.button.chk.radio_true_disable {background-position:-42px -56px}
55 |
56 | .ztree li span.button.switch {width:18px; height:18px}
57 | .ztree li span.button.root_open{background-position:-92px -54px}
58 | .ztree li span.button.root_close{background-position:-74px -54px}
59 | .ztree li span.button.roots_open{background-position:-92px 0}
60 | .ztree li span.button.roots_close{background-position:-74px 0}
61 | .ztree li span.button.center_open{background-position:-92px -18px}
62 | .ztree li span.button.center_close{background-position:-74px -18px}
63 | .ztree li span.button.bottom_open{background-position:-92px -36px}
64 | .ztree li span.button.bottom_close{background-position:-74px -36px}
65 | .ztree li span.button.noline_open{background-position:-92px -72px}
66 | .ztree li span.button.noline_close{background-position:-74px -72px}
67 | .ztree li span.button.root_docu{ background:none;}
68 | .ztree li span.button.roots_docu{background-position:-56px 0}
69 | .ztree li span.button.center_docu{background-position:-56px -18px}
70 | .ztree li span.button.bottom_docu{background-position:-56px -36px}
71 | .ztree li span.button.noline_docu{ background:none;}
72 |
73 | .ztree li span.button.ico_open{margin-right:2px; background-position:-110px -16px; vertical-align:top; *vertical-align:middle}
74 | .ztree li span.button.ico_close{margin-right:2px; background-position:-110px 0; vertical-align:top; *vertical-align:middle}
75 | .ztree li span.button.ico_docu{margin-right:2px; background-position:-110px -32px; vertical-align:top; *vertical-align:middle}
76 | .ztree li span.button.edit {margin-right:2px; background-position:-110px -48px; vertical-align:top; *vertical-align:middle}
77 | .ztree li span.button.remove {margin-right:2px; background-position:-110px -64px; vertical-align:top; *vertical-align:middle}
78 |
79 | .ztree li span.button.ico_loading{margin-right:2px; background:url(./img/loading.gif) no-repeat scroll 0 0 transparent; vertical-align:top; *vertical-align:middle}
80 |
81 | ul.tmpTargetzTree {background-color:#FFE6B0; opacity:0.8; filter:alpha(opacity=80)}
82 |
83 | span.tmpzTreeMove_arrow {width:16px; height:16px; display: inline-block; padding:0; margin:2px 0 0 1px; border:0 none; position:absolute;
84 | background-color:transparent; background-repeat:no-repeat; background-attachment: scroll;
85 | background-position:-110px -80px; background-image:url("./img/zTreeStandard.png"); *background-image:url("./img/zTreeStandard.gif")}
86 |
87 | ul.ztree.zTreeDragUL {margin:0; padding:0; position:absolute; width:auto; height:auto;overflow:hidden; background-color:#cfcfcf; border:1px #00B83F dotted; opacity:0.8; filter:alpha(opacity=80)}
88 | .zTreeMask {z-index:10000; background-color:#cfcfcf; opacity:0.0; filter:alpha(opacity=0); position:absolute}
89 |
90 | /* level style*/
91 | /*.ztree li span.button.level0 {
92 | display:none;
93 | }
94 | .ztree li ul.level0 {
95 | padding:0;
96 | background:none;
97 | }*/
--------------------------------------------------------------------------------
/src/controllers/admuserController.go:
--------------------------------------------------------------------------------
1 | package controllers
2 |
3 | import (
4 | "cms/src/common"
5 | "cms/src/model"
6 | "cms/src/service"
7 | "time"
8 |
9 | "github.com/astaxie/beego/validation"
10 | )
11 |
12 | type AdmUserController struct {
13 | BaseController
14 | }
15 |
16 | /**
17 | 进入管理员列表页面
18 | */
19 | func (this *AdmUserController) List() {
20 | this.show("admUser/admUserList.html")
21 | }
22 |
23 | /**
24 | 获取分页展示数据
25 | */
26 | func (this *AdmUserController) Gridlist() {
27 | pageNum, _ := this.GetInt("page")
28 | rowsNum, _ := this.GetInt("rows")
29 | admusermail := this.GetString("admusermail")
30 | admuserphone := this.GetString("admuserphone")
31 | admusername := this.GetString("admusername")
32 | admuserid := this.GetString("admuserid")
33 | account := this.GetString("admaccout")
34 | p := common.NewPager(pageNum, rowsNum)
35 | count, admuser := service.AdmUserService.Gridlist(p, admuserid, admusermail, admusername, admuserphone, account)
36 | this.jsonResultPager(count, admuser)
37 | }
38 |
39 | /**
40 | 进入添加页面
41 | */
42 | func (this *AdmUserController) Toaddadmuser() {
43 | this.show("admUser/addAdmUser.html")
44 | }
45 |
46 | /**
47 | 添加管理员
48 | */
49 | func (this *AdmUserController) Addadmuser() {
50 | account := this.GetString("account")
51 | mail := this.GetString("mail")
52 | name := this.GetString("name")
53 | phone := this.GetString("phone")
54 | department := this.GetString("department")
55 | password := this.GetString("password")
56 | groupIds := this.GetString("ids")
57 |
58 | //参数校验
59 | valid := validation.Validation{}
60 | valid.Required(account, "账号").Message("不能为空")
61 | valid.MaxSize(account, 20, "账号").Message("长度不能超过20个字符")
62 | valid.Required(mail, "邮箱").Message("不能为空")
63 | valid.MaxSize(mail, 50, "邮箱").Message("长度不能超过50个字符")
64 | valid.Email(mail, "邮箱").Message("格式错误")
65 | valid.Required(name, "姓名").Message("不能为空")
66 | valid.MaxSize(name, 20, "姓名").Message("长度不能超过20个字符")
67 | valid.Required(phone, "手机号码").Message("不能为空")
68 | valid.MaxSize(phone, 15, "手机号码").Message("长度不能超过15个字符")
69 | valid.Required(department, "部门").Message("不能为空")
70 | valid.MaxSize(department, 20, "部门").Message("长度不能超过20个字符")
71 | valid.Required(password, "密码").Message("不能为空")
72 | valid.MaxSize(password, 20, "密码").Message("长度不能超过20个字符")
73 | valid.MinSize(groupIds, 1, "组信息").Message("请至少选择一个")
74 |
75 | if valid.HasErrors() {
76 | // 如果有错误信息,证明验证没通过
77 | // 打印错误信息
78 | for _, err := range valid.Errors {
79 | this.jsonResult((err.Key + err.Message))
80 | }
81 | }
82 |
83 | password = common.EncodeMessageMd5(password)
84 |
85 | admuser := &model.Admuser{
86 | Accout: account,
87 | Name: name,
88 | Mail: mail,
89 | Phone: phone,
90 | Department: department,
91 | Password: password,
92 | Createtime: time.Now(),
93 | Updatetime: time.Now(),
94 | Isdel: 1}
95 | if err := service.AdmUserService.AddAdmUser(admuser, groupIds); err != nil {
96 | this.jsonResult(err.Error())
97 | }
98 | this.jsonResult(SUCCESS)
99 | }
100 |
101 | /**
102 | 进入修改页面
103 | */
104 | func (this *AdmUserController) Tomodifyadmuser() {
105 | admUserId, _ := this.GetInt64("admUserId")
106 | admUser, _ := service.AdmUserService.GetUserById(admUserId)
107 | this.Data["admuser"] = admUser
108 | this.show("admUser/modifyAdmUser.html")
109 | }
110 |
111 | /**
112 | 修改管理员
113 | */
114 | func (this *AdmUserController) Modifyyadmuser() {
115 | userId, _ := this.GetInt64("userId")
116 | account := this.GetString("account")
117 | mail := this.GetString("mail")
118 | name := this.GetString("name")
119 | phone := this.GetString("phone")
120 | department := this.GetString("department")
121 | password := this.GetString("password")
122 | groupIds := this.GetString("groupids")
123 |
124 | //参数校验
125 | valid := validation.Validation{}
126 | valid.Required(account, "账号").Message("不能为空")
127 | valid.MaxSize(account, 20, "账号").Message("长度不能超过20个字符")
128 | valid.Required(mail, "邮箱").Message("不能为空")
129 | valid.MaxSize(mail, 50, "邮箱").Message("长度不能超过50个字符")
130 | valid.Email(mail, "邮箱").Message("格式错误")
131 | valid.Required(name, "姓名").Message("不能为空")
132 | valid.MaxSize(name, 20, "姓名").Message("长度不能超过20个字符")
133 | valid.Required(phone, "手机号码").Message("不能为空")
134 | valid.MaxSize(phone, 15, "手机号码").Message("长度不能超过15个字符")
135 | valid.Required(department, "部门").Message("不能为空")
136 | valid.MaxSize(department, 20, "部门").Message("长度不能超过20个字符")
137 |
138 | if len(password) > 0 {
139 | valid.Required(password, "密码").Message("不能为空")
140 | valid.MaxSize(password, 20, "密码").Message("长度不能超过20个字符")
141 | }
142 |
143 | valid.MinSize(groupIds, 1, "组信息").Message("请至少选择一个")
144 |
145 | if valid.HasErrors() {
146 | // 如果有错误信息,证明验证没通过
147 | // 打印错误信息
148 | for _, err := range valid.Errors {
149 | this.jsonResult((err.Key + err.Message))
150 | }
151 | }
152 |
153 | if len(password) != 0 {
154 | password = common.EncodeMessageMd5(password)
155 | }
156 |
157 | admuser := &model.Admuser{
158 | Id: userId,
159 | Accout: account,
160 | Name: name,
161 | Mail: mail,
162 | Phone: phone,
163 | Department: department,
164 | Password: password,
165 | Createtime: time.Now(),
166 | Updatetime: time.Now(),
167 | Isdel: 1}
168 |
169 | if err := service.AdmUserService.ModifyAdmUser(admuser, groupIds); err != nil {
170 | this.jsonResult(err.Error())
171 | }
172 | this.jsonResult(SUCCESS)
173 | }
174 |
175 | /**
176 | 删除
177 | */
178 | func (this *AdmUserController) Delete() {
179 | userids := this.GetString("userids")
180 | if err := service.AdmUserService.Delete(userids); err != nil {
181 | this.jsonResult(err.Error())
182 | }
183 | this.jsonResult(SUCCESS)
184 | }
185 |
186 | /**
187 | 获取管理员组列表数据
188 | 修改管理员的时候需要加载管理员组列表,并且设置已经选择的权限为选中状态
189 | */
190 | func (this *AdmUserController) Gridgrouplist() {
191 | admUserId, _ := this.GetInt64("admUserId")
192 | groupName := this.GetString("groupName")
193 | pageNum, _ := this.GetInt("page")
194 | rowsNum, _ := this.GetInt("rows")
195 | p := common.NewPager(pageNum, rowsNum)
196 |
197 | count, admuserGroup := service.AdmUserGroupService.Gridlist(groupName, p)
198 | checkedGroupId := service.AdmUserService.GetAllCheckGroup(admUserId)
199 |
200 | admUserCheckGroup := make([]model.Admusergroupcheck, len(admuserGroup))
201 |
202 | for index, admuser := range admuserGroup {
203 | admUserCheck := model.Admusergroupcheck{
204 | Id: admuser.Id,
205 | Groupname: admuser.Groupname,
206 | Des: admuser.Des,
207 | Createtime: admuser.Createtime,
208 | Updatetime: admuser.Updatetime,
209 | Isdel: admuser.Isdel,
210 | Check: checkedGroupId[admuser.Id]}
211 | admUserCheckGroup[index] = admUserCheck
212 | }
213 |
214 | this.jsonResultPager(count, admUserCheckGroup)
215 | }
216 |
--------------------------------------------------------------------------------
/static/css/pagination.css:
--------------------------------------------------------------------------------
1 | div.megas512 {
2 | height: 25px;
3 | padding-top:12px;
4 | margin: 5px;
5 | padding-left: 7px;
6 | text-indent: 0;
7 | text-align:center;
8 | }
9 | div.megas512 a {
10 |
11 | }
12 | div.megas512 a:hover {
13 |
14 | }
15 |
16 | #Pagination .current {
17 | background: url("/pop/web/images/page.gif") no-repeat scroll -88px 0 transparent;
18 | color: #B5B3B3;
19 | cursor: pointer;
20 | display: inline-block !important;
21 | height: 24px !important;
22 | line-height: 24px;
23 | margin-left: 3px;
24 | position: relative;
25 | text-align: center;
26 | top: -8px;
27 | width: 22px;
28 | position: relative;
29 | top: -16px;*top: -12px;
30 | }
31 |
32 | #Pagination .current:hover { background-position:-88px -24px; color:#fff;}
33 | #Pagination span.current{ background-position:-88px -24px; color:#fff;}
34 | #Pagination .disabled {
35 | background: url("/pop/web/images/page.gif") no-repeat -44px 0px scroll transparent;
36 | color: #B5B3B3;
37 | cursor: pointer;
38 | display: inline-block !important;
39 | height: 24px !important;
40 | line-height: 24px;
41 | margin-left: 3px;
42 | position: relative;
43 | text-align: center;
44 | top: -8px;
45 | width: 22px;}
46 |
47 |
48 |
49 | #Pagination .disabled:hover {background-position:-44px -24px;}
50 |
51 | #Pagination .classjason{background: url("/pop/web/images/page.gif") no-repeat -66px 0px scroll transparent;
52 | color: #B5B3B3;
53 | cursor: pointer;
54 | display: inline-block !important;
55 | height: 24px !important;
56 | line-height: 24px;
57 | margin-left: 3px;
58 | position: relative;
59 | text-align: center;
60 | top: -8px;
61 | width: 22px;}
62 |
63 | #Pagination .classjason:hover{background-position:-66px -24px;}
64 |
65 |
66 |
67 |
68 | #Pagination_S .current {
69 | background: url("/pop/web/images/page.gif") no-repeat scroll -88px 0 transparent;
70 | color: #B5B3B3;
71 | cursor: pointer;
72 | display: inline-block !important;
73 | height: 24px !important;
74 | line-height: 24px;
75 | margin-left: 3px;
76 | position: relative;
77 | text-align: center;
78 | top: -8px;
79 | width: 22px;
80 | position: relative;
81 | top: -16px;*top: -12px;
82 | }
83 |
84 | #Pagination_S .current:hover { background-position:-88px -24px; color:#fff;}
85 | #Pagination_S span.current{ background-position:-88px -24px; color:#fff;}
86 | #Pagination_S .disabled {
87 | background: url("/pop/web/images/page.gif") no-repeat -44px 0px scroll transparent;
88 | color: #B5B3B3;
89 | cursor: pointer;
90 | display: inline-block !important;
91 | height: 24px !important;
92 | line-height: 24px;
93 | margin-left: 3px;
94 | position: relative;
95 | text-align: center;
96 | top: -8px;
97 | width: 22px;}
98 |
99 |
100 |
101 | #Pagination_S .disabled:hover {background-position:-44px -24px;}
102 |
103 | #Pagination_S .classjason{background: url("/pop/web/images/page.gif") no-repeat -66px 0px scroll transparent;
104 | color: #B5B3B3;
105 | cursor: pointer;
106 | display: inline-block !important;
107 | height: 24px !important;
108 | line-height: 24px;
109 | margin-left: 3px;
110 | position: relative;
111 | text-align: center;
112 | top: -8px;
113 | width: 22px;}
114 |
115 | #Pagination_S .classjason:hover{background-position:-66px -24px;}
116 | /* #Pagination_S{ margin-top:20px;}*/
117 |
118 |
119 |
120 |
121 |
122 |
123 |
124 |
125 |
126 |
127 | #dmepagination .current {
128 | background: url("/pop/web/images/page.gif") no-repeat scroll -88px 0 transparent;
129 | color: #B5B3B3;
130 | cursor: pointer;
131 | display: inline-block !important;
132 | height: 24px !important;
133 | line-height: 24px;
134 | margin-left: 3px;
135 | position: relative;
136 | text-align: center;
137 | top: -8px;
138 | width: 22px;
139 | position: relative;
140 | top: -16px;*top: -12px;
141 | }
142 |
143 | #dmepagination .current:hover { background-position:-88px -24px; color:#fff;}
144 | #dmepagination span.current{ background-position:-88px -24px; color:#fff;}
145 | #dmepagination .disabled {
146 | background: url("/pop/web/images/page.gif") no-repeat -44px 0px scroll transparent;
147 | color: #B5B3B3;
148 | cursor: pointer;
149 | display: inline-block !important;
150 | height: 24px !important;
151 | line-height: 24px;
152 | margin-left: 3px;
153 | position: relative;
154 | text-align: center;
155 | top: -8px;
156 | width: 22px;}
157 |
158 |
159 |
160 | #dmepagination .disabled:hover {background-position:-44px -24px;}
161 |
162 | #dmepagination .classjason{background: url("/pop/web/images/page.gif") no-repeat -66px 0px scroll transparent;
163 | color: #B5B3B3;
164 | cursor: pointer;
165 | display: inline-block !important;
166 | height: 24px !important;
167 | line-height: 24px;
168 | margin-left: 3px;
169 | position: relative;
170 | text-align: center;
171 | top: -8px;
172 | width: 22px;}
173 |
174 | #dmepagination .classjason:hover{background-position:-66px -24px;}
175 | /*#dmepagination{ margin-top:20px;}*/
176 |
177 |
178 | #Pagination_T .current {
179 | background: url("/pop/web/images/page.gif") no-repeat scroll -88px 0 transparent;
180 | color: #B5B3B3;
181 | cursor: pointer;
182 | display: inline-block !important;
183 | height: 24px !important;
184 | line-height: 24px;
185 | margin-left: 3px;
186 | position: relative;
187 | text-align: center;
188 | top: -8px;
189 | width: 22px;
190 | position: relative;
191 | top: -16px;*top: -12px;
192 | }
193 |
194 | #Pagination_T .current:hover { background-position:-88px -24px; color:#fff;}
195 | #Pagination_T span.current{ background-position:-88px -24px; color:#fff;}
196 | #Pagination_T .disabled {
197 | background: url("/pop/web/images/page.gif") no-repeat -44px 0px scroll transparent;
198 | color: #B5B3B3;
199 | cursor: pointer;
200 | display: inline-block !important;
201 | height: 24px !important;
202 | line-height: 24px;
203 | margin-left: 3px;
204 | position: relative;
205 | text-align: center;
206 | top: -8px;
207 | width: 22px;}
208 |
209 |
210 |
211 | #Pagination_T .disabled:hover {background-position:-44px -24px;}
212 |
213 | #Pagination_T .classjason{background: url("/pop/web/images/page.gif") no-repeat -66px 0px scroll transparent;
214 | color: #B5B3B3;
215 | cursor: pointer;
216 | display: inline-block !important;
217 | height: 24px !important;
218 | line-height: 24px;
219 | margin-left: 3px;
220 | position: relative;
221 | text-align: center;
222 | top: -8px;
223 | width: 22px;}
224 |
225 | #Pagination_T .classjason:hover{background-position:-66px -24px;}
226 |
227 |
--------------------------------------------------------------------------------
/static/js/themes/color.css:
--------------------------------------------------------------------------------
1 | .c1,.c1:hover,.c1>.panel-header{
2 | color: #fff;
3 | border-color: #3c8b3c;
4 | background: #4cae4c;
5 | background: -webkit-linear-gradient(top,#4cae4c 0,#449d44 100%);
6 | background: -moz-linear-gradient(top,#4cae4c 0,#449d44 100%);
7 | background: -o-linear-gradient(top,#4cae4c 0,#449d44 100%);
8 | background: linear-gradient(to bottom,#4cae4c 0,#449d44 100%);
9 | filter: progid:DXImageTransform.Microsoft.gradient(startColorstr=#4cae4c,endColorstr=#449d44,GradientType=0);
10 | }
11 | a.c1:hover{
12 | background: #449d44;
13 | filter: none;
14 | }
15 | .c1>.panel-body{
16 | border-color: #3c8b3c;
17 | }
18 | .c1>.dialog-toolbar,.c1>.dialog-button{
19 | border-left-color: #3c8b3c;
20 | border-right-color: #3c8b3c;
21 | }
22 | .c1>.dialog-button{
23 | border-bottom-color: #3c8b3c;
24 | }
25 | .c2,.c2:hover,.c2>.panel-header{
26 | color: #fff;
27 | border-color: #5f5f5f;
28 | background: #747474;
29 | background: -webkit-linear-gradient(top,#747474 0,#676767 100%);
30 | background: -moz-linear-gradient(top,#747474 0,#676767 100%);
31 | background: -o-linear-gradient(top,#747474 0,#676767 100%);
32 | background: linear-gradient(to bottom,#747474 0,#676767 100%);
33 | filter: progid:DXImageTransform.Microsoft.gradient(startColorstr=#747474,endColorstr=#676767,GradientType=0);
34 | }
35 | a.c2:hover{
36 | background: #676767;
37 | filter: none;
38 | }
39 | .c2>.panel-body{
40 | border-color: #5f5f5f;
41 | }
42 | .c2>.dialog-toolbar,.c2>.dialog-button{
43 | border-left-color: #5f5f5f;
44 | border-right-color: #5f5f5f;
45 | }
46 | .c2>.dialog-button{
47 | border-bottom-color: #5f5f5f;
48 | }
49 | .c3,.c3:hover,.c3>.panel-header{
50 | color: #333;
51 | border-color: #ff8080;
52 | background: #ffb3b3;
53 | background: -webkit-linear-gradient(top,#ffb3b3 0,#ff9999 100%);
54 | background: -moz-linear-gradient(top,#ffb3b3 0,#ff9999 100%);
55 | background: -o-linear-gradient(top,#ffb3b3 0,#ff9999 100%);
56 | background: linear-gradient(to bottom,#ffb3b3 0,#ff9999 100%);
57 | filter: progid:DXImageTransform.Microsoft.gradient(startColorstr=#ffb3b3,endColorstr=#ff9999,GradientType=0);
58 | }
59 | a.c3:hover{
60 | background: #ff9999;
61 | filter: none;
62 | }
63 | .c3>.panel-body{
64 | border-color: #ff8080;
65 | }
66 | .c3>.dialog-toolbar,.c3>.dialog-button{
67 | border-left-color: #ff8080;
68 | border-right-color: #ff8080;
69 | }
70 | .c3>.dialog-button{
71 | border-bottom-color: #ff8080;
72 | }
73 | .c4,.c4:hover,.c4>.panel-header{
74 | color: #333;
75 | border-color: #52d689;
76 | background: #b8eecf;
77 | background: -webkit-linear-gradient(top,#b8eecf 0,#a4e9c1 100%);
78 | background: -moz-linear-gradient(top,#b8eecf 0,#a4e9c1 100%);
79 | background: -o-linear-gradient(top,#b8eecf 0,#a4e9c1 100%);
80 | background: linear-gradient(to bottom,#b8eecf 0,#a4e9c1 100%);
81 | filter: progid:DXImageTransform.Microsoft.gradient(startColorstr=#b8eecf,endColorstr=#a4e9c1,GradientType=0);
82 | }
83 | a.c4:hover{
84 | background: #a4e9c1;
85 | filter: none;
86 | }
87 | .c4>.panel-body{
88 | border-color: #52d689;
89 | }
90 | .c4>.dialog-toolbar,.c4>.dialog-button{
91 | border-left-color: #52d689;
92 | border-right-color: #52d689;
93 | }
94 | .c4>.dialog-button{
95 | border-bottom-color: #52d689;
96 | }
97 | .c5,.c5:hover,.c5>.panel-header{
98 | color: #fff;
99 | border-color: #b52b27;
100 | background: #d84f4b;
101 | background: -webkit-linear-gradient(top,#d84f4b 0,#c9302c 100%);
102 | background: -moz-linear-gradient(top,#d84f4b 0,#c9302c 100%);
103 | background: -o-linear-gradient(top,#d84f4b 0,#c9302c 100%);
104 | background: linear-gradient(to bottom,#d84f4b 0,#c9302c 100%);
105 | filter: progid:DXImageTransform.Microsoft.gradient(startColorstr=#d84f4b,endColorstr=#c9302c,GradientType=0);
106 | }
107 | a.c5:hover{
108 | background: #c9302c;
109 | filter: none;
110 | }
111 | .c5>.panel-body{
112 | border-color: #b52b27;
113 | }
114 | .c5>.dialog-toolbar,.c5>.dialog-button{
115 | border-left-color: #b52b27;
116 | border-right-color: #b52b27;
117 | }
118 | .c5>.dialog-button{
119 | border-bottom-color: #b52b27;
120 | }
121 | .c6,.c6:hover,.c6>.panel-header{
122 | color: #fff;
123 | border-color: #1f637b;
124 | background: #2984a4;
125 | background: -webkit-linear-gradient(top,#2984a4 0,#24748f 100%);
126 | background: -moz-linear-gradient(top,#2984a4 0,#24748f 100%);
127 | background: -o-linear-gradient(top,#2984a4 0,#24748f 100%);
128 | background: linear-gradient(to bottom,#2984a4 0,#24748f 100%);
129 | filter: progid:DXImageTransform.Microsoft.gradient(startColorstr=#2984a4,endColorstr=#24748f,GradientType=0);
130 | }
131 | a.c6:hover{
132 | background: #24748f;
133 | filter: none;
134 | }
135 | .c6>.panel-body{
136 | border-color: #1f637b;
137 | }
138 | .c6>.dialog-toolbar,.c6>.dialog-button{
139 | border-left-color: #1f637b;
140 | border-right-color: #1f637b;
141 | }
142 | .c6>.dialog-button{
143 | border-bottom-color: #1f637b;
144 | }
145 | .c7,.c7:hover,.c7>.panel-header{
146 | color: #333;
147 | border-color: #e68900;
148 | background: #ffab2e;
149 | background: -webkit-linear-gradient(top,#ffab2e 0,#ff9900 100%);
150 | background: -moz-linear-gradient(top,#ffab2e 0,#ff9900 100%);
151 | background: -o-linear-gradient(top,#ffab2e 0,#ff9900 100%);
152 | background: linear-gradient(to bottom,#ffab2e 0,#ff9900 100%);
153 | filter: progid:DXImageTransform.Microsoft.gradient(startColorstr=#ffab2e,endColorstr=#ff9900,GradientType=0);
154 | }
155 | a.c7:hover{
156 | background: #ff9900;
157 | filter: none;
158 | }
159 | .c7>.panel-body{
160 | border-color: #e68900;
161 | }
162 | .c7>.dialog-toolbar,.c7>.dialog-button{
163 | border-left-color: #e68900;
164 | border-right-color: #e68900;
165 | }
166 | .c7>.dialog-button{
167 | border-bottom-color: #e68900;
168 | }
169 | .c8,.c8:hover,.c8>.panel-header{
170 | color: #fff;
171 | border-color: #4b72a4;
172 | background: #698cba;
173 | background: -webkit-linear-gradient(top,#698cba 0,#577eb2 100%);
174 | background: -moz-linear-gradient(top,#698cba 0,#577eb2 100%);
175 | background: -o-linear-gradient(top,#698cba 0,#577eb2 100%);
176 | background: linear-gradient(to bottom,#698cba 0,#577eb2 100%);
177 | filter: progid:DXImageTransform.Microsoft.gradient(startColorstr=#698cba,endColorstr=#577eb2,GradientType=0);
178 | }
179 | a.c8:hover{
180 | background: #577eb2;
181 | filter: none;
182 | }
183 | .c8>.panel-body{
184 | border-color: #4b72a4;
185 | }
186 | .c8>.dialog-toolbar,.c8>.dialog-button{
187 | border-left-color: #4b72a4;
188 | border-right-color: #4b72a4;
189 | }
190 | .c8>.dialog-button{
191 | border-bottom-color: #4b72a4;
192 | }
193 | .c1>.panel-header>.panel-title,.c2>.panel-header>.panel-title,
194 | .c5>.panel-header>.panel-title,.c6>.panel-header>.panel-title,.c8>.panel-header>.panel-title{
195 | color: #fff;
196 | }
197 | .c-plain{
198 | border-color: #fff;
199 | background: #fff;
200 | }
201 | .c-plain>.panel-header,
202 | .c-plain>.panel-body,
203 | .c-plain>.dialog-button,
204 | .c-plain>.dialog-toolbar{
205 | border-color: transparent;
206 | background: transparent;
207 | }
208 | .c-raised{
209 | box-shadow: 0 2px 5px 0 rgba(0, 0, 0, 0.16), 0 2px 10px 0 rgba(0, 0, 0, 0.12);
210 | }
211 |
--------------------------------------------------------------------------------
/src/service/admuserService.go:
--------------------------------------------------------------------------------
1 | package service
2 |
3 | import (
4 | "cms/src/common"
5 | "cms/src/model"
6 | "strings"
7 | "time"
8 |
9 | "strconv"
10 |
11 | "github.com/astaxie/beego"
12 | "github.com/astaxie/beego/orm"
13 | )
14 |
15 | type admUserService struct{}
16 |
17 | /**
18 | 分页查询管理员列表
19 | */
20 | func (this *admUserService) Gridlist(pager *common.Pager, admuserid, admusermail, admusername, admuserphone, accout string) (count int, admusers []model.Admuser) {
21 | countsql := "select count(1) from t_admuser t "
22 | condition := genAdmUserCondition(admuserid, admusermail, admusername, admuserphone, accout)
23 | if err := o.Raw(countsql + condition).QueryRow(&count); err != nil || count < 1 {
24 | beego.Debug("select admuser count err or result is null.")
25 | return
26 | }
27 |
28 | listsql := "select id,accout,mail,name,phone,department,password,createtime,updatetime,isdel from t_admuser t "
29 | if _, err := o.Raw(listsql+condition+common.LIMIT, pager.GetBegin(), pager.GetLen()).QueryRows(&admusers); err != nil {
30 | beego.Warn("select admuserList from db error.")
31 | return
32 | }
33 | return
34 | }
35 |
36 | /**
37 | 按照参数拼接sql查询条件
38 | */
39 | func genAdmUserCondition(admuserid, admusermail, admusername, admuserphone, accout string) (condition string) {
40 | condition = " where t.isdel = 1 "
41 | if !strings.EqualFold(admuserid, "") {
42 | condition += " and t.id = " + admuserid + "'"
43 | }
44 | if !strings.EqualFold(admusermail, "") {
45 | condition += " and t.mail = '" + admusermail + "'"
46 | }
47 | if !strings.EqualFold(admusername, "") {
48 | condition += " and t.name = '" + admusername + "'"
49 | }
50 | if !strings.EqualFold(admuserphone, "") {
51 | condition += " and t.phone = '" + admuserphone + "'"
52 | }
53 | if !strings.EqualFold(accout, "") {
54 | condition += " and t.accout = '" + accout + "'"
55 | }
56 | beego.Debug("condition is : ", condition)
57 | return
58 | }
59 |
60 | /**
61 | 添加管理员
62 | */
63 | func (this *admUserService) AddAdmUser(admUser *model.Admuser, groupIds string) error {
64 | flag := false
65 | if admUserId, err := o.Insert(admUser); err != nil {
66 | beego.Warn("insert admUser fail, admUser:", admUser, err.Error())
67 | return &common.BizError{"添加失败,账号已经存在"}
68 | } else {
69 | idArray := strings.Split(groupIds, ",")
70 | for _, gid := range idArray {
71 | gidint, err := strconv.ParseInt(gid, 10, 64)
72 | if err != nil {
73 | beego.Debug("id 转换成数字异常,id:", gid)
74 | flag = true
75 | }
76 | rel := model.UserGroupRel{
77 | Userid: admUserId,
78 | Groupid: gidint,
79 | Isdel: 1}
80 | if _, err := o.Insert(&rel); err != nil {
81 | flag = true
82 | }
83 | }
84 | }
85 | if flag {
86 | return &common.BizError{"出现异常,部分权限添加失败,请补充添加权限。"}
87 | }
88 | return nil
89 | }
90 |
91 | /**
92 | 修改管理员
93 | */
94 | func (this *admUserService) ModifyAdmUser(admUser *model.Admuser, groupIds string) error {
95 | flag := false
96 | updateSql := "UPDATE t_admuser SET "
97 |
98 | set := updateSet(admUser)
99 | condition := " where id = ? "
100 |
101 | // if _, err := o.Raw(updateSql, admUser.Accout, admUser.Mail, admUser.Name, admUser.Phone, admUser.Department, time.Now(), admUser.Id).Exec(); err != nil {
102 | id := admUser.Id
103 | if _, err := o.Raw(updateSql+set+condition, id).Exec(); err != nil {
104 | beego.Warn("update admUser fail, admUser:", admUser, err.Error())
105 | return &common.BizError{"修改失败"}
106 | } else {
107 | //逻辑删除所有用户和组关联关系UserGroupRel
108 | delRelSql := "update t_user_group_rel set isdel = 0 where userid = ?"
109 | if _, err := o.Raw(delRelSql, admUser.Id).Exec(); err != nil {
110 | return &common.BizError{"修改失败"}
111 | }
112 |
113 | idArray := strings.Split(groupIds, ",")
114 | //重新添加关联关系
115 | for _, gid := range idArray {
116 | gidint, err := strconv.ParseInt(gid, 10, 64)
117 | if err != nil {
118 | beego.Debug("id 转换成数字异常,id:", gid)
119 | flag = true
120 | }
121 | rel := model.UserGroupRel{
122 | Userid: admUser.Id,
123 | Groupid: gidint,
124 | Isdel: 1}
125 | if _, err := o.Insert(&rel); err != nil {
126 | beego.Warn("添加组关系失败", rel, err.Error())
127 | flag = true
128 | }
129 | }
130 | }
131 | if flag {
132 | return &common.BizError{"出现异常,部分权限修改失败,请补充添加权限。"}
133 | }
134 |
135 | return nil
136 | }
137 |
138 | func updateSet(admUser *model.Admuser) string {
139 | set := ""
140 | if !strings.EqualFold(admUser.Password, "") {
141 | set += " password = '" + admUser.Password + "',"
142 | }
143 | if !strings.EqualFold(admUser.Accout, "") {
144 | set += " accout = '" + admUser.Accout + "',"
145 | }
146 | if !strings.EqualFold(admUser.Mail, "") {
147 | set += " mail = '" + admUser.Mail + "',"
148 | }
149 | if !strings.EqualFold(admUser.Name, "") {
150 | set += " name = '" + admUser.Name + "',"
151 | }
152 | if !strings.EqualFold(admUser.Phone, "") {
153 | set += " phone = '" + admUser.Phone + "',"
154 | }
155 | if !strings.EqualFold(admUser.Department, "") {
156 | set += " department = '" + admUser.Department + "',"
157 | }
158 | set += " updatetime = '" + time.Now().Format("2006-01-02 15:04:05") + "'"
159 |
160 | return set
161 | }
162 |
163 | /**
164 | 删除管理员基本信息
165 | */
166 | func (this *admUserService) Delete(userids string) error {
167 | delUserSql := "update t_admuser set isdel = 0 where id in (" + userids + ")"
168 | if _, err := o.Raw(delUserSql).Exec(); err != nil {
169 | return &common.BizError{"删除管理员基本信息失败"}
170 | }
171 | delRelSql := "update t_user_group_rel set isdel = 0 where userid in (" + userids + ")"
172 | if _, err := o.Raw(delRelSql).Exec(); err != nil {
173 | return &common.BizError{"删除管理员和组关系失败"}
174 | }
175 | return nil
176 | }
177 |
178 | /**
179 | 登陆鉴权
180 | */
181 | func (this *admUserService) Authentication(accout, encodePwd string) (admuser *model.Admuser, err error) {
182 | selectSql := "select id,password from t_admuser t where t.accout = '" + accout + "' and isdel =1"
183 | if err := o.Raw(selectSql).QueryRow(&admuser); err != nil {
184 | if err == orm.ErrNoRows {
185 | return nil, &common.BizError{"账号不存在"}
186 | }
187 | return nil, &common.BizError{"登陆失败,请稍后重试"}
188 | }
189 | if !strings.EqualFold(encodePwd, admuser.Password) {
190 | return nil, &common.BizError{"密码错误"}
191 | }
192 | return admuser, nil
193 | }
194 |
195 | /**
196 | 根据ID查询管理员
197 | */
198 | func (this *admUserService) GetUserById(id int64) (admuser *model.Admuser, err error) {
199 | admuser = &model.Admuser{Id: id}
200 | if err := o.Read(admuser); err != nil {
201 | if err == orm.ErrNoRows {
202 | err = &common.BizError{"账号不存在"}
203 | return nil, err
204 | }
205 | err = &common.BizError{"系统错误"}
206 | return nil, err
207 | }
208 | return admuser, nil
209 | }
210 |
211 | func (this *admUserService) GetAllCheckGroup(id int64) map[int64]bool {
212 | var list orm.ParamsList
213 | num, err := o.Raw("SELECT groupid from t_user_group_rel t where isdel=1 and t.userid = ?", id).ValuesFlat(&list)
214 | if err != nil || num < 1 {
215 | return nil
216 | }
217 | roleIdMap := make(map[int64]bool, len(list))
218 | for i := 0; i < len(list); i++ {
219 | idStr := list[i].(string)
220 | id, _ := strconv.ParseInt(idStr, 10, 64)
221 | roleIdMap[id] = true
222 | }
223 | return roleIdMap
224 | }
225 |
--------------------------------------------------------------------------------
/doc/database.sql:
--------------------------------------------------------------------------------
1 | SET NAMES UTF8;
2 | create database if not exists cmsadmin default charset utf8 collate utf8_general_ci;
3 | grant select,update,delete,insert,alter,create,drop on cmsadmin.* to "cmsadmin"@"%" identified by "cmsadmin";
4 | grant select,update,delete,insert,alter,create,drop on cmsadmin.* to "cmsadmin"@"localhost" identified by "cmsadmin";
5 | USE cmsadmin;
6 |
7 |
8 | /*
9 | Navicat MySQL Data Transfer
10 |
11 | Source Server : root
12 | Source Server Version : 50629
13 | Source Host : localhost:3306
14 | Source Database : cmsadmin
15 |
16 | Target Server Type : MYSQL
17 | Target Server Version : 50629
18 | File Encoding : 65001
19 |
20 | Date: 2016-09-04 17:49:48
21 | */
22 |
23 | SET FOREIGN_KEY_CHECKS=0;
24 |
25 | -- ----------------------------
26 | -- Table structure for t_admuser
27 | -- ----------------------------
28 | DROP TABLE IF EXISTS `t_admuser`;
29 | CREATE TABLE `t_admuser` (
30 | `id` bigint(20) NOT NULL AUTO_INCREMENT,
31 | `accout` varchar(255) NOT NULL DEFAULT '',
32 | `mail` varchar(255) NOT NULL DEFAULT '',
33 | `name` varchar(255) NOT NULL DEFAULT '',
34 | `phone` varchar(255) NOT NULL DEFAULT '',
35 | `department` varchar(255) NOT NULL DEFAULT '',
36 | `password` varchar(255) NOT NULL DEFAULT '',
37 | `createtime` datetime NOT NULL,
38 | `updatetime` datetime NOT NULL,
39 | `isdel` tinyint(4) NOT NULL DEFAULT '0',
40 | PRIMARY KEY (`id`),
41 | UNIQUE KEY `admUserAcout` (`accout`)
42 | ) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8;
43 |
44 | -- ----------------------------
45 | -- Records of t_admuser
46 | -- ----------------------------
47 | INSERT INTO `t_admuser` VALUES ('1', 'admin', 'gaojianwen@hotmail.com', 'CrazyWolf', '1391387065', '研发', 'SddggEssSsmtsJgFUdFgInnFGsEfgBs2Sd==', '2016-08-27 15:05:11', '2016-09-03 10:56:45', '1');
48 | INSERT INTO `t_admuser` VALUES ('2', 'test', 'test@test.com', 'test', 'test', 'test', 'SddggEssSsmt1dDGdsdgsdGfdDgRdfgsDd==', '2016-09-03 03:02:28', '2016-09-04 14:57:20', '1');
49 |
50 | -- ----------------------------
51 | -- Table structure for t_admusergroup
52 | -- ----------------------------
53 | DROP TABLE IF EXISTS `t_admusergroup`;
54 | CREATE TABLE `t_admusergroup` (
55 | `id` bigint(20) NOT NULL AUTO_INCREMENT,
56 | `groupname` varchar(255) NOT NULL DEFAULT '',
57 | `des` varchar(255) NOT NULL DEFAULT '',
58 | `createtime` datetime NOT NULL,
59 | `updatetime` datetime NOT NULL,
60 | `isdel` tinyint(4) NOT NULL DEFAULT '0',
61 | PRIMARY KEY (`id`)
62 | ) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8;
63 |
64 | -- ----------------------------
65 | -- Records of t_admusergroup
66 | -- ----------------------------
67 | INSERT INTO `t_admusergroup` VALUES ('1', '超级管理员', '超级管理员', '2016-09-03 03:01:42', '2016-09-03 03:01:42', '1');
68 | INSERT INTO `t_admusergroup` VALUES ('2', 'test', 'test', '2016-09-04 07:55:52', '2016-09-04 07:55:52', '1');
69 | INSERT INTO `t_admusergroup` VALUES ('3', 'test2', 'test2', '2016-09-04 06:41:06', '2016-09-04 06:41:06', '0');
70 |
71 | -- ----------------------------
72 | -- Table structure for t_group_role_rel
73 | -- ----------------------------
74 | DROP TABLE IF EXISTS `t_group_role_rel`;
75 | CREATE TABLE `t_group_role_rel` (
76 | `id` bigint(20) NOT NULL AUTO_INCREMENT,
77 | `groupid` bigint(20) NOT NULL DEFAULT '0',
78 | `roleid` bigint(20) NOT NULL DEFAULT '0',
79 | `isdel` tinyint(4) NOT NULL DEFAULT '0',
80 | PRIMARY KEY (`id`)
81 | ) ENGINE=InnoDB AUTO_INCREMENT=310 DEFAULT CHARSET=utf8;
82 |
83 | -- ----------------------------
84 | -- Records of t_group_role_rel
85 | -- ----------------------------
86 | INSERT INTO `t_group_role_rel` VALUES ('291', '2', '1', '1');
87 | INSERT INTO `t_group_role_rel` VALUES ('292', '2', '18', '1');
88 | INSERT INTO `t_group_role_rel` VALUES ('293', '2', '19', '1');
89 | INSERT INTO `t_group_role_rel` VALUES ('294', '2', '20', '1');
90 | INSERT INTO `t_group_role_rel` VALUES ('295', '2', '21', '1');
91 | INSERT INTO `t_group_role_rel` VALUES ('296', '2', '2', '1');
92 | INSERT INTO `t_group_role_rel` VALUES ('297', '2', '3', '1');
93 | INSERT INTO `t_group_role_rel` VALUES ('298', '2', '6', '1');
94 | INSERT INTO `t_group_role_rel` VALUES ('299', '2', '13', '1');
95 | INSERT INTO `t_group_role_rel` VALUES ('300', '2', '15', '1');
96 | INSERT INTO `t_group_role_rel` VALUES ('301', '2', '16', '1');
97 | INSERT INTO `t_group_role_rel` VALUES ('302', '2', '4', '1');
98 | INSERT INTO `t_group_role_rel` VALUES ('303', '2', '25', '1');
99 | INSERT INTO `t_group_role_rel` VALUES ('304', '2', '26', '1');
100 | INSERT INTO `t_group_role_rel` VALUES ('305', '2', '27', '1');
101 | INSERT INTO `t_group_role_rel` VALUES ('306', '2', '28', '1');
102 | INSERT INTO `t_group_role_rel` VALUES ('307', '2', '29', '1');
103 | INSERT INTO `t_group_role_rel` VALUES ('308', '2', '30', '1');
104 | INSERT INTO `t_group_role_rel` VALUES ('309', '2', '42', '1');
105 |
106 | -- ----------------------------
107 | -- Table structure for t_role
108 | -- ----------------------------
109 | DROP TABLE IF EXISTS `t_role`;
110 | CREATE TABLE `t_role` (
111 | `id` int(11) NOT NULL AUTO_INCREMENT,
112 | `pid` int(11) DEFAULT '0',
113 | `name` varchar(255) NOT NULL DEFAULT '',
114 | `roleurl` varchar(255) NOT NULL DEFAULT '',
115 | `ismenu` tinyint(4) NOT NULL DEFAULT '0',
116 | `des` varchar(255) NOT NULL DEFAULT '',
117 | `module` varchar(50) NOT NULL DEFAULT '',
118 | `action` varchar(50) NOT NULL DEFAULT '',
119 | PRIMARY KEY (`id`)
120 | ) ENGINE=InnoDB AUTO_INCREMENT=43 DEFAULT CHARSET=utf8;
121 |
122 | -- ----------------------------
123 | -- Records of t_role
124 | -- ----------------------------
125 | INSERT INTO `t_role` VALUES ('0', null, 'Root', '3123', '1', '根节点', '', '');
126 | INSERT INTO `t_role` VALUES ('1', '0', '公共权限', '', '1', '公共权限 所有账号都应该有', '', '');
127 | INSERT INTO `t_role` VALUES ('2', '0', '账号管理', '', '0', '账号管理目录', '', '');
128 | INSERT INTO `t_role` VALUES ('3', '2', '管理员管理', 'admuser/list', '0', '', 'AdmUserController', 'List');
129 | INSERT INTO `t_role` VALUES ('4', '2', '管理员组管理', 'admusergroup/list', '0', '', 'AdmUserGroupController', 'List');
130 | INSERT INTO `t_role` VALUES ('5', '2', '权限管理', 'role/list', '0', '', 'RoleController', 'List');
131 | INSERT INTO `t_role` VALUES ('6', '3', '获取管理员列表', 'admuser/list', '1', '', 'AdmUserController', 'Gridlist');
132 | INSERT INTO `t_role` VALUES ('13', '3', '查看所有管理员', 'admuser/gridlist', '1', '', 'AdmUserController', 'Gridlist');
133 | INSERT INTO `t_role` VALUES ('15', '3', '进入添加管理员', 'admuser/toaddadmuser', '1', '进入添加管理员页面', 'AdmUserController', 'Toaddadmuser');
134 | INSERT INTO `t_role` VALUES ('16', '3', '添加管理员', 'admuser/addadmuser', '1', '执行添加管理员操作', 'AdmUserController', 'Addadmuser');
135 | INSERT INTO `t_role` VALUES ('18', '1', '进入欢迎页', '/welcome', '1', '进入欢迎页', 'MainController', 'Welcome');
136 | INSERT INTO `t_role` VALUES ('19', '1', '展示导航页面', '/leftMenu', '1', '展示导航页面', 'MainController', 'LeftMenu');
137 | INSERT INTO `t_role` VALUES ('20', '1', '展示头部信息', '/header', '1', '展示头部信息', 'MainController', 'Header');
138 | INSERT INTO `t_role` VALUES ('21', '1', '获取菜单数据', '/loadMenu', '1', '获取菜单数据', 'MainController', 'LoadMenu');
139 | INSERT INTO `t_role` VALUES ('25', '4', '进入添加页面', '', '1', '进入添加页面', 'AdmUserGroupController', 'Toadd');
140 | INSERT INTO `t_role` VALUES ('26', '4', '添加管理员组', '', '1', '添加管理员组', 'AdmUserGroupController', 'Addadmusergroup');
141 | INSERT INTO `t_role` VALUES ('27', '4', '进入修改页面', '', '1', '进入修改页面', 'AdmUserGroupController', 'Tomodify');
142 | INSERT INTO `t_role` VALUES ('28', '4', '修改管理员组', '', '1', '修改管理员组', 'AdmUserGroupController', 'Modifyadmusergroup');
143 | INSERT INTO `t_role` VALUES ('29', '4', '删除管理员组', '', '1', '删除管理员组', 'AdmUserGroupController', 'Delete');
144 | INSERT INTO `t_role` VALUES ('30', '4', '获取权限树', '', '1', '添加管理员组的时候展示权限树', 'AdmUserGroupController', 'Loadtreechecked');
145 | INSERT INTO `t_role` VALUES ('32', '5', '查询', '', '1', '查询列表', 'RoleController', 'Gridlist');
146 | INSERT INTO `t_role` VALUES ('33', '5', '加载左侧树', '', '1', '加载左侧树', 'RoleController', 'Listtree');
147 | INSERT INTO `t_role` VALUES ('34', '5', '进入添加页面', '', '1', '进入添加页面', 'RoleController', 'Toadd');
148 | INSERT INTO `t_role` VALUES ('35', '5', '添加权限', '', '1', '添加权限', 'RoleController', 'Addrole');
149 | INSERT INTO `t_role` VALUES ('36', '5', '进入修改页面', '', '1', '进入修改页面', 'RoleController', 'Tomodify');
150 | INSERT INTO `t_role` VALUES ('37', '5', '修改权限', '', '1', '修改权限', 'RoleController', 'Modify');
151 | INSERT INTO `t_role` VALUES ('38', '5', '删除权限', '', '1', '删除权限', 'RoleController', 'Deleterole');
152 | INSERT INTO `t_role` VALUES ('42', '4', '查询', '', '1', '查询列表', 'AdmUserGroupController', 'Gridlist');
153 |
154 | -- ----------------------------
155 | -- Table structure for t_role_bak
156 | -- ----------------------------
157 | DROP TABLE IF EXISTS `t_role_bak`;
158 | CREATE TABLE `t_role_bak` (
159 | `id` int(11) NOT NULL AUTO_INCREMENT,
160 | `pid` int(11) DEFAULT '0',
161 | `name` varchar(255) NOT NULL DEFAULT '',
162 | `roleurl` varchar(255) NOT NULL DEFAULT '',
163 | `ismenu` tinyint(4) NOT NULL DEFAULT '0',
164 | `des` varchar(255) NOT NULL DEFAULT '',
165 | PRIMARY KEY (`id`)
166 | ) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8;
167 |
168 | -- ----------------------------
169 | -- Records of t_role_bak
170 | -- ----------------------------
171 | INSERT INTO `t_role_bak` VALUES ('0', null, 'Root', '3123', '123', '123123');
172 | INSERT INTO `t_role_bak` VALUES ('1', '0', '用户管污染物而', '534', '127', '345345');
173 | INSERT INTO `t_role_bak` VALUES ('2', '0', '系统管理', '345', '127', '45345');
174 | INSERT INTO `t_role_bak` VALUES ('4', '1', '用户管理', 'aaa', '1', '阿斯蒂芬');
175 | INSERT INTO `t_role_bak` VALUES ('5', '2', '管理员管理', '阿斯蒂芬', '4', '阿迪飞');
176 |
177 | -- ----------------------------
178 | -- Table structure for t_user_group_rel
179 | -- ----------------------------
180 | DROP TABLE IF EXISTS `t_user_group_rel`;
181 | CREATE TABLE `t_user_group_rel` (
182 | `id` bigint(20) NOT NULL AUTO_INCREMENT,
183 | `userid` bigint(20) NOT NULL DEFAULT '0',
184 | `groupid` bigint(20) NOT NULL DEFAULT '0',
185 | `isdel` tinyint(4) NOT NULL DEFAULT '1',
186 | PRIMARY KEY (`id`)
187 | ) ENGINE=InnoDB AUTO_INCREMENT=8 DEFAULT CHARSET=utf8;
188 |
189 | -- ----------------------------
190 | -- Records of t_user_group_rel
191 | -- ----------------------------
192 | INSERT INTO `t_user_group_rel` VALUES ('4', '1', '1', '1');
193 | INSERT INTO `t_user_group_rel` VALUES ('7', '2', '2', '1');
194 |
--------------------------------------------------------------------------------
/static/js/jquery/jquery.ztree.excheck.min.js:
--------------------------------------------------------------------------------
1 | /*
2 | * JQuery zTree excheck v3.5.24
3 | * http://zTree.me/
4 | *
5 | * Copyright (c) 2010 Hunter.z
6 | *
7 | * Licensed same as jquery - MIT License
8 | * http://www.opensource.org/licenses/mit-license.php
9 | *
10 | * email: hunter.z@263.net
11 | * Date: 2016-06-06
12 | */
13 | (function(m){var p,q,r,o={event:{CHECK:"ztree_check"},id:{CHECK:"_check"},checkbox:{STYLE:"checkbox",DEFAULT:"chk",DISABLED:"disable",FALSE:"false",TRUE:"true",FULL:"full",PART:"part",FOCUS:"focus"},radio:{STYLE:"radio",TYPE_ALL:"all",TYPE_LEVEL:"level"}},v={check:{enable:!1,autoCheckTrigger:!1,chkStyle:o.checkbox.STYLE,nocheckInherit:!1,chkDisabledInherit:!1,radioType:o.radio.TYPE_LEVEL,chkboxType:{Y:"ps",N:"ps"}},data:{key:{checked:"checked"}},callback:{beforeCheck:null,onCheck:null}};p=function(c,
14 | a){if(a.chkDisabled===!0)return!1;var b=g.getSetting(c.data.treeId),d=b.data.key.checked;if(k.apply(b.callback.beforeCheck,[b.treeId,a],!0)==!1)return!0;a[d]=!a[d];e.checkNodeRelation(b,a);d=n(a,j.id.CHECK,b);e.setChkClass(b,d,a);e.repairParentChkClassWithSelf(b,a);b.treeObj.trigger(j.event.CHECK,[c,b.treeId,a]);return!0};q=function(c,a){if(a.chkDisabled===!0)return!1;var b=g.getSetting(c.data.treeId),d=n(a,j.id.CHECK,b);a.check_Focus=!0;e.setChkClass(b,d,a);return!0};r=function(c,a){if(a.chkDisabled===
15 | !0)return!1;var b=g.getSetting(c.data.treeId),d=n(a,j.id.CHECK,b);a.check_Focus=!1;e.setChkClass(b,d,a);return!0};m.extend(!0,m.fn.zTree.consts,o);m.extend(!0,m.fn.zTree._z,{tools:{},view:{checkNodeRelation:function(c,a){var b,d,h,i=c.data.key.children,l=c.data.key.checked;b=j.radio;if(c.check.chkStyle==b.STYLE){var f=g.getRadioCheckedList(c);if(a[l])if(c.check.radioType==b.TYPE_ALL){for(d=f.length-1;d>=0;d--)b=f[d],b[l]&&b!=a&&(b[l]=!1,f.splice(d,1),e.setChkClass(c,n(b,j.id.CHECK,c),b),b.parentTId!=
16 | a.parentTId&&e.repairParentChkClassWithSelf(c,b));f.push(a)}else{f=a.parentTId?a.getParentNode():g.getRoot(c);for(d=0,h=f[i].length;d
-1)&&e.setSonNodeCheckBox(c,a,!0),!a[l]&&(!a[i]||a[i].length==0||c.check.chkboxType.N.indexOf("s")>-1)&&e.setSonNodeCheckBox(c,
17 | a,!1),a[l]&&c.check.chkboxType.Y.indexOf("p")>-1&&e.setParentNodeCheckBox(c,a,!0),!a[l]&&c.check.chkboxType.N.indexOf("p")>-1&&e.setParentNodeCheckBox(c,a,!1)},makeChkClass:function(c,a){var b=c.data.key.checked,d=j.checkbox,h=j.radio,i="",i=a.chkDisabled===!0?d.DISABLED:a.halfCheck?d.PART:c.check.chkStyle==h.STYLE?a.check_Child_State<1?d.FULL:d.PART:a[b]?a.check_Child_State===2||a.check_Child_State===-1?d.FULL:d.PART:a.check_Child_State<1?d.FULL:d.PART,b=c.check.chkStyle+"_"+(a[b]?d.TRUE:d.FALSE)+
18 | "_"+i,b=a.check_Focus&&a.chkDisabled!==!0?b+"_"+d.FOCUS:b;return j.className.BUTTON+" "+d.DEFAULT+" "+b},repairAllChk:function(c,a){if(c.check.enable&&c.check.chkStyle===j.checkbox.STYLE)for(var b=c.data.key.checked,d=c.data.key.children,h=g.getRoot(c),i=0,l=h[d].length;i0?e.repairParentChkClass(c,a[b][0]):e.repairParentChkClass(c,a)}},repairSonChkDisabled:function(c,a,b,d){if(a){var h=c.data.key.children;if(a.chkDisabled!=b)a.chkDisabled=b;e.repairChkClass(c,a);if(a[h]&&d)for(var i=0,l=a[h].length;i0){l=!1;break}l&&e.setParentNodeCheckBox(c,a.getParentNode(),b,d)}},setSonNodeCheckBox:function(c,a,b,d){if(a){var h=c.data.key.children,i=c.data.key.checked,l=n(a,j.id.CHECK,c);d||(d=a);var f=!1;if(a[h])for(var k=0,m=a[h].length;k0?b?2:0:-1}else a.check_Child_State=-1;e.setChkClass(c,l,a);c.check.autoCheckTrigger&&a!=d&&a.nocheck!==!0&&a.chkDisabled!==!0&&c.treeObj.trigger(j.event.CHECK,[null,c.treeId,a])}}}},event:{},data:{getRadioCheckedList:function(c){for(var a=g.getRoot(c).radioCheckedList,b=0,d=a.length;b-1&&a.check_Child_State<2:a.check_Child_State>0}},getTreeCheckedNodes:function(c,a,b,d){if(!a)return[];for(var h=c.data.key.children,i=c.data.key.checked,e=b&&c.check.chkStyle==j.radio.STYLE&&c.check.radioType==j.radio.TYPE_ALL,d=!d?[]:d,
24 | f=0,k=a.length;f0)break}return d},getTreeChangeCheckedNodes:function(c,a,b){if(!a)return[];for(var d=c.data.key.children,h=c.data.key.checked,b=!b?[]:b,i=0,e=a.length;i0?2:0,g==2){h=2;break}else g==0&&(h=0);else if(c.check.chkStyle==j.checkbox.STYLE)if(g=f.nocheck===!0||f.chkDisabled===!0?f.check_Child_State:f.halfCheck===!0?1:f[d]?f.check_Child_State===-1||f.check_Child_State===2?2:1:f.check_Child_State>0?1:0,g===1){h=1;break}else if(g===
26 | 2&&h>-1&&i>0&&g!==h){h=1;break}else if(h===2&&g>-1&&g<2){h=1;break}else g>-1&&(h=g)}a.check_Child_State=h}}}});var m=m.fn.zTree,k=m._z.tools,j=m.consts,e=m._z.view,g=m._z.data,n=k.$;g.exSetting(v);g.addInitBind(function(c){c.treeObj.bind(j.event.CHECK,function(a,b,d,h){a.srcEvent=b;k.apply(c.callback.onCheck,[a,d,h])})});g.addInitUnBind(function(c){c.treeObj.unbind(j.event.CHECK)});g.addInitCache(function(){});g.addInitNode(function(c,a,b,d){if(b){a=c.data.key.checked;typeof b[a]=="string"&&(b[a]=
27 | k.eqs(b[a],"true"));b[a]=!!b[a];b.checkedOld=b[a];if(typeof b.nocheck=="string")b.nocheck=k.eqs(b.nocheck,"true");b.nocheck=!!b.nocheck||c.check.nocheckInherit&&d&&!!d.nocheck;if(typeof b.chkDisabled=="string")b.chkDisabled=k.eqs(b.chkDisabled,"true");b.chkDisabled=!!b.chkDisabled||c.check.chkDisabledInherit&&d&&!!d.chkDisabled;if(typeof b.halfCheck=="string")b.halfCheck=k.eqs(b.halfCheck,"true");b.halfCheck=!!b.halfCheck;b.check_Child_State=-1;b.check_Focus=!1;b.getCheckStatus=function(){return g.getCheckStatus(c,
28 | b)};c.check.chkStyle==j.radio.STYLE&&c.check.radioType==j.radio.TYPE_ALL&&b[a]&&g.getRoot(c).radioCheckedList.push(b)}});g.addInitProxy(function(c){var a=c.target,b=g.getSetting(c.data.treeId),d="",h=null,e="",l=null;if(k.eqs(c.type,"mouseover")){if(b.check.enable&&k.eqs(a.tagName,"span")&&a.getAttribute("treeNode"+j.id.CHECK)!==null)d=k.getNodeMainDom(a).id,e="mouseoverCheck"}else if(k.eqs(c.type,"mouseout")){if(b.check.enable&&k.eqs(a.tagName,"span")&&a.getAttribute("treeNode"+j.id.CHECK)!==null)d=
29 | k.getNodeMainDom(a).id,e="mouseoutCheck"}else if(k.eqs(c.type,"click")&&b.check.enable&&k.eqs(a.tagName,"span")&&a.getAttribute("treeNode"+j.id.CHECK)!==null)d=k.getNodeMainDom(a).id,e="checkNode";if(d.length>0)switch(h=g.getNodeCache(b,d),e){case "checkNode":l=p;break;case "mouseoverCheck":l=q;break;case "mouseoutCheck":l=r}return{stop:e==="checkNode",node:h,nodeEventType:e,nodeEventCallback:l,treeEventType:"",treeEventCallback:null}},!0);g.addInitRoot(function(c){g.getRoot(c).radioCheckedList=[]});
30 | g.addBeforeA(function(c,a,b){c.check.enable&&(g.makeChkFlag(c,a),b.push(""))});g.addZTreeTools(function(c,a){a.checkNode=function(a,b,c,g){var f=this.setting.data.key.checked;if(a.chkDisabled!==!0&&(b!==!0&&b!==!1&&(b=!a[f]),g=!!g,(a[f]!==b||c)&&!(g&&k.apply(this.setting.callback.beforeCheck,[this.setting.treeId,a],!0)==!1)&&k.uCanDo(this.setting)&&this.setting.check.enable&&
31 | a.nocheck!==!0))a[f]=b,b=n(a,j.id.CHECK,this.setting),(c||this.setting.check.chkStyle===j.radio.STYLE)&&e.checkNodeRelation(this.setting,a),e.setChkClass(this.setting,b,a),e.repairParentChkClassWithSelf(this.setting,a),g&&this.setting.treeObj.trigger(j.event.CHECK,[null,this.setting.treeId,a])};a.checkAllNodes=function(a){e.repairAllChk(this.setting,!!a)};a.getCheckedNodes=function(a){var b=this.setting.data.key.children;return g.getTreeCheckedNodes(this.setting,g.getRoot(this.setting)[b],a!==!1)};
32 | a.getChangeCheckedNodes=function(){var a=this.setting.data.key.children;return g.getTreeChangeCheckedNodes(this.setting,g.getRoot(this.setting)[a])};a.setChkDisabled=function(a,b,c,g){b=!!b;c=!!c;e.repairSonChkDisabled(this.setting,a,b,!!g);e.repairParentChkDisabled(this.setting,a.getParentNode(),b,c)};var b=a.updateNode;a.updateNode=function(c,g){b&&b.apply(a,arguments);if(c&&this.setting.check.enable&&n(c,this.setting).get(0)&&k.uCanDo(this.setting)){var i=n(c,j.id.CHECK,this.setting);(g==!0||this.setting.check.chkStyle===
33 | j.radio.STYLE)&&e.checkNodeRelation(this.setting,c);e.setChkClass(this.setting,i,c);e.repairParentChkClassWithSelf(this.setting,c)}}});var s=e.createNodes;e.createNodes=function(c,a,b,d,g){s&&s.apply(e,arguments);b&&e.repairParentChkClassWithSelf(c,d)};var t=e.removeNode;e.removeNode=function(c,a){var b=a.getParentNode();t&&t.apply(e,arguments);a&&b&&(e.repairChkClass(c,b),e.repairParentChkClass(c,b))};var u=e.appendNodes;e.appendNodes=function(c,a,b,d,h,i,j){var f="";u&&(f=u.apply(e,arguments));
34 | d&&g.makeChkFlag(c,d);return f}})(jQuery);
35 |
--------------------------------------------------------------------------------
/static/js/phpjs-min.js:
--------------------------------------------------------------------------------
1 | /**
2 | * Created with JetBrains PhpStorm.
3 | * User: liuzhiming
4 | * Date: 12-11-9
5 | * Time: 下午5:08
6 | * To change this template use File | Settings | File Templates.
7 | */
8 | (function(window,undefined){var phpjs=window.phpjs||{};phpjs.array_intersect=function(arr1){var retArr={},argl=arguments.length,arglm1=argl-1,k1="",arr={},i=0,k="";arr1keys:for(k1 in arr1){arrs:for(i=1;i0){if(m[0]=="last"){diff-=7}}else{if(m[0]=="next"){diff+=7}}}now.setDate(now.getDate()+diff)}}break;default:if(/\d+/.test(m[0])){num*=parseInt(m[0],10);switch(m[1].substring(0,3)){case"yea":now.setFullYear(now.getFullYear()+num);break;case"mon":now.setMonth(now.getMonth()+num);break;case"wee":now.setDate(now.getDate()+(num*7));break;case"day":now.setDate(now.getDate()+num);break;case"hou":now.setHours(now.getHours()+num);break;case"min":now.setMinutes(now.getMinutes()+num);break;case"sec":now.setSeconds(now.getSeconds()+num);break}}else{return false}break}return true};match=strTmp.match(/^(\d{2,4}-\d{2}-\d{2})(?:\s(\d{1,2}:\d{2}(:\d{2})?)?(?:\.(\d+))?)?$/);if(match!=null){if(!match[2]){match[2]="00:00:00"}else{if(!match[3]){match[2]+=":00"}}s=match[1].split(/-/g);for(i in __is.mon){if(__is.mon[i]==s[1]-1){s[1]=i}}s[0]=parseInt(s[0],10);s[0]=(s[0]>=0&&s[0]<=69)?"20"+(s[0]<10?"0"+s[0]:s[0]+""):(s[0]>=70&&s[0]<=99)?"19"+s[0]:s[0]+"";return parseInt(this.strtotime(s[2]+" "+s[1]+" "+s[0]+" "+match[2])+(match[4]?match[4]/1000:""),10)}var regex="([+-]?\\d+\\s"+"(years?|months?|weeks?|days?|hours?|min|minutes?|sec|seconds?"+"|sun\\.?|sunday|mon\\.?|monday|tue\\.?|tuesday|wed\\.?|wednesday"+"|thu\\.?|thursday|fri\\.?|friday|sat\\.?|saturday)"+"|(last|next)\\s"+"(years?|months?|weeks?|days?|hours?|min|minutes?|sec|seconds?"+"|sun\\.?|sunday|mon\\.?|monday|tue\\.?|tuesday|wed\\.?|wednesday"+"|thu\\.?|thursday|fri\\.?|friday|sat\\.?|saturday))"+"(\\sago)?";match=strTmp.match(new RegExp(regex,"gi"));if(match==null){return false}for(i=0;i4&&j<21?"th":{1:"st",2:"nd",3:"rd"}[j%10]||"th"},w:function(){return jsdate.getDay()},z:function(){var a=new Date(f.Y(),f.n()-1,f.j()),b=new Date(f.Y(),0,1);return Math.round((a-b)/86400000)+1},W:function(){var a=new Date(f.Y(),f.n()-1,f.j()-f.N()+3),b=new Date(a.getFullYear(),0,4);
9 | return _pad(1+Math.round((a-b)/86400000/7),2)},F:function(){return txt_words[6+f.n()]},m:function(){return _pad(f.n(),2)},M:function(){return f.F().slice(0,3)},n:function(){return jsdate.getMonth()+1},t:function(){return(new Date(f.Y(),f.n(),0)).getDate()},L:function(){return new Date(f.Y(),1,29).getMonth()===1|0},o:function(){var n=f.n(),W=f.W(),Y=f.Y();return Y+(n===12&&W<9?-1:n===1&&W>9)},Y:function(){return jsdate.getFullYear()},y:function(){return(f.Y()+"").slice(-2)},a:function(){return jsdate.getHours()>11?"pm":"am"},A:function(){return f.a().toUpperCase()},B:function(){var H=jsdate.getUTCHours()*3600,i=jsdate.getUTCMinutes()*60,s=jsdate.getUTCSeconds();return _pad(Math.floor((H+i+s+3600)/86.4)%1000,3)},g:function(){return f.G()%12||12},G:function(){return jsdate.getHours()},h:function(){return _pad(f.g(),2)},H:function(){return _pad(f.G(),2)},i:function(){return _pad(jsdate.getMinutes(),2)},s:function(){return _pad(jsdate.getSeconds(),2)},u:function(){return _pad(jsdate.getMilliseconds()*1000,6)},e:function(){throw"Not supported (see source code of date() for timezone on how to add support)"},I:function(){var a=new Date(f.Y(),0),c=Date.UTC(f.Y(),0),b=new Date(f.Y(),6),d=Date.UTC(f.Y(),6);return 0+((a-c)!==(b-d))},O:function(){var tzo=jsdate.getTimezoneOffset(),a=Math.abs(tzo);return(tzo>0?"-":"+")+_pad(Math.floor(a/60)*100+a%60,4)},P:function(){var O=f.O();return(O.substr(0,3)+":"+O.substr(3,2))},T:function(){return"UTC"},Z:function(){return -jsdate.getTimezoneOffset()*60},c:function(){return"Y-m-d\\Th:i:sP".replace(formatChr,formatChrCb)},r:function(){return"D, d M Y H:i:s O".replace(formatChr,formatChrCb)},U:function(){return jsdate.getTime()/1000|0}};this.date=function(format,timestamp){that=this;jsdate=((typeof timestamp==="undefined")?new Date():(timestamp instanceof Date)?new Date(timestamp):new Date(timestamp*1000));return format.replace(formatChr,formatChrCb)};return this.date(format,timestamp)};phpjs.impload=function implode(glue,pieces){var i="",retVal="",tGlue="";if(arguments.length===1){pieces=glue;glue=""}if(typeof(pieces)==="object"){if(Object.prototype.toString.call(pieces)==="[object Array]"){return pieces.join(glue)}for(i in pieces){retVal+=tGlue+pieces[i];tGlue=glue}return retVal}return pieces};phpjs.expload=function explode(delimiter,string,limit){if(arguments.length<2||typeof delimiter=="undefined"||typeof string=="undefined"){return null}if(delimiter===""||delimiter===false||delimiter===null){return false}if(typeof delimiter=="function"||typeof delimiter=="object"||typeof string=="function"||typeof string=="object"){return{0:""}}if(delimiter===true){delimiter="1"}delimiter+="";string+="";var s=string.split(delimiter);if(typeof limit==="undefined"){return s}if(limit===0){limit=1}if(limit>0){if(limit>=s.length){return s}return s.slice(0,limit-1).concat([s.slice(limit-1).join(delimiter)])}if(-limit>=s.length){return[]}s.splice(s.length+limit);return s};phpjs.sprintf=function(){var regex=/%%|%(\d+\$)?([-+\'#0 ]*)(\*\d+\$|\*|\d+)?(\.(\*\d+\$|\*|\d+))?([scboxXuideEfFgG])/g;var a=arguments,i=0,format=a[i++];var pad=function(str,len,chr,leftJustify){if(!chr){chr=" "}var padding=(str.length>=len)?"":Array(1+len-str.length>>>0).join(chr);return leftJustify?str+padding:padding+str};var justify=function(value,prefix,leftJustify,minWidth,zeroPad,customPadChar){var diff=minWidth-value.length;if(diff>0){if(leftJustify||!zeroPad){value=pad(value,minWidth,customPadChar,leftJustify)}else{value=value.slice(0,prefix.length)+pad("",diff,"0",true)+value.slice(prefix.length)}}return value};var formatBaseX=function(value,base,prefix,leftJustify,minWidth,precision,zeroPad){var number=value>>>0;prefix=prefix&&number&&{"2":"0b","8":"0","16":"0x"}[base]||"";value=prefix+pad(number.toString(base),precision||0,"0",false);return justify(value,prefix,leftJustify,minWidth,zeroPad)};var formatString=function(value,leftJustify,minWidth,precision,zeroPad,customPadChar){if(precision!=null){value=value.slice(0,precision)}return justify(value,"",leftJustify,minWidth,zeroPad,customPadChar)};var doFormat=function(substring,valueIndex,flags,minWidth,_,precision,type){var number;var prefix;var method;var textTransform;var value;if(substring=="%%"){return"%"}var leftJustify=false,positivePrefix="",zeroPad=false,prefixBaseX=false,customPadChar=" ";var flagsl=flags.length;for(var j=0;flags&&j-1?6:(type=="d")?0:undefined}else{if(precision=="*"){precision=+a[i++]
10 | }else{if(precision.charAt(0)=="*"){precision=+a[precision.slice(1,-1)]}else{precision=+precision}}}value=valueIndex?a[valueIndex.slice(0,-1)]:a[i++];switch(type){case"s":return formatString(String(value),leftJustify,minWidth,precision,zeroPad,customPadChar);case"c":return formatString(String.fromCharCode(+value),leftJustify,minWidth,precision,zeroPad);case"b":return formatBaseX(value,2,prefixBaseX,leftJustify,minWidth,precision,zeroPad);case"o":return formatBaseX(value,8,prefixBaseX,leftJustify,minWidth,precision,zeroPad);case"x":return formatBaseX(value,16,prefixBaseX,leftJustify,minWidth,precision,zeroPad);case"X":return formatBaseX(value,16,prefixBaseX,leftJustify,minWidth,precision,zeroPad).toUpperCase();case"u":return formatBaseX(value,10,prefixBaseX,leftJustify,minWidth,precision,zeroPad);case"i":case"d":number=+value||0;number=Math.round(number-number%1);prefix=number<0?"-":positivePrefix;value=prefix+pad(String(Math.abs(number)),precision,"0",false);return justify(value,prefix,leftJustify,minWidth,zeroPad);case"e":case"E":case"f":case"F":case"g":case"G":number=+value;prefix=number<0?"-":positivePrefix;method=["toExponential","toFixed","toPrecision"]["efg".indexOf(type.toLowerCase())];textTransform=["toString","toUpperCase"]["eEfFgG".indexOf(type)%2];value=prefix+Math.abs(number)[method](precision);return justify(value,prefix,leftJustify,minWidth,zeroPad)[textTransform]();default:return substring}};return format.replace(regex,doFormat)};window.phpjs=phpjs}(window));
11 |
--------------------------------------------------------------------------------
/static/css/style_log.css:
--------------------------------------------------------------------------------
1 | @charset "utf-8";
2 | /*------------// Overall //------------------*/
3 | body{font:12px/180% Arial,Helvetica,Verdana;color:#5a5a5a; margin:0; background:#FFF;}
4 | body.login{ background:url(login_bgx.gif);}
5 | table,td{font:12px/180% Arial, "宋体",Helvetica, sans-serif,Verdana; color:#58595b;}
6 | table{border-collapse:collapse; border-spacing:0; empty-cells:show; }
7 | th, td { border-collapse:collapse; }
8 | A:link{text-decoration:none; color:#58595b;}
9 | A:visited{text-decoration:none; color:#58595b;}
10 | A:hover{text-decoration:none; color:#206fd5;}
11 | img{ border:0; }
12 | div,p,img,ul,li,form,input,label,span,dl,dt,dd,h1,h2,h3,h4,h5,h6{margin:0;padding:0;}
13 | input[type="reset"]::-moz-focus-inner, input[type="button"]::-moz-focus-inner, input[type="submit"]::-moz-focus-inner, input[type="file"] > input[type="button"]::-moz-focus-inner{ border:none;padding:0 }
14 | ol,ul,li{list-style-type:none;}
15 | .overz{ overflow:auto; zoom:1; overflow-x:hidden; overflow-y:hidden;}
16 | .dspn{ display:none;}
17 | a{blr:expression(this.onFocus=this.blur())} /*for IE*/
18 | a{outline:none;} /*for Firefox*/
19 | html{-webkit-text-size-adjust:none;}
20 | /*------------// layout //------------------*/
21 | #box{ width:100%; margin:0 auto;}
22 | .top_bg{ background:url(../images/main_bg.jpg) no-repeat center top; height:634px;}
23 | .top{ width:1000px; margin:0 auto;}
24 | .header{ padding-top:22px; height:46px;}
25 | #logo{ float:left;}
26 | #nav{ float:right; margin-right:24px; padding-top:12px;}
27 | #nav ul li{ float:left; width:55px; height:20px; margin-right:8px; line-height:20px; text-align:center; font-size:13px;}
28 | #nav ul li a{ display:block; color:#656565; height:20px;}
29 | #nav ul li a:hover{ background:url(../images/site_bg.png) no-repeat; color:#FFF;}
30 | #nav ul li.local a{background:url(../images/site_bg.png) no-repeat; color:#FFF; }
31 | .top_bg_c{ background:url(../images/top_bg.gif);}
32 | .main_area{ margin-top:45px;}
33 | .index_left{ width:520px; float:left; }
34 | .index_right{ width:412px; float:right; margin-right:26px; padding-top:23px;}
35 | .free_website_font{ padding-top:7px;}
36 | .free_website_font .title{ margin-bottom:12px;}
37 | .free_website_font .intro{ font-family:Tahoma; width:300px; margin-left:124px; line-height:24px; margin-bottom:20px;}
38 | .site_link{ padding-left:120px;}
39 | .site_link a{ display:block; }
40 | .site_link a.star_now{ background:url(../images/site_bg.png) no-repeat 0 -20px; height:92px; width:296px; margin-bottom:17px;}
41 | .site_link a.star_now:hover{ background-position:0 -112px; }
42 | .site_link a.templates{ background:url(../images/site_bg.png) no-repeat 0 -205px; height:88px; width:296px; margin-bottom:24px;}
43 | .site_link a.templates:hover{ background-position:0 -294px; }
44 | .system_description{ padding-left:124px; font-size:11px;}
45 | .system_description .sys_des_left{ float:left; }
46 | .system_description .sys_des_right{ float:right; text-align:right;}
47 | .system_description p{ margin-bottom:5px;}
48 | .main_web{ padding:27px 26px 0 26px; width:1000px; margin:0 auto;}
49 | .template_list_left{ float:left; width:842px; padding-left:5px;}
50 | .template_list_category{ float:right; width:115px;}
51 | .color_bar{ font-size:12px; height:20px; line-height:20px; margin-bottom:24px;}
52 | .color_bar h2{ float:left; font-size:12px; margin-right:5px;}
53 | .color_bar .color_link{ float:left;}
54 | .color_bar a{ display:inline-block; width:44px; float:left; text-align:center; margin-right:5px;}
55 | .color_bar a:hover{ background:url(../images/site_bg.png) no-repeat -55px 0; color:#FFF;}
56 | .color_bahover{background:url(../images/site_bg.png) no-repeat -55px 0; color:#FFF;}
57 | .template_list_element{ width:155px; height:155px; float:left; margin-right:55px; margin-bottom:26px;}
58 | .template_list_element a{ display:block; background:url(../images/site_bg.png) no-repeat 0 -541px; padding:5px;}
59 | .template_list_element a:hover{ background-position:0 -386px;}
60 | .template_list_category{ text-align:right;}
61 | .template_list_category h2{ color:#FFF; font-size:12px; background: url(../images/site_bg.png) no-repeat -155px -386px; height:26px; line-height:26px; padding-right:10px; margin-bottom:5px;}
62 | .template_list_category ul li{ height:26px; line-height:26px; }
63 | .template_list_category ul li a,.template_list_category ul li a:visited{ color:#7f7f7f;}
64 | .template_list_category ul li a:hover{color:#206fd5;background:url(../images/site_bg.png) no-repeat -155px -665px; }
65 | .template_list_category ul li a{ width:auto;display:block; height:26px; padding-right:3px;}
66 | .template_list_category ul li.local a{background: url(../images/site_bg.png) no-repeat -155px -386px; height:26px; line-height:26px; color:#FFF;}
67 | .template_list_category ul li.local a:visited{color:#FFF;}
68 | .page_s{ text-align:center; clear:both; height:19px; margin-bottom:40px; margin-right:45px;}
69 | .page_s a{ display:inline-block; background:url(../images/site_bg.png) no-repeat -118px 0; width:19px; height:19px; }
70 | .page_s a.local{background:url(../images/site_bg.png) no-repeat -99px 0;}
71 | .footer{ clear:both; height:150px;}
72 | .f_left{ float:left; font-size:10px;}
73 | .f_left .copyright{ text-transform:uppercase; margin-bottom:3px;}
74 | .language_bar,.follow_icon,.facebook_icon{ float:left;}
75 | .follow_icon,.facebook_icon{ padding-top:2px;}
76 | .follow_icon{ margin-right:8px;}
77 | .follow_icon a{ display:block; width:60px; height:20px; background:url(../images/site_bg.png) no-repeat -155px -461px; }
78 | .facebook_icon a{ display:block; width:81px; height:20px; background:url(../images/site_bg.png) no-repeat -155px -441px; }
79 | .language_bar{ width:80px; margin-right:5px;}
80 | .f_link_language a.login-in{ background: url("../images/site_bg.png") no-repeat scroll -168px 0 transparent; display: block; float: left; height: 19px;line-height: 18px; margin-right: 5px;margin-top: 2px;text-indent: 18px;width: 63px;}
81 | .f_link_language a.login-in,.f_link_language a.login-in:visited{ color:#FFFFFF;}
82 | .f_link_language a.login-in:hover{ color:#FFF; background-position:-231px 0;}
83 | .lang_bar_m{ background:url(../images/site_bg.png) no-repeat -156px -413px; width:80px; height:27px; z-index:100; position:absolute; overflow:hidden;}
84 | .lang_bar_m div{ width:57px; text-align:center; float:left; margin-left:4px; }
85 | .lang_bar_m a{ display:block; width:15px; height:19px; margin:2px 4px 0 0; _margin:0; margin-top:2px; overflow:hidden; float:right; background:url(../images/site_bg.png) no-repeat -151px 0;}
86 | .lang_drop_down{ position:relative; height:107px;}
87 | .lang_d_d_hidden{ background:url(../images/second_language.png) no-repeat; height:82px; margin-top:0px; padding-top:25px; }
88 | .lang_drop_down a{ display:block; text-align:center; width:70px; margin:0 auto; height:20px; line-height:20px; margin-bottom:5px; font-size:12px; overflow:hidden;}
89 | .lang_drop_down a:hover{ background:#68a1ea; color:#FFF;}
90 |
91 |
92 | .f_right{ float:right; text-align:right; font-size:10px; text-transform:uppercase; color:#afafaf;}
93 | /*------------// About //------------------*/
94 | #about_content{ background:url(../images/about_bg.png) right top no-repeat; }
95 | .about_top h2{ margin-bottom:10px;}
96 | .about_top_intro{ width:608px; font-size:15px; line-height:170%; text-align:justify;text-justify:inter-ideograph; margin-bottom:32px;}
97 | .about_top h3{ margin-bottom:46px;}
98 | .about_c{ text-align:justify;text-justify:inter-ideograph;}
99 | #contact_content{}
100 | #contact_content h2{ margin-bottom:32px;}
101 | .contact_left{ float:left; width:326px; padding-top:20px;}
102 | .contact_right{ float:right; width:448px;}
103 | .contact_font{ font-size:13px; line-height:200%; margin-bottom:30px;}
104 | .contact_font span{ color:#2f7ad9;}
105 | .contact_icon a{ display: inline-block; width:45px; height:45px; margin-right:15px;}
106 | .contact_icon a.fackbook{ background:url(../images/site_bg.png) no-repeat -155px -481px; }
107 | .contact_icon a.fackbook:hover{ background:url(../images/site_bg.png) no-repeat -200px -481px; }
108 | .contact_icon a.twitter{ background:url(../images/site_bg.png) no-repeat -155px -526px; }
109 | .contact_icon a.twitter:hover{ background:url(../images/site_bg.png) no-repeat -200px -526px; }
110 | .contact_icon a.google{ background:url(../images/site_bg.png) no-repeat -155px -571px; }
111 | .contact_icon a.google:hover{ background:url(../images/site_bg.png) no-repeat -200px -571px; }
112 | .contact_icon a.mail{ background:url(../images/site_bg.png) no-repeat -155px -616px; }
113 | .contact_icon a.mail:hover{ background:url(../images/site_bg.png) no-repeat -200px -616px; }
114 | .contact_right h4{ font-size:13px; font-weight:normal; margin-bottom:5px; }
115 | .contact_right input.txt_input{ border:1px solid #bbb; background:url(../images/site_bg.png) 0 -696px repeat-x; height:32px; margin-bottom:5px; width:359px; line-height:32px; padding:0 5px; -moz-border-radius:5px; -webkit-border-radius:5px; border-radius:5px; }
116 | .contact_right input.txt_input:focus{ transition:border linear .2s,box-shadow linear .2s; -moz-transition:border linear .2s,-moz-box-shadow linear .2s; -webkit-transition:border linear .2s,-webkit-box-shadow linear .2s; outline:none;border-color:rgba(173,173,173.75); box-shadow:0 0 8px rgba(173,173,173,.5); -moz-box-shadow:0 0 8px rgba(173,173,173,.5); -webkit-box-shadow:0 0 8px rgba(173,173,173,3); border:1px solid #7cccec;}
117 | .contact_right textarea.text_area{ border:1px solid #bbb; background:url(../images/site_bg.png) 0 -728px repeat-x; height:112px; overflow:auto; margin-bottom:10px; line-height:32px; width:429px; padding:5px; -moz-border-radius:5px; -webkit-border-radius:5px; border-radius:5px; }
118 | .contact_right textarea.text_area:focus{ transition:border linear .2s,box-shadow linear .2s; -moz-transition:border linear .2s,-moz-box-shadow linear .2s; -webkit-transition:border linear .2s,-webkit-box-shadow linear .2s; outline:none;border-color:rgba(173,173,173.75); box-shadow:0 0 8px rgba(173,173,173,.5); -moz-box-shadow:0 0 8px rgba(173,173,173,.5); -webkit-box-shadow:0 0 8px rgba(173,173,173,3); border:1px solid #7cccec;}
119 | .contact_right input.sub_mit{ width:150px; height:29px; border:none; background:url(../images/site_bg.png) 0 -850px no-repeat; }
120 | .contact_right input.sub_mit:hover{ background:url(../images/site_bg.png) 0 -879px no-repeat; cursor:pointer;}
121 | /*--login--*/
122 | .login_m{ width:403px; margin:0 auto; height:375px; margin-top:98px; /*position: absolute;left:50%;top:50%;margin-left:-202px;margin-top:-188px;*/}
123 | .login_logo{ text-align:center; margin-bottom:25px;}
124 | .login_boder{ background: url(login_m_bg.png) no-repeat; height:302px; overflow:hidden;}
125 | .login_padding{ padding:28px 47px 20px 47px ;}
126 | .login_boder h2{ color:#4f5d80; text-transform:uppercase; font-size:12px; font-weight:normal; margin-bottom:11px;}
127 | .forget_model_h2{color:#4f5d80; font-size:12px; font-weight:normal; margin-bottom:11px;}
128 |
129 | .login_boder input.txt_input{ width:295px; height:36px; border:1px solid #cad2db; padding:0 5px; -moz-border-radius:5px; -webkit-border-radius:5px; border-radius:5px; line-height:36px; margin-bottom:10px; font-size:14px; color:#717171; font-family:Arial;}
130 | .login_boder input.txt_input2{ margin-bottom:20px;}
131 | .login_boder input.txt_input:focus{ transition:border linear .2s,box-shadow linear .2s; -moz-transition:border linear .2s,-moz-box-shadow linear .2s; -webkit-transition:border linear .2s,-webkit-box-shadow linear .2s; outline:none;border-color:rgba(173,173,173.75); box-shadow:0 0 8px rgba(173,173,173,.5); -moz-box-shadow:0 0 8px rgba(173,173,173,.5); -webkit-box-shadow:0 0 8px rgba(173,173,173,3); border:1px solid #6192c8;}
132 | .login_boder p.forgot{ font-size:11px; text-align:right; margin-bottom:15px;}
133 | .login_boder p.forgot a,.login_boder p.forgot a:visited{color:#8c8e91;}
134 | .login_boder p.forgot a:hover{color:#206fd5;}
135 | .rem_sub input.sub_button{ float:right; width:122px; height:32px; background:url(site_bg.png) no-repeat -153px -850px; border:none; color:#FFF; padding-bottom:2px; font-size:14px; font-weight:bold;}
136 |
137 | .rem_sub input.sub_buttons{ float:left; width:122px; height:32px; background:url(site_bg.png) no-repeat -153px -850px; border:none; color:#FFF; padding-bottom:2px; font-size:14px; font-weight:bold;}
138 | .rem_sub input.sub_buttons:hover{ background-position:-153px -882px; cursor:pointer;}
139 |
140 | .rem_sub input.sub_button:hover{ background-position:-153px -882px; cursor:pointer;}
141 | .rem_sub .rem_sub_l{ float:left; font-size:12px; height:33px; line-height:33px;}
142 | .rem_sub input#checkbox{ margin-right:5px; vertical-align:middle;}
143 | /*dali*/
144 | .focusBox{height:513px;}
145 | .focusContentBox{height:100%}
146 | .focusContent{width:1000px;float:left}
147 |
--------------------------------------------------------------------------------