├── .gitattributes ├── doc ├── img │ ├── role.png │ ├── user.png │ ├── adduser.png │ ├── usergroup.png │ └── addusergroup.png └── database.sql ├── icon └── favicon.ico ├── static ├── css │ ├── askgreen.png │ ├── errorred.png │ ├── loading1.gif │ ├── okgreen.png │ ├── site_bg.png │ ├── loadingpn.gif │ ├── login_bgx.gif │ ├── login_m_bg.png │ ├── zTreeStyle │ │ ├── img │ │ │ ├── diy │ │ │ │ ├── 2.png │ │ │ │ ├── 3.png │ │ │ │ ├── 4.png │ │ │ │ ├── 5.png │ │ │ │ ├── 6.png │ │ │ │ ├── 7.png │ │ │ │ ├── 8.png │ │ │ │ ├── 9.png │ │ │ │ ├── 1_open.png │ │ │ │ └── 1_close.png │ │ │ ├── loading.gif │ │ │ ├── line_conn.gif │ │ │ ├── zTreeStandard.gif │ │ │ └── zTreeStandard.png │ │ └── zTreeStyle.css │ ├── demo.css │ ├── pagination.css │ └── style_log.css ├── images │ └── logo.png └── js │ ├── themes │ ├── icons │ │ ├── cut.png │ │ ├── man.png │ │ ├── no.png │ │ ├── ok.png │ │ ├── sum.png │ │ ├── tip.png │ │ ├── back.png │ │ ├── blank.gif │ │ ├── cancel.png │ │ ├── clear.png │ │ ├── filter.png │ │ ├── help.png │ │ ├── home.png │ │ ├── lock.png │ │ ├── more.png │ │ ├── pencil.png │ │ ├── print.png │ │ ├── redo.png │ │ ├── reload.png │ │ ├── search.png │ │ ├── undo.png │ │ ├── edit_add.png │ │ ├── filesave.png │ │ ├── home-bak.png │ │ ├── mini_add.png │ │ ├── edit_remove.png │ │ ├── icon-police.png │ │ ├── large_chart.png │ │ ├── mini_edit.png │ │ ├── large_clipart.png │ │ ├── large_picture.png │ │ ├── large_shapes.png │ │ ├── mini_refresh.png │ │ └── large_smartart.png │ ├── default │ │ └── images │ │ │ ├── blank.gif │ │ │ ├── loading.gif │ │ │ ├── combo_arrow.png │ │ │ ├── menu_arrows.png │ │ │ ├── panel_tools.png │ │ │ ├── tabs_icons.png │ │ │ ├── tree_icons.png │ │ │ ├── datagrid_icons.png │ │ │ ├── datebox_arrow.png │ │ │ ├── layout_arrows.png │ │ │ ├── linkbutton_bg.png │ │ │ ├── messager_icons.png │ │ │ ├── slider_handle.png │ │ │ ├── spinner_arrows.png │ │ │ ├── accordion_arrows.png │ │ │ ├── calendar_arrows.png │ │ │ ├── pagination_icons.png │ │ │ ├── searchbox_button.png │ │ │ └── validatebox_warning.png │ ├── icon.css │ └── color.css │ ├── demo │ └── demo.css │ ├── common │ └── leftMenu.js │ ├── role │ ├── addRole.js │ ├── modifyRole.js │ └── roleList.js │ ├── index.js │ ├── admusergroup │ ├── addadmusergroup.js │ ├── modifyadmusergroup.js │ └── admUserGroupList.js │ ├── locale │ └── easyui-lang-zh_CN.js │ ├── admUser │ ├── addadmuser.js │ ├── modifyAdmuser.js │ └── admUserList.js │ ├── jquery │ └── jquery.ztree.excheck.min.js │ └── phpjs-min.js ├── .gitignore ├── src ├── common │ ├── constant.go │ ├── bizError.go │ ├── util.go │ ├── page.go │ ├── timeUtil.go │ └── encode.go ├── model │ ├── userGroupRel.go │ ├── groupRoleRel.go │ ├── admuser.go │ ├── role.go │ └── admUserGroup.go ├── controllers │ ├── mainController.go │ ├── loginController.go │ ├── roleController.go │ ├── admuserGroupController.go │ ├── baseController.go │ └── admuserController.go ├── routers │ └── router.go └── service │ ├── initService.go │ ├── admuserGroupService.go │ ├── roleService.go │ └── admuserService.go ├── views ├── common │ ├── footer.html │ ├── leftMenu.html │ ├── header.html │ ├── welcome.html │ ├── navbar.html │ └── loginPage.html ├── role │ ├── addRoleDir.html │ ├── addRole.html │ ├── modifyRole.html │ └── roleList.html ├── admusergroup │ ├── admUserGroupList.html │ ├── addAdmusergroup.html │ └── modifyAdmusergroup.html ├── admUser │ ├── admUserList.html │ ├── addAdmUser.html │ └── modifyAdmUser.html └── index.html ├── pack.bat ├── pack.sh ├── main.go ├── generateRoleSql.go ├── conf └── app.conf ├── nginx.conf └── readme.md /.gitattributes: -------------------------------------------------------------------------------- 1 | *.js linguist-language=go 2 | *.css linguist-language=go 3 | -------------------------------------------------------------------------------- /doc/img/role.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/akkagao/cms/HEAD/doc/img/role.png -------------------------------------------------------------------------------- /doc/img/user.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/akkagao/cms/HEAD/doc/img/user.png -------------------------------------------------------------------------------- /icon/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/akkagao/cms/HEAD/icon/favicon.ico -------------------------------------------------------------------------------- /doc/img/adduser.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/akkagao/cms/HEAD/doc/img/adduser.png -------------------------------------------------------------------------------- /doc/img/usergroup.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/akkagao/cms/HEAD/doc/img/usergroup.png -------------------------------------------------------------------------------- /static/css/askgreen.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/akkagao/cms/HEAD/static/css/askgreen.png -------------------------------------------------------------------------------- /static/css/errorred.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/akkagao/cms/HEAD/static/css/errorred.png -------------------------------------------------------------------------------- /static/css/loading1.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/akkagao/cms/HEAD/static/css/loading1.gif -------------------------------------------------------------------------------- /static/css/okgreen.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/akkagao/cms/HEAD/static/css/okgreen.png -------------------------------------------------------------------------------- /static/css/site_bg.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/akkagao/cms/HEAD/static/css/site_bg.png -------------------------------------------------------------------------------- /static/images/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/akkagao/cms/HEAD/static/images/logo.png -------------------------------------------------------------------------------- /doc/img/addusergroup.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/akkagao/cms/HEAD/doc/img/addusergroup.png -------------------------------------------------------------------------------- /static/css/loadingpn.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/akkagao/cms/HEAD/static/css/loadingpn.gif -------------------------------------------------------------------------------- /static/css/login_bgx.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/akkagao/cms/HEAD/static/css/login_bgx.gif -------------------------------------------------------------------------------- /static/css/login_m_bg.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/akkagao/cms/HEAD/static/css/login_m_bg.png -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | /bin 2 | -x 3 | *.exe 4 | *.exe~ 5 | *.log 6 | debug 7 | /.vscode 8 | /.idea 9 | *.tar.gz -------------------------------------------------------------------------------- /static/js/themes/icons/cut.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/akkagao/cms/HEAD/static/js/themes/icons/cut.png -------------------------------------------------------------------------------- /static/js/themes/icons/man.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/akkagao/cms/HEAD/static/js/themes/icons/man.png -------------------------------------------------------------------------------- /static/js/themes/icons/no.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/akkagao/cms/HEAD/static/js/themes/icons/no.png -------------------------------------------------------------------------------- /static/js/themes/icons/ok.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/akkagao/cms/HEAD/static/js/themes/icons/ok.png -------------------------------------------------------------------------------- /static/js/themes/icons/sum.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/akkagao/cms/HEAD/static/js/themes/icons/sum.png -------------------------------------------------------------------------------- /static/js/themes/icons/tip.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/akkagao/cms/HEAD/static/js/themes/icons/tip.png -------------------------------------------------------------------------------- /static/js/themes/icons/back.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/akkagao/cms/HEAD/static/js/themes/icons/back.png -------------------------------------------------------------------------------- /static/js/themes/icons/blank.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/akkagao/cms/HEAD/static/js/themes/icons/blank.gif -------------------------------------------------------------------------------- /static/js/themes/icons/cancel.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/akkagao/cms/HEAD/static/js/themes/icons/cancel.png -------------------------------------------------------------------------------- /static/js/themes/icons/clear.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/akkagao/cms/HEAD/static/js/themes/icons/clear.png -------------------------------------------------------------------------------- /static/js/themes/icons/filter.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/akkagao/cms/HEAD/static/js/themes/icons/filter.png -------------------------------------------------------------------------------- /static/js/themes/icons/help.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/akkagao/cms/HEAD/static/js/themes/icons/help.png -------------------------------------------------------------------------------- /static/js/themes/icons/home.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/akkagao/cms/HEAD/static/js/themes/icons/home.png -------------------------------------------------------------------------------- /static/js/themes/icons/lock.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/akkagao/cms/HEAD/static/js/themes/icons/lock.png -------------------------------------------------------------------------------- /static/js/themes/icons/more.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/akkagao/cms/HEAD/static/js/themes/icons/more.png -------------------------------------------------------------------------------- /static/js/themes/icons/pencil.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/akkagao/cms/HEAD/static/js/themes/icons/pencil.png -------------------------------------------------------------------------------- /static/js/themes/icons/print.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/akkagao/cms/HEAD/static/js/themes/icons/print.png -------------------------------------------------------------------------------- /static/js/themes/icons/redo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/akkagao/cms/HEAD/static/js/themes/icons/redo.png -------------------------------------------------------------------------------- /static/js/themes/icons/reload.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/akkagao/cms/HEAD/static/js/themes/icons/reload.png -------------------------------------------------------------------------------- /static/js/themes/icons/search.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/akkagao/cms/HEAD/static/js/themes/icons/search.png -------------------------------------------------------------------------------- /static/js/themes/icons/undo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/akkagao/cms/HEAD/static/js/themes/icons/undo.png -------------------------------------------------------------------------------- /static/css/zTreeStyle/img/diy/2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/akkagao/cms/HEAD/static/css/zTreeStyle/img/diy/2.png -------------------------------------------------------------------------------- /static/css/zTreeStyle/img/diy/3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/akkagao/cms/HEAD/static/css/zTreeStyle/img/diy/3.png -------------------------------------------------------------------------------- /static/css/zTreeStyle/img/diy/4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/akkagao/cms/HEAD/static/css/zTreeStyle/img/diy/4.png -------------------------------------------------------------------------------- /static/css/zTreeStyle/img/diy/5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/akkagao/cms/HEAD/static/css/zTreeStyle/img/diy/5.png -------------------------------------------------------------------------------- /static/css/zTreeStyle/img/diy/6.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/akkagao/cms/HEAD/static/css/zTreeStyle/img/diy/6.png -------------------------------------------------------------------------------- /static/css/zTreeStyle/img/diy/7.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/akkagao/cms/HEAD/static/css/zTreeStyle/img/diy/7.png -------------------------------------------------------------------------------- /static/css/zTreeStyle/img/diy/8.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/akkagao/cms/HEAD/static/css/zTreeStyle/img/diy/8.png -------------------------------------------------------------------------------- /static/css/zTreeStyle/img/diy/9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/akkagao/cms/HEAD/static/css/zTreeStyle/img/diy/9.png -------------------------------------------------------------------------------- /static/js/themes/icons/edit_add.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/akkagao/cms/HEAD/static/js/themes/icons/edit_add.png -------------------------------------------------------------------------------- /static/js/themes/icons/filesave.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/akkagao/cms/HEAD/static/js/themes/icons/filesave.png -------------------------------------------------------------------------------- /static/js/themes/icons/home-bak.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/akkagao/cms/HEAD/static/js/themes/icons/home-bak.png -------------------------------------------------------------------------------- /static/js/themes/icons/mini_add.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/akkagao/cms/HEAD/static/js/themes/icons/mini_add.png -------------------------------------------------------------------------------- /static/css/zTreeStyle/img/loading.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/akkagao/cms/HEAD/static/css/zTreeStyle/img/loading.gif -------------------------------------------------------------------------------- /static/js/themes/icons/edit_remove.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/akkagao/cms/HEAD/static/js/themes/icons/edit_remove.png -------------------------------------------------------------------------------- /static/js/themes/icons/icon-police.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/akkagao/cms/HEAD/static/js/themes/icons/icon-police.png -------------------------------------------------------------------------------- /static/js/themes/icons/large_chart.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/akkagao/cms/HEAD/static/js/themes/icons/large_chart.png -------------------------------------------------------------------------------- /static/js/themes/icons/mini_edit.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/akkagao/cms/HEAD/static/js/themes/icons/mini_edit.png -------------------------------------------------------------------------------- /src/common/constant.go: -------------------------------------------------------------------------------- 1 | package common 2 | /** 3 | 公共常量 4 | */ 5 | const ( 6 | // 用于分页查询 7 | LIMIT = " limit ?,? " 8 | ) 9 | -------------------------------------------------------------------------------- /static/css/zTreeStyle/img/diy/1_open.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/akkagao/cms/HEAD/static/css/zTreeStyle/img/diy/1_open.png -------------------------------------------------------------------------------- /static/css/zTreeStyle/img/line_conn.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/akkagao/cms/HEAD/static/css/zTreeStyle/img/line_conn.gif -------------------------------------------------------------------------------- /static/js/themes/icons/large_clipart.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/akkagao/cms/HEAD/static/js/themes/icons/large_clipart.png -------------------------------------------------------------------------------- /static/js/themes/icons/large_picture.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/akkagao/cms/HEAD/static/js/themes/icons/large_picture.png -------------------------------------------------------------------------------- /static/js/themes/icons/large_shapes.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/akkagao/cms/HEAD/static/js/themes/icons/large_shapes.png -------------------------------------------------------------------------------- /static/js/themes/icons/mini_refresh.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/akkagao/cms/HEAD/static/js/themes/icons/mini_refresh.png -------------------------------------------------------------------------------- /static/css/zTreeStyle/img/diy/1_close.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/akkagao/cms/HEAD/static/css/zTreeStyle/img/diy/1_close.png -------------------------------------------------------------------------------- /static/css/zTreeStyle/img/zTreeStandard.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/akkagao/cms/HEAD/static/css/zTreeStyle/img/zTreeStandard.gif -------------------------------------------------------------------------------- /static/css/zTreeStyle/img/zTreeStandard.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/akkagao/cms/HEAD/static/css/zTreeStyle/img/zTreeStandard.png -------------------------------------------------------------------------------- /static/js/themes/default/images/blank.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/akkagao/cms/HEAD/static/js/themes/default/images/blank.gif -------------------------------------------------------------------------------- /static/js/themes/default/images/loading.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/akkagao/cms/HEAD/static/js/themes/default/images/loading.gif -------------------------------------------------------------------------------- /static/js/themes/icons/large_smartart.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/akkagao/cms/HEAD/static/js/themes/icons/large_smartart.png -------------------------------------------------------------------------------- /static/js/themes/default/images/combo_arrow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/akkagao/cms/HEAD/static/js/themes/default/images/combo_arrow.png -------------------------------------------------------------------------------- /static/js/themes/default/images/menu_arrows.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/akkagao/cms/HEAD/static/js/themes/default/images/menu_arrows.png -------------------------------------------------------------------------------- /static/js/themes/default/images/panel_tools.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/akkagao/cms/HEAD/static/js/themes/default/images/panel_tools.png -------------------------------------------------------------------------------- /static/js/themes/default/images/tabs_icons.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/akkagao/cms/HEAD/static/js/themes/default/images/tabs_icons.png -------------------------------------------------------------------------------- /static/js/themes/default/images/tree_icons.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/akkagao/cms/HEAD/static/js/themes/default/images/tree_icons.png -------------------------------------------------------------------------------- /static/js/themes/default/images/datagrid_icons.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/akkagao/cms/HEAD/static/js/themes/default/images/datagrid_icons.png -------------------------------------------------------------------------------- /static/js/themes/default/images/datebox_arrow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/akkagao/cms/HEAD/static/js/themes/default/images/datebox_arrow.png -------------------------------------------------------------------------------- /static/js/themes/default/images/layout_arrows.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/akkagao/cms/HEAD/static/js/themes/default/images/layout_arrows.png -------------------------------------------------------------------------------- /static/js/themes/default/images/linkbutton_bg.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/akkagao/cms/HEAD/static/js/themes/default/images/linkbutton_bg.png -------------------------------------------------------------------------------- /static/js/themes/default/images/messager_icons.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/akkagao/cms/HEAD/static/js/themes/default/images/messager_icons.png -------------------------------------------------------------------------------- /static/js/themes/default/images/slider_handle.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/akkagao/cms/HEAD/static/js/themes/default/images/slider_handle.png -------------------------------------------------------------------------------- /static/js/themes/default/images/spinner_arrows.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/akkagao/cms/HEAD/static/js/themes/default/images/spinner_arrows.png -------------------------------------------------------------------------------- /static/js/themes/default/images/accordion_arrows.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/akkagao/cms/HEAD/static/js/themes/default/images/accordion_arrows.png -------------------------------------------------------------------------------- /static/js/themes/default/images/calendar_arrows.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/akkagao/cms/HEAD/static/js/themes/default/images/calendar_arrows.png -------------------------------------------------------------------------------- /static/js/themes/default/images/pagination_icons.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/akkagao/cms/HEAD/static/js/themes/default/images/pagination_icons.png -------------------------------------------------------------------------------- /static/js/themes/default/images/searchbox_button.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/akkagao/cms/HEAD/static/js/themes/default/images/searchbox_button.png -------------------------------------------------------------------------------- /static/js/themes/default/images/validatebox_warning.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/akkagao/cms/HEAD/static/js/themes/default/images/validatebox_warning.png -------------------------------------------------------------------------------- /src/common/bizError.go: -------------------------------------------------------------------------------- 1 | package common 2 | 3 | type BizError struct { 4 | Mesage string 5 | } 6 | 7 | func (e *BizError) Error() string { 8 | return e.Mesage 9 | } 10 | -------------------------------------------------------------------------------- /src/model/userGroupRel.go: -------------------------------------------------------------------------------- 1 | package model 2 | 3 | type UserGroupRel struct { 4 | Id int64 5 | Userid int64 6 | Groupid int64 7 | Isdel int8 `orm:"default(1)"` 8 | } 9 | -------------------------------------------------------------------------------- /views/common/footer.html: -------------------------------------------------------------------------------- 1 |
2 |
3 |

4 | 一旦删除将不可恢复,你确定吗? 5 |

6 |
7 | -------------------------------------------------------------------------------- /pack.bat: -------------------------------------------------------------------------------- 1 | 2 | echo "开始打包$tarfile..." 3 | 4 | set GOARCH=amd64 5 | set GOOS=linux 6 | 7 | bee pack -exs="pack.sh:pack:bat:nginx.conf" -exr=data 8 | 9 | ren cms.tar.gz cms-v1.0.tar.gz 10 | -------------------------------------------------------------------------------- /src/model/groupRoleRel.go: -------------------------------------------------------------------------------- 1 | package model 2 | 3 | type GroupRoleRel struct { 4 | Id int64 `json:"id"` 5 | Groupid int64 `json:"groupid"` 6 | Roleid int64 `json:"roleid"` 7 | Isdel int8 `json:"isdel",orm:"default(1)"` 8 | } 9 | -------------------------------------------------------------------------------- /pack.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | tarfile="cms-v1.0.tar.gz" 4 | 5 | echo "开始打包$tarfile..." 6 | 7 | export GOARCH=amd64 8 | export GOOS=linux 9 | 10 | bee pack -exs="pack.sh:pack:bat:nginx.conf" -exr=data 11 | 12 | mv cms.tar.gz $tarfile 13 | -------------------------------------------------------------------------------- /views/common/leftMenu.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 |
5 | 6 |
7 | 8 | 9 | -------------------------------------------------------------------------------- /main.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "github.com/astaxie/beego" 5 | 6 | _ "cms/src/routers" 7 | _ "cms/src/service" 8 | ) 9 | 10 | func main() { 11 | beego.SetLevel(beego.LevelDebug) 12 | beego.SetLogger("console", "") 13 | beego.Run() 14 | } 15 | -------------------------------------------------------------------------------- /static/js/demo/demo.css: -------------------------------------------------------------------------------- 1 | body { 2 | font-family:verdana,helvetica,arial,sans-serif; 3 | padding:20px; 4 | font-size:12px; 5 | margin:0; 6 | } 7 | h2 { 8 | font-size:18px; 9 | font-weight:bold; 10 | margin:0; 11 | margin-bottom:15px; 12 | } 13 | .demo-info{ 14 | padding:0 0 12px 0; 15 | } 16 | .demo-tip{ 17 | display:none; 18 | } 19 | -------------------------------------------------------------------------------- /src/common/util.go: -------------------------------------------------------------------------------- 1 | package common 2 | 3 | //截取字符串 start 起点下标 end 终点下标(不包括) 4 | func Substr(str string, start int, end int) string { 5 | rs := []rune(str) 6 | length := len(rs) 7 | 8 | if start < 0 || start > length { 9 | panic("start is wrong") 10 | } 11 | 12 | if end < 0 || end > length { 13 | panic("end is wrong") 14 | } 15 | 16 | return string(rs[start:end]) 17 | } 18 | -------------------------------------------------------------------------------- /src/common/page.go: -------------------------------------------------------------------------------- 1 | package common 2 | 3 | type Pager struct { 4 | page int 5 | rows int 6 | begin int 7 | } 8 | 9 | func NewPager(pageNum int, rowsNum int) *Pager { 10 | p := &Pager{page: pageNum, rows: rowsNum} 11 | p.begin = (pageNum - 1) * rowsNum 12 | return p 13 | } 14 | func (this *Pager) GetBegin() int { 15 | return this.begin 16 | } 17 | 18 | func (this *Pager) GetLen() int { 19 | return this.rows 20 | } 21 | -------------------------------------------------------------------------------- /static/js/common/leftMenu.js: -------------------------------------------------------------------------------- 1 | 2 | var leftMenuSetting = { 3 | data: { 4 | simpleData: { 5 | enable: true 6 | } 7 | } 8 | // , 9 | // callback: { 10 | // onClick: zTreeOnClick 11 | // } 12 | }; 13 | 14 | 15 | 16 | // 初始化左边菜单tree 17 | $(document).ready(loadTree()); 18 | function loadTree() { 19 | url = "/loadMenu" 20 | var data; 21 | $.post(url, data, function (result) { 22 | // zNodes = result 23 | $.fn.zTree.init($("#leftMenuTree"), leftMenuSetting, result); 24 | }); 25 | } -------------------------------------------------------------------------------- /views/common/header.html: -------------------------------------------------------------------------------- 1 | 16 |
17 |
18 |

欢迎:{{.user.Name}}

19 | 退出 20 |
21 |
22 |

XXX 管理系统

23 |
24 |
-------------------------------------------------------------------------------- /src/common/timeUtil.go: -------------------------------------------------------------------------------- 1 | package common 2 | 3 | import ( 4 | "fmt" 5 | "time" 6 | ) 7 | 8 | type DateTime time.Time 9 | 10 | func (t DateTime) MarshalJSON() ([]byte, error) { 11 | //do your serializing here 12 | stamp := fmt.Sprintf("\"%s\"", t.ToLocal()) 13 | return []byte(stamp), nil 14 | } 15 | func (t DateTime) ToLocal() string { 16 | return time.Time(t).Format("2006-01-02 15:04:05") 17 | } 18 | 19 | func (t DateTime) ToLocalDate() string { 20 | return time.Time(t).Format("2006-01-02") 21 | } 22 | 23 | func (t DateTime) ToLocalTime() string { 24 | return time.Time(t).Format("15:04:05") 25 | } 26 | -------------------------------------------------------------------------------- /src/model/admuser.go: -------------------------------------------------------------------------------- 1 | package model 2 | 3 | import "time" 4 | 5 | type Admuser struct { 6 | Id int64 `json:"id"` 7 | Accout string `json:"accout",orm:"unique"` 8 | Mail string `json:"mail"` 9 | Name string `json:"name"` 10 | Phone string `json:"phone"` 11 | Department string `json:"department"` 12 | Password string `json:"password"` 13 | Createtime time.Time `json:"createtime",orm:"auto_now_add;type(datetime)"` 14 | Updatetime time.Time `json:"updatetime",orm:"auto_now;type(datetime)"` // 更新时间 15 | Isdel int8 `json:"isdel",orm:"default(1)"` 16 | } 17 | -------------------------------------------------------------------------------- /src/model/role.go: -------------------------------------------------------------------------------- 1 | package model 2 | 3 | type Role struct { 4 | Id int64 `json:"id"` 5 | Pid int64 `json:"pid"` 6 | Name string `json:"name"` 7 | Module string `json:"module",orm:"size(50)"` 8 | Action string `json:"action",orm:"size(50)"` 9 | Roleurl string `json:"roleurl"` 10 | Ismenu int8 `json:"ismenu"` 11 | Des string `json:"describe"` 12 | } 13 | 14 | type RoleTree struct { 15 | Id int64 `json:"id"` 16 | Pid int64 `json:"pId"` 17 | Name string `json:"name"` 18 | Open bool `json:"open"` 19 | Checked bool `json:"checked"` 20 | Roleurl string `json:"roleurl"` 21 | Click string `json:"click"` 22 | } 23 | -------------------------------------------------------------------------------- /generateRoleSql.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "cms/src/controllers" 5 | "fmt" 6 | 7 | "reflect" 8 | ) 9 | 10 | func main1() { 11 | baseController := new(controllers.BaseController) 12 | typ := reflect.TypeOf(baseController) 13 | baseMethod := make(map[string]bool, typ.NumMethod()) 14 | for i := 0; i < typ.NumMethod(); i++ { 15 | baseMethod[typ.Method(i).Name] = true 16 | } 17 | 18 | controller := new(controllers.MainController) 19 | controllerType := reflect.TypeOf(controller) 20 | 21 | for i := 0; i < controllerType.NumMethod(); i++ { 22 | methodName := controllerType.Method(i).Name 23 | if _, ok := baseMethod[methodName]; !ok { 24 | fmt.Println(methodName) 25 | } 26 | } 27 | 28 | } 29 | -------------------------------------------------------------------------------- /src/model/admUserGroup.go: -------------------------------------------------------------------------------- 1 | package model 2 | 3 | import "time" 4 | 5 | type Admusergroup struct { 6 | Id int64 `json:"id"` 7 | Groupname string `json:"groupname"` 8 | Des string `json:"describe"` 9 | Createtime time.Time `json:"createtime",orm:"auto_now_add;type(datetime)"` 10 | Updatetime time.Time `json:"updatetime",orm:"auto_now;type(datetime)"` 11 | Isdel int8 `json:"isdel",orm:"default(1)"` 12 | } 13 | 14 | type Admusergroupcheck struct { 15 | Id int64 `json:"id"` 16 | Groupname string `json:"groupname"` 17 | Des string `json:"describe"` 18 | Createtime time.Time `json:"createtime",orm:"auto_now_add;type(datetime)"` 19 | Updatetime time.Time `json:"updatetime",orm:"auto_now;type(datetime)"` 20 | Isdel int8 `json:"isdel",orm:"default(1)"` 21 | Check bool `json:"check"` 22 | } 23 | -------------------------------------------------------------------------------- /static/js/role/addRole.js: -------------------------------------------------------------------------------- 1 | function submitAddRoleForm() { 2 | url = "/role/addrole" 3 | var pid = $("input[name='searchRolepid']").val() 4 | var data = { 5 | pid: pid, 6 | name: $("input[name='rolename']").val(), 7 | roleurl: $("input[name='roleurl']").val(), 8 | module: $("input[name='module']").val(), 9 | action: $("input[name='action']").val(), 10 | ismenu: $("#roleismenu").combobox('getValue'), 11 | describe: $("input[name='roledescribe']").val() 12 | }; 13 | 14 | $.post(url, data, function (result) { 15 | if (result == "success") { 16 | clearAddRoleForm() 17 | loadTree(pid) 18 | loaddatagrid(pid) 19 | $.messager.alert('操作提示', "添加成功", 'info'); 20 | } 21 | }); 22 | } 23 | 24 | function clearAddRoleForm() { 25 | $('#addrole').form('clear'); 26 | $("#roleismenu").combobox({value:"1"}) 27 | } -------------------------------------------------------------------------------- /src/controllers/mainController.go: -------------------------------------------------------------------------------- 1 | package controllers 2 | 3 | import "cms/src/service" 4 | 5 | type MainController struct { 6 | BaseController 7 | } 8 | 9 | /** 10 | 进入首页 11 | */ 12 | func (this *MainController) Index() { 13 | this.show("index.html") 14 | } 15 | 16 | /** 17 | 欢迎页面 18 | */ 19 | func (this *MainController) Welcome() { 20 | this.show("common/welcome.html") 21 | } 22 | 23 | /** 24 | 左侧菜单 25 | */ 26 | func (this *MainController) LeftMenu() { 27 | this.show("common/leftMenu.html") 28 | } 29 | 30 | /** 31 | 头页面 32 | */ 33 | func (this *MainController) Header() { 34 | this.Data["user"] = this.admUser 35 | this.show("common/header.html") 36 | } 37 | 38 | /** 39 | 进入没有权限页面 40 | */ 41 | func (this *MainController) Norole() { 42 | this.show("common/noRole.html") 43 | } 44 | 45 | /** 46 | 加载主页面权限tree 47 | */ 48 | func (this *MainController) LoadMenu() { 49 | id := this.admUser.Id 50 | roles := service.RoleService.LoadMenu(id) 51 | this.jsonResult(roles) 52 | } 53 | -------------------------------------------------------------------------------- /static/js/role/modifyRole.js: -------------------------------------------------------------------------------- 1 | function submitModifyRoleForm() { 2 | url = "/role/modify" 3 | var pid = $("input[name='rolepid']").val() 4 | var data = { 5 | pid: pid, 6 | id: $("input[name='m_roleid']").val(), 7 | name: $("input[name='m_rolename']").val(), 8 | roleurl: $("input[name='m_roleurl']").val(), 9 | module: $("input[name='m_module']").val(), 10 | action: $("input[name='m_action']").val(), 11 | ismenu: $("#m_roleismenu").combobox('getValue'), 12 | describe: $("input[name='m_roledescribe']").val() 13 | }; 14 | 15 | $.post(url, data, function (result) { 16 | if (result == "success") { 17 | clearModifyRoleForm() 18 | loadTree(pid) 19 | loaddatagrid(pid) 20 | $('#modifyrole').window('close') 21 | $.messager.alert('操作提示', "修改成功", 'info'); 22 | } 23 | }); 24 | } 25 | 26 | function clearModifyRoleForm() { 27 | $('#modifyrole').form('clear'); 28 | } -------------------------------------------------------------------------------- /static/js/index.js: -------------------------------------------------------------------------------- 1 | //此方法 用于测试 不用每次进来都要点一次左侧菜单 2 | $(document).ready(function(){ 3 | // addTab('系统用户管理auto','admuser/list') 4 | // addTab('权限管理auto','role/list') 5 | // addTab('系统用户组管理auto','admusergroup/list') 6 | // addTab('添加系统用户组管理auto','admusergroup/toadd') 7 | // addTab('添加系统用户auto','/admuser/toaddadmuser') 8 | 9 | 10 | }); 11 | //添加标签页的方法 12 | function addTab(title, url) { 13 | if ($('#mainTab').tabs('exists', title)) { 14 | $('#mainTab').tabs('select', title); 15 | } else { 16 | //var content = ''; 17 | $('#mainTab').tabs('add', { 18 | title: title, 19 | //content:content, 20 | href: url, 21 | closable: true 22 | }); 23 | } 24 | } 25 | 26 | /** 27 | * 格式化时间 28 | */ 29 | function dataformatter(value, row, index) { 30 | if (value) return phpjs.date("Y-m-d H:i:s", phpjs.strtotime(value)); 31 | return value; 32 | } -------------------------------------------------------------------------------- /src/routers/router.go: -------------------------------------------------------------------------------- 1 | package routers 2 | 3 | import ( 4 | "cms/src/controllers" 5 | 6 | "github.com/astaxie/beego" 7 | ) 8 | 9 | func init() { 10 | beego.Info("init routers start ...") 11 | 12 | beego.Router("/", &controllers.MainController{}, "*:Index") 13 | beego.Router("/welcome", &controllers.MainController{}, "*:Welcome") 14 | beego.Router("/leftMenu", &controllers.MainController{}, "*:LeftMenu") 15 | beego.Router("/header", &controllers.MainController{}, "*:Header") 16 | beego.Router("/loadMenu", &controllers.MainController{}, "*:LoadMenu") 17 | // beego.Router("/login", &controllers.MainController{}, "*:Login") 18 | // beego.Router("/tologin", &controllers.MainController{}, "*:Tologin") 19 | // beego.Router("/loginpage", &controllers.MainController{}, "*:Loginpage") 20 | //自动绑定映射关系 21 | beego.AutoRouter(&controllers.AdmUserController{}) 22 | beego.AutoRouter(&controllers.LoginController{}) 23 | beego.AutoRouter(&controllers.RoleController{}) 24 | beego.AutoRouter(&controllers.AdmUserGroupController{}) 25 | 26 | beego.Info("init routers end.") 27 | } 28 | -------------------------------------------------------------------------------- /conf/app.conf: -------------------------------------------------------------------------------- 1 | appname = cmsmain 2 | httpport = 9090 3 | runmode = dev 4 | 5 | 6 | db_host = localhost 7 | db_port = 3306 8 | db_user = cmsadmin 9 | db_pass = cmsadmin 10 | db_name = cmsadmin 11 | db_type = mysql 12 | 13 | db.prefix = "t_" 14 | 15 | #打开监控配置 16 | #EnableAdmin = true 17 | #AdminAddr = 0.0.0.0 #默认监听地址是localhost 18 | #AdminPort = 8088 19 | 20 | #使用ngnix做静态文件服务器的地址 21 | #staticUrl = http://127.0.0.1/cms 22 | #使用golang服务器自带的静态文件服务 23 | staticUrl = http://127.0.0.1:9090/static 24 | 25 | #设置静态文件目录 目前设置的download目录不存在,实际存放静态文件的目录是static,static目录中的文件由ngnix提供访问 26 | #单个目录, StaticDir = download. 相当于beego.SetStaticPath("/download","download") 27 | StaticDir = icon:icon static:static 28 | 29 | #beego 中默认的模板目录是 views,用户可以把模板文件放到该目录下,beego 会自动在该目录下的所有模板文件进行解析并缓存,开发模式下每次都会重新解析,不做缓存 30 | beego.BConfig.WebConfig.ViewsPath = "views" 31 | 32 | #Go 语言的默认模板采用了 {{ 和 }} 作为左右标签 这里设置为 和jsp一样的标签 33 | beego.BConfig.WebConfig.TemplateLeft = "{{" 34 | beego.BConfig.WebConfig.TemplateRight = "}}" 35 | 36 | 37 | base64key=321RSTUasdfssDFGSDFGsFgsdFGSDfgsdgfBDstEFGzGHIJklmndsfsdfggdSDfG 38 | md5key=CrazyWolf -------------------------------------------------------------------------------- /src/controllers/loginController.go: -------------------------------------------------------------------------------- 1 | package controllers 2 | 3 | import ( 4 | "cms/src/common" 5 | "cms/src/service" 6 | "strconv" 7 | 8 | "github.com/astaxie/beego" 9 | ) 10 | 11 | type LoginController struct { 12 | BaseController 13 | } 14 | 15 | /** 16 | 进入登录页面 17 | */ 18 | func (this *LoginController) Tologin() { 19 | this.show("common/loginPage.html") 20 | } 21 | 22 | /** 23 | 登陆 24 | */ 25 | func (this *LoginController) Login() { 26 | accout := this.GetString("accout") 27 | password := this.GetString("password") 28 | encodePwd := common.EncodeMessageMd5(password) 29 | 30 | if admusers, err := service.AdmUserService.Authentication(accout, encodePwd); err != nil { 31 | this.jsonResult(err.Error()) 32 | } else { 33 | token := strconv.FormatInt(admusers.Id, 10) + "|" + accout + "|" + this.getClientIp() 34 | token = common.EncryptAes(token) 35 | this.Ctx.SetCookie("token", token, 0) 36 | this.jsonResult(SUCCESS) 37 | } 38 | } 39 | 40 | /** 41 | 退出登陆 42 | */ 43 | func (this *LoginController) Loginout() { 44 | this.Ctx.SetCookie("token", "", 0) 45 | this.redirect(beego.URLFor("LoginController.Tologin")) 46 | } 47 | -------------------------------------------------------------------------------- /views/role/addRoleDir.html: -------------------------------------------------------------------------------- 1 | 2 |
3 |
4 | 5 | 6 | 7 | 8 | 9 | 11 | 12 | 13 | 14 | 15 | 17 | 18 |
目录名称: 10 |
描述: 16 |
19 |
20 | Submit 21 | Clear 22 |
23 |
24 | 25 |
26 | 27 | -------------------------------------------------------------------------------- /views/common/welcome.html: -------------------------------------------------------------------------------- 1 | 2 |
3 |
4 |

欢迎使用

5 |
6 |
7 | 8 | 9 |
10 | 11 |
12 |             项目简介:
13 |                 此项目的设计目标主要用于需要多人协作、需要对操作权限做精确控制的管理系统使用。目前只提供了权限管理、用户组管理、
14 |                 用户管理基础功能,后续如果有可以公用的功能会陆续增加进来。
15 | 
16 |             功能介绍: 
17 |             
18 |             1:管理员管理 
19 |                 管理可以使用此系统的用户
20 |                 功能:查询、新增、修改(可以直接重置密码)删除、管联用户组(管理用户组后可以拥有改组的所有权限)
21 |             2:管理员组管理
22 |                 主要是用于用户分组和权限分组
23 |                 功能:查询、新增、修改、删除、关联权限(设置这个组拥有那些权限)
24 |             3:权限管理
25 |                 用于管理系统中所有的操作权限、导航菜单中的菜单目录
26 |                 功能:查询、新增、修改、删除
27 |                 ps:这里的权限有三种用途
28 |                     A:作为导航菜单中的目录使用(新增的时候只需要填写 权限名称 和 选择是否作为菜单)
29 |                     B:仅作为菜单(新增的时候必须填写 权限名称、请求地址、模块名称、操作名称、并选择作为菜单为 是)
30 |                     C:仅作为一个普通权限(新增的时候必须填写 权限名称、模块名称、操作名称、并选择作为菜单为 否)
31 | 
32 | 
33 |             此页面主要作为欢迎页面,后续可以加入公告,快捷入口,帮助文档入口等
34 |         
35 | 36 |
37 | 38 | 39 | -------------------------------------------------------------------------------- /nginx.conf: -------------------------------------------------------------------------------- 1 | ## nginx 配置 2 | ```java 3 | #user nobody; 4 | worker_processes 1; 5 | 6 | #error_log logs/error.log; 7 | #error_log logs/error.log notice; 8 | #error_log logs/error.log info; 9 | 10 | #pid logs/nginx.pid; 11 | 12 | 13 | events { 14 | worker_connections 1024; 15 | } 16 | 17 | http { 18 | include mime.types; 19 | default_type application/octet-stream; 20 | 21 | log_format main '$remote_addr - $remote_user [$time_local] "$request" ' 22 | '$status $body_bytes_sent "$http_referer" ' 23 | '"$http_user_agent" "$http_x_forwarded_for"'; 24 | 25 | #access_log logs/access.log main; 26 | server_names_hash_bucket_size 128; 27 | client_header_buffer_size 32k; 28 | large_client_header_buffers 4 32k; 29 | client_max_body_size 100m; 30 | sendfile on; 31 | tcp_nopush on; 32 | keepalive_timeout 60; 33 | tcp_nodelay on; 34 | fastcgi_connect_timeout 300; 35 | fastcgi_send_timeout 300; 36 | fastcgi_read_timeout 300; 37 | fastcgi_buffer_size 64k; 38 | fastcgi_buffers 4 64k; 39 | fastcgi_busy_buffers_size 128k; 40 | fastcgi_temp_file_write_size 128k; 41 | 42 | gzip on; 43 | gzip_min_length 1k; 44 | gzip_buffers 4 16k; 45 | gzip_http_version 1.0; 46 | gzip_comp_level 2; 47 | gzip_types text/plain application/x-javascript text/css application/xml; 48 | gzip_vary on; 49 | 50 | 51 | server { 52 | listen 80; 53 | server_name 127.0.0.1; 54 | location /cms/ { 55 | alias C:\\gopath\\src\\cms\\static\\; 56 | } 57 | 58 | } 59 | } 60 | 61 | ``` -------------------------------------------------------------------------------- /readme.md: -------------------------------------------------------------------------------- 1 | # 项目简介: 2 | 此项目的设计目标主要用于需要多人协作、需要对操作权限做精确控制的管理系统使用。目前只提供了权限管理、用户组管理、 3 | 用户管理基础功能,后续如果有可以公用的功能会陆续增加进来。 4 | 本项目使用go语言开发 5 | - web框架使用 [beego](http://beego.me/) 6 | - 前台页面使用 [easyUI](http://www.jeasyui.net/demo/380.html) (easyUI 中文网) 7 | - 页面中使用的树组件为 [zTree](http://www.treejs.cn/v3/main.php#_zTreeInfo) 8 | 9 | ## 软件环境 10 | - 开发工具: VS Code 11 | - 数据库: mysql 12 | 13 | ## 安装指南 14 | - doc 目录下的database.sql 是数据库初始化脚本 15 | - 默认账号 `admin` 密码 `111111` 16 | 17 | ## 功能介绍: 18 | 1:管理员管理 19 | 管理可以使用此系统的用户 20 | 功能:查询、新增、修改(可以直接重置密码)删除、管联用户组(管理用户组后可以拥有改组的所有权限) 21 | 2:管理员组管理 22 | 主要是用于用户分组和权限分组 23 | 功能:查询、新增、修改、删除、关联权限(设置这个组拥有那些权限) 24 | 3:权限管理 25 | 用于管理系统中所有的操作权限、导航菜单中的菜单目录 26 | 功能:查询、新增、修改、删除 27 | ps:这里的权限有三种用途 28 | A:作为导航菜单中的目录使用(新增的时候只需要填写 权限名称 和 选择是否作为菜单) 29 | B:仅作为菜单(新增的时候必须填写 权限名称、请求地址、模块名称、操作名称、并选择作为菜单为 是) 30 | C:仅作为一个普通权限(新增的时候必须填写 权限名称、模块名称、操作名称、并选择作为菜单为 否) 31 | 32 | ## 功能截图 33 | - 管理员管理 34 | ![image](https://github.com/crazy-wolf/cms/blob/master/doc/img/user.png) 35 | ![image](https://github.com/crazy-wolf/cms/blob/master/doc/img/adduser.png) 36 | - 管理员组管理 37 | ![image](https://github.com/crazy-wolf/cms/blob/master/doc/img/usergroup.png) 38 | ![image](https://github.com/crazy-wolf/cms/blob/master/doc/img/addusergroup.png) 39 | - 权限管理 40 | ![image](https://github.com/crazy-wolf/cms/blob/master/doc/img/role.png) 41 | 42 | ## 待完成功能 43 | - [X] 管理员管理 44 | - [X] 修改管理员组功能 45 | - [X] 删除管理员组功能 46 | - [X] 登陆校验 47 | - [X] 权限校验 48 | - [X] 添加权限后刷新左侧菜单 49 | - [X] 权限页面打开后 在打开组管理 权限页面点击tree刷新表 50 | - [X] 建库sql 51 | - [X] 权限删除的时候判断当前权限是否有子节点,如果有子节点不能删除(2016-9-6) 52 | - [X] 增加退出功能 (2016-9-6) 53 | - [X] 添加修改参数校验 54 | - [ ] 功能测试 55 | 56 | `ps:系统中所有html标签的name不能相同,调用的js方法名也不能相同, 57 | 否则会引起功能混乱,easyui的限制由于它是把所有的js和html加载到一个页面中了` -------------------------------------------------------------------------------- /src/service/initService.go: -------------------------------------------------------------------------------- 1 | package service 2 | 3 | import ( 4 | "cms/src/model" 5 | 6 | "github.com/astaxie/beego" 7 | "github.com/astaxie/beego/orm" 8 | _ "github.com/go-sql-driver/mysql" 9 | ) 10 | 11 | var ( 12 | o orm.Ormer 13 | tablePrefix string // 表前缀 14 | 15 | RoleService *roleService 16 | AdmUserGroupService *admUserGroupService 17 | AdmUserService *admUserService 18 | ) 19 | 20 | func init() { 21 | beego.Info("init orm start...") 22 | tablePrefix = beego.AppConfig.String("db.prefix") 23 | 24 | dbType := beego.AppConfig.String("db_type") 25 | dsn := generateDSN() 26 | orm.RegisterDataBase("default", dbType, dsn) 27 | 28 | orm.RegisterModelWithPrefix(tablePrefix, 29 | new(model.Role), 30 | new(model.Admusergroup), 31 | new(model.GroupRoleRel), 32 | new(model.Admuser), 33 | new(model.UserGroupRel), 34 | ) 35 | orm.RunSyncdb("default", false, true) 36 | 37 | if beego.AppConfig.String("runmode") == "dev" { 38 | orm.Debug = true 39 | } 40 | 41 | o = orm.NewOrm() 42 | orm.RunCommand() 43 | 44 | beego.Info("init orm end.") 45 | //初始化service 46 | initService() 47 | } 48 | 49 | func generateDSN() string { 50 | dbHost := beego.AppConfig.String("db_host") 51 | dbPort := beego.AppConfig.String("db_port") 52 | dbUser := beego.AppConfig.String("db_user") 53 | dbPassword := beego.AppConfig.String("db_pass") 54 | dbName := beego.AppConfig.String("db_name") 55 | 56 | //beego.Debug(dbHost, dbPort, dbUser, dbPassword, dbName, dbType) 57 | // root:@tcp(127.0.0.1:3306)/test?charset=utf8 58 | dsn := dbUser + ":" + dbPassword + "@tcp(" + dbHost + ":" + dbPort + ")/" + dbName + "?charset=utf8" 59 | return dsn 60 | } 61 | 62 | func initService() { 63 | RoleService = &roleService{} 64 | AdmUserGroupService = &admUserGroupService{} 65 | AdmUserService = &admUserService{} 66 | } 67 | -------------------------------------------------------------------------------- /views/common/navbar.html: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /static/js/admusergroup/addadmusergroup.js: -------------------------------------------------------------------------------- 1 | 2 | //设置tree的初始化参数 3 | var admusergroupsetting = { 4 | check: { 5 | enable: true 6 | // chkboxType: { "Y": "", "N": "" } 7 | }, 8 | data: { 9 | simpleData: { 10 | enable: true 11 | } 12 | } 13 | }; 14 | 15 | 16 | 17 | 18 | //初始化左边tree 19 | $(document).ready(loadTree()); 20 | function loadTree() { 21 | url = "/admusergroup/loadtreewithoutroot" 22 | var data; 23 | $.post(url, data, function (result) { 24 | // zNodes = result 25 | $.fn.zTree.init($("#addadmgrouproletree"), admusergroupsetting, result); 26 | }); 27 | } 28 | 29 | 30 | 31 | function submitAddAmdUserGroupForm() { 32 | 33 | var zTree = $.fn.zTree.getZTreeObj("addadmgrouproletree"); 34 | nodes = zTree.getCheckedNodes(true); 35 | checkCount = nodes.length; 36 | //判断选中的节点数,如果没有选中节点则提示操作错误 37 | if (checkCount == 0) { 38 | $.messager.alert('操作提示', "请至少选择一个权限", 'info'); 39 | return false; 40 | } 41 | //获取所有选中的节点ID 42 | var idArray = new Array(checkCount) 43 | for (var i = 0; i < nodes.length; i++) { 44 | idArray[i] = nodes[i].id 45 | } 46 | ids = idArray.join(",") 47 | 48 | url = "/admusergroup/addadmusergroup" 49 | 50 | var data = { 51 | ids: ids, 52 | groupname: $("input[name='admgroupusername']").val(), 53 | describe: $("input[name='admgroupuserdescribe']").val() 54 | }; 55 | 56 | $.post(url, data, function (result) { 57 | if (result == "success") { 58 | $('#addadmusergroup').window("close") 59 | $.messager.alert('操作提示', "添加成功", 'info'); 60 | loadAdmUserGroupDatagrid() 61 | }else{ 62 | $.messager.alert('操作提示', result, 'info'); 63 | } 64 | }); 65 | } 66 | 67 | function clearAddAmdUserGroupForm() { 68 | $('#addamdusergroup').form('clear'); 69 | } -------------------------------------------------------------------------------- /views/admusergroup/admUserGroupList.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 |
管理员组ID管理员组名称描述信息添加时间操作
16 |
17 |
18 | 添加 19 | 删除 20 |
21 |
22 | 组名称: 23 | 24 | 查询 25 |
26 |
27 | 28 | 29 | 30 | 31 |
32 | 33 |
34 | 35 | 36 | 37 |
38 |
39 | 40 | 41 | 42 | 43 | -------------------------------------------------------------------------------- /views/admusergroup/addAdmusergroup.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 |
6 | 7 |
8 |
9 | 10 | 11 | 12 | 14 | 15 | 16 | 17 | 20 | 21 | 22 |
管理员组名称: 13 |
描述信息: 19 |
23 | 24 |
25 | Submit 26 | Clear 27 |
28 |
29 |
30 | 31 | 32 | 33 |
34 | 选择权限: 35 |
36 |
    37 |
    38 |
    39 | 40 |
    41 | 42 | 43 | 44 | 45 | -------------------------------------------------------------------------------- /src/common/encode.go: -------------------------------------------------------------------------------- 1 | package common 2 | 3 | import ( 4 | "crypto/aes" 5 | "crypto/cipher" 6 | "crypto/md5" 7 | "encoding/base64" 8 | 9 | "github.com/astaxie/beego" 10 | ) 11 | 12 | func EncodeMessageMd5(msg string) string { 13 | h := md5.New() 14 | coding := base64.NewEncoding(beego.AppConfig.String("base64key")) 15 | h.Write([]byte(msg)) // 需要加密的字符串为 123456 16 | key := []byte(beego.AppConfig.String("md5key")) 17 | cipherStr := h.Sum([]byte(key)) 18 | 19 | return coding.EncodeToString(cipherStr) 20 | } 21 | 22 | func getKey() []byte { 23 | strKey := "zheshiyonggolangxiedeyigecmsxitongjichugongneng" 24 | keyLen := len(strKey) 25 | if keyLen < 16 { 26 | panic("res key 长度不能小于16") 27 | } 28 | arrKey := []byte(strKey) 29 | if keyLen >= 32 { 30 | //取前32个字节 31 | return arrKey[:32] 32 | } 33 | if keyLen >= 24 { 34 | //取前24个字节 35 | return arrKey[:24] 36 | } 37 | //取前16个字节 38 | return arrKey[:16] 39 | } 40 | 41 | //加密字符串 42 | func EncryptAes(strMesg string) string { 43 | key := getKey() 44 | var iv = []byte(key)[:aes.BlockSize] 45 | encrypted := make([]byte, len(strMesg)) 46 | aesBlockEncrypter, err := aes.NewCipher(key) 47 | if err != nil { 48 | beego.Debug("AES 加密失败") 49 | return "" 50 | } 51 | aesEncrypter := cipher.NewCFBEncrypter(aesBlockEncrypter, iv) 52 | aesEncrypter.XORKeyStream(encrypted, []byte(strMesg)) 53 | return base64.StdEncoding.EncodeToString(encrypted) 54 | } 55 | 56 | //解密字符串 57 | func DecryptAes(srcstr string) (strDesc string, err error) { 58 | src, _ := base64.StdEncoding.DecodeString(srcstr) 59 | defer func() { 60 | //错误处理 61 | if e := recover(); e != nil { 62 | err = e.(error) 63 | } 64 | }() 65 | key := getKey() 66 | var iv = []byte(key)[:aes.BlockSize] 67 | decrypted := make([]byte, len(src)) 68 | var aesBlockDecrypter cipher.Block 69 | aesBlockDecrypter, err = aes.NewCipher([]byte(key)) 70 | if err != nil { 71 | return "", err 72 | } 73 | aesDecrypter := cipher.NewCFBDecrypter(aesBlockDecrypter, iv) 74 | aesDecrypter.XORKeyStream(decrypted, src) 75 | return string(decrypted), nil 76 | } 77 | -------------------------------------------------------------------------------- /static/js/admusergroup/modifyadmusergroup.js: -------------------------------------------------------------------------------- 1 | 2 | //设置tree的初始化参数 3 | var admusergroupsetting = { 4 | check: { 5 | enable: true 6 | // chkboxType: { "Y": "", "N": "" } 7 | }, 8 | data: { 9 | simpleData: { 10 | enable: true 11 | } 12 | } 13 | }; 14 | 15 | //初始化tree 16 | $(document).ready(loadTree()); 17 | function loadTree() { 18 | var admgroupuserid = $("input[name='admgroupuserid']").val() 19 | url = "/admusergroup/loadtreechecked" 20 | var data = { 21 | admgroupuserid: admgroupuserid, 22 | }; 23 | $.post(url, data, function (result) { 24 | // zNodes = result 25 | $.fn.zTree.init($("#modifyadmgrouproletree"), admusergroupsetting, result); 26 | }); 27 | } 28 | 29 | /** 30 | * 修改管理员组 31 | */ 32 | function submitModifyAmdUserGroupForm() { 33 | var zTree = $.fn.zTree.getZTreeObj("modifyadmgrouproletree"); 34 | nodes = zTree.getCheckedNodes(true); 35 | checkCount = nodes.length; 36 | //判断选中的节点数,如果没有选中节点则提示操作错误 37 | if (checkCount == 0) { 38 | $.messager.alert('操作提示', "请至少选择一个权限", 'info'); 39 | return false; 40 | } 41 | //获取所有选中的节点ID 42 | var idArray = new Array(checkCount) 43 | for (var i = 0; i < nodes.length; i++) { 44 | idArray[i] = nodes[i].id 45 | } 46 | ids = idArray.join(",") 47 | 48 | url = "/admusergroup/modifyadmusergroup" 49 | 50 | var data = { 51 | ids: ids, 52 | id: $("input[name='admgroupuserid']").val(), 53 | groupname: $("input[name='ag_m_name']").val(), 54 | describe: $("input[name='ag_m_describe']").val() 55 | }; 56 | 57 | $.post(url, data, function (result) { 58 | if (result == "success") { 59 | $('#modifyadmusergroup').window("close") 60 | $.messager.alert('操作提示', "修改成功", 'info'); 61 | loadAdmUserGroupDatagrid() 62 | } else { 63 | $.messager.alert('操作提示', result, 'info'); 64 | } 65 | }); 66 | } 67 | 68 | function clearModifyAmdUserGroupForm() { 69 | $('#modifyadmusergroup').form('clear'); 70 | } 71 | 72 | 73 | -------------------------------------------------------------------------------- /views/role/addRole.html: -------------------------------------------------------------------------------- 1 | 2 |
    3 |
    4 | 5 | 6 | 7 | 9 | 10 | 11 | 12 | 14 | 15 | 16 | 17 | 19 | 20 | 21 | 22 | 24 | 25 | 26 | 27 | 33 | 34 | 35 | 36 | 38 | 39 |
    权限名称: 8 |
    权限地址: 13 |
    模块名称: 18 |
    操作名称: 23 |
    是否作为菜单: 28 | 32 |
    权限说明: 37 |
    40 |
    41 | Submit 42 | Clear 43 |
    44 |
    45 | 46 |
    47 | 48 | -------------------------------------------------------------------------------- /views/admusergroup/modifyAdmusergroup.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 |
    6 | 7 |
    8 |
    9 | 10 | 11 | 12 | 13 | 16 | 17 | 18 | 19 | 22 | 23 | 24 |
    管理员组名称: 15 |
    描述信息: 21 |
    25 | 26 |
    27 | Submit 28 | Clear 29 |
    30 |
    31 |
    32 | 33 | 34 | 35 |
    36 | 选择权限: 37 |
    38 |
      39 |
      40 |
      41 | 42 |
      43 | 44 | 45 | 46 | 47 | -------------------------------------------------------------------------------- /static/css/demo.css: -------------------------------------------------------------------------------- 1 | html, body, div, span, applet, object, iframe, h1, h2, h3, h4, h5, h6, p, blockquote, pre, a, abbr, acronym, address, big, cite, code, del, dfn, em, font, img, ins, kbd, q, s, samp, small, strike, strong, sub, sup, tt, var, dl, dt, dd, ol, ul, li, fieldset, form, label, legend, table, caption, tbody, tfoot, thead, tr, th, td { 2 | margin: 0;padding: 0;border: 0;outline: 0;font-weight: inherit;font-style: inherit;font-size: 100%;font-family: inherit;vertical-align: baseline;} 3 | body {color: #2f332a;font: 15px/21px Arial, Helvetica, simsun, sans-serif;background: #f0f6e4 \9;} 4 | h1, h2, h3, h4, h5, h6 {color: #2f332a;font-weight: bold;font-family: Helvetica, Arial, sans-serif;padding-bottom: 5px;} 5 | h1 {font-size: 24px;line-height: 34px;text-align: center;} 6 | h2 {font-size: 14px;line-height: 24px;padding-top: 5px;} 7 | h6 {font-weight: normal;font-size: 12px;letter-spacing: 1px;line-height: 24px;text-align: center;} 8 | a {color:#3C6E31;text-decoration: underline;} 9 | a:hover {background-color:#3C6E31;color:white;} 10 | input.radio {margin: 0 2px 0 8px;} 11 | input.radio.first {margin-left:0;} 12 | input.empty {color: lightgray;} 13 | code {color: #2f332a;} 14 | .highlight_red {color:#A60000;} 15 | .highlight_green {color:#A7F43D;} 16 | li {list-style: circle;font-size: 12px;} 17 | li.title {list-style: none;} 18 | ul.list {margin-left: 17px;} 19 | 20 | div.content_wrap {width: 600px;height:380px;} 21 | div.content_wrap div.left{float: left;width: 250px;} 22 | div.content_wrap div.right{float: right;width: 340px;} 23 | /*div.zTreeDemoBackground {width:250px;height:362px;text-align:left;}*/ 24 | 25 | ul.ztree {margin-top: 0px;border: 0px solid #617775;background:#fff;overflow-y:auto;overflow-x:auto;} 26 | ul.log {border: 1px solid #617775;background: #f0f6e4;width:300px;height:170px;overflow: hidden;} 27 | ul.log.small {height:45px;} 28 | ul.log li {color: #666666;list-style: none;padding-left: 10px;} 29 | ul.log li.dark {background-color: #E3E3E3;} 30 | 31 | /* ruler */ 32 | div.ruler {height:20px; width:220px; background-color:#f0f6e4;border: 1px solid #333; margin-bottom: 5px; cursor: pointer} 33 | div.ruler div.cursor {height:20px; width:30px; background-color:#3C6E31; color:white; text-align: right; padding-right: 5px; cursor: pointer} -------------------------------------------------------------------------------- /views/admUser/admUserList.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 |
      5 | 6 |
      7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 |
      ID账号邮箱姓名部门电话号码创建时间最后一次修改时间操作
      22 |
      23 |
      24 | 添加 25 | 删除 26 |
      27 |
      28 | ID: 29 | 30 | 姓名: 31 | 32 | 账号: 33 | 34 | 邮箱: 35 | 36 | 电话: 37 | 38 | 查询 39 |
      40 |
      41 |
      42 |
      43 | 44 | 45 | 46 |
      47 | 48 | 49 | 50 |
      51 | 52 | 53 | 54 | 55 | -------------------------------------------------------------------------------- /static/js/locale/easyui-lang-zh_CN.js: -------------------------------------------------------------------------------- 1 | if ($.fn.pagination){ 2 | $.fn.pagination.defaults.beforePageText = '第'; 3 | $.fn.pagination.defaults.afterPageText = '共{pages}页'; 4 | $.fn.pagination.defaults.displayMsg = '显示{from}到{to},共{total}记录'; 5 | } 6 | if ($.fn.datagrid){ 7 | $.fn.datagrid.defaults.loadMsg = '正在处理,请稍待。。。'; 8 | } 9 | if ($.fn.treegrid && $.fn.datagrid){ 10 | $.fn.treegrid.defaults.loadMsg = $.fn.datagrid.defaults.loadMsg; 11 | } 12 | if ($.messager){ 13 | $.messager.defaults.ok = '确定'; 14 | $.messager.defaults.cancel = '取消'; 15 | } 16 | $.map(['validatebox','textbox','filebox','searchbox', 17 | 'combo','combobox','combogrid','combotree', 18 | 'datebox','datetimebox','numberbox', 19 | 'spinner','numberspinner','timespinner','datetimespinner'], function(plugin){ 20 | if ($.fn[plugin]){ 21 | $.fn[plugin].defaults.missingMessage = '该输入项为必输项'; 22 | } 23 | }); 24 | if ($.fn.validatebox){ 25 | $.fn.validatebox.defaults.rules.email.message = '请输入有效的电子邮件地址'; 26 | $.fn.validatebox.defaults.rules.url.message = '请输入有效的URL地址'; 27 | $.fn.validatebox.defaults.rules.length.message = '输入内容长度必须介于{0}和{1}之间'; 28 | $.fn.validatebox.defaults.rules.remote.message = '请修正该字段'; 29 | } 30 | if ($.fn.calendar){ 31 | $.fn.calendar.defaults.weeks = ['日','一','二','三','四','五','六']; 32 | $.fn.calendar.defaults.months = ['一月','二月','三月','四月','五月','六月','七月','八月','九月','十月','十一月','十二月']; 33 | } 34 | if ($.fn.datebox){ 35 | $.fn.datebox.defaults.currentText = '今天'; 36 | $.fn.datebox.defaults.closeText = '关闭'; 37 | $.fn.datebox.defaults.okText = '确定'; 38 | $.fn.datebox.defaults.formatter = function(date){ 39 | var y = date.getFullYear(); 40 | var m = date.getMonth()+1; 41 | var d = date.getDate(); 42 | return y+'-'+(m<10?('0'+m):m)+'-'+(d<10?('0'+d):d); 43 | }; 44 | $.fn.datebox.defaults.parser = function(s){ 45 | if (!s) return new Date(); 46 | var ss = s.split('-'); 47 | var y = parseInt(ss[0],10); 48 | var m = parseInt(ss[1],10); 49 | var d = parseInt(ss[2],10); 50 | if (!isNaN(y) && !isNaN(m) && !isNaN(d)){ 51 | return new Date(y,m-1,d); 52 | } else { 53 | return new Date(); 54 | } 55 | }; 56 | } 57 | if ($.fn.datetimebox && $.fn.datebox){ 58 | $.extend($.fn.datetimebox.defaults,{ 59 | currentText: $.fn.datebox.defaults.currentText, 60 | closeText: $.fn.datebox.defaults.closeText, 61 | okText: $.fn.datebox.defaults.okText 62 | }); 63 | } 64 | if ($.fn.datetimespinner){ 65 | $.fn.datetimespinner.defaults.selections = [[0,4],[5,7],[8,10],[11,13],[14,16],[17,19]] 66 | } 67 | -------------------------------------------------------------------------------- /views/role/modifyRole.html: -------------------------------------------------------------------------------- 1 | 2 |
      3 |
      4 | 5 | 6 | 7 | 8 | 9 | 12 | 13 | 14 | 15 | 17 | 18 | 19 | 20 | 21 | 23 | 24 | 25 | 26 | 28 | 29 | 30 | 31 | 37 | 38 | 39 | 40 | 41 | 43 | 44 |
      权限名称: 10 | 11 |
      权限地址: 16 |
      模块名称: 22 |
      操作名称: 27 |
      是否作为菜单: 32 | 36 |
      权限说明: 42 |
      45 |
      46 | Submit 47 | Clear 48 |
      49 |
      50 |
      51 | 52 | -------------------------------------------------------------------------------- /views/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 |
      5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 |
      19 | 20 | 21 | 22 |
      23 |
      24 | 25 |
      26 | 27 |
      28 | 29 |
      30 |
      31 |
      32 |
      33 |
      34 |
      35 | 36 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | -------------------------------------------------------------------------------- /static/js/admUser/addadmuser.js: -------------------------------------------------------------------------------- 1 | $(function () { 2 | addAdmUserObj = { 3 | search: function () { 4 | $('#admusergroup').datagrid('load', { 5 | groupName: $('input[name="addAdmUser_UserGroupName"]').val() 6 | }); 7 | } 8 | } 9 | //datagrid初始化 10 | $('#admusergroup').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: addAdmUser_toolbar 33 | }); 34 | }) 35 | 36 | 37 | 38 | function submitAddAmdUserForm() { 39 | var selections = $('#admusergroup').datagrid('getSelections') 40 | if (selections.length == 0) { 41 | $.messager.alert('操作提示', "请至少选择一个组", 'info'); 42 | return false 43 | } 44 | 45 | var idArray = new Array(selections.length) 46 | for (var i = 0; i < selections.length; i++) { 47 | idArray[i] = selections[i].id 48 | } 49 | ids = idArray.join(",") 50 | 51 | url = "/admuser/addadmuser" 52 | var data = { 53 | ids: ids, 54 | account: $("input[name='admUserAcout']").val(), 55 | name: $("input[name='admUserName']").val(), 56 | phone: $("input[name='admUserPhone']").val(), 57 | department: $("input[name='admUserDepartment']").val(), 58 | password: $("input[name='admUserPassword']").val(), 59 | mail: $("input[name='admUserEmail']").val() 60 | }; 61 | 62 | if (data.account.length < 1 || data.name.length < 1 || data.phone.length < 1 || data.department.length < 1 || data.password.length < 1 || data.mail.length < 1) { 63 | $.messager.alert('操作提示', "信息填写不完整,请补充后重新提交", 'info'); 64 | return 65 | } 66 | 67 | 68 | $.post(url, data, function (result) { 69 | if (result == "success") { 70 | $('#addAdmUser').window("close") 71 | $.messager.alert('操作提示', "添加成功", 'info'); 72 | loadAdmUserGrid() 73 | } else { 74 | $.messager.alert('操作提示', result, 'info'); 75 | } 76 | }); 77 | } 78 | 79 | 80 | function clearAddAmdUserForm() { 81 | $('#addAdmUser').form('clear'); 82 | } 83 | 84 | function loadAdmUserGrid() { 85 | $('#admUser_list').datagrid('load', { 86 | }); 87 | } -------------------------------------------------------------------------------- /views/common/loginPage.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | CMS 登陆 8 | 9 | 10 | 11 | 12 | 13 | 14 |
      15 | 16 | 17 | 20 |
      21 | 22 | 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 |
      7 |
      8 |
        9 |
        10 |
        11 | 12 | 13 | 14 |
        15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 |
        权限ID权限名称权限地址模块名称操作名称是否为菜单权限说明操作
        29 |
        30 |
        31 | 32 | 33 | 添加 34 | 删除 35 |
        36 |
        37 | 38 | 权限名称: 39 | 权限地址: 40 | 41 | 查询 42 |
        43 |
        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 |
        5 | 6 |
        7 | 8 | 9 | 10 | 12 | 13 | 15 | 16 | 18 | 19 | 20 | 21 | 23 | 24 | 27 | 28 | 29 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 41 | 42 | 43 | 44 | 45 |
        登陆账号: 11 | 姓名: 14 | 手机号: 17 |
        部门: 22 | 邮箱: 25 | 26 | 密码: 30 |
        Submit 39 | Clear 40 |
        46 |
        47 | 48 |
        49 | 50 | 51 | 52 |
        53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 |
        管理员组ID管理员组名称描述信息添加时间
        63 |
        64 | 65 |
        66 | 组名称: 67 | 68 | 查询 69 |
        70 |
        71 |
        72 | 73 |
        74 | 75 | -------------------------------------------------------------------------------- /views/admUser/modifyAdmUser.html: -------------------------------------------------------------------------------- 1 | 2 |
        3 | 4 |
        5 | 6 |
        7 | 8 | 9 | 10 | 11 | 14 | 15 | 18 | 19 | 22 | 23 | 24 | 25 | 28 | 29 | 33 | 34 | 35 | 37 | 38 | 39 | 40 | 41 | 42 | 45 | 46 | 47 | 48 | 49 |
        登陆账号: 13 | 姓名: 17 | 手机号: 21 |
        部门: 27 | 邮箱: 30 | 32 | 新密码: 36 |
        Submit 43 | Clear 44 |
        50 |
        51 | 52 |
        53 | 54 | 55 | 56 |
        57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 |
        管理员组ID管理员组名称描述信息添加时间
        67 |
        68 | 69 |
        70 | 组名称: 71 | 72 | 查询 73 |
        74 |
        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 | --------------------------------------------------------------------------------