router.go
4.4 KB
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
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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
package routers
import (
"oppmg/controllers"
"oppmg/middleware"
"github.com/astaxie/beego"
)
func init() {
nsV1 := beego.NewNamespace("v1",
beego.NSBefore(middleware.AllowOption),
beego.NSBefore(middleware.LogRequestData),
//beego.NSBefore(middleware.AuthToken),
beego.NSNamespace("/department",
beego.NSRouter("/list", &controllers.CompanyController{}, "post:DepartmentList"),
beego.NSRouter("/add", &controllers.CompanyController{}, "post:DepartmentAdd"),
beego.NSRouter("/edit", &controllers.CompanyController{}, "post:DepartmentUpdate"),
beego.NSRouter("/delete", &controllers.CompanyController{}, "post:DepartmentDelete"),
// beego.NSRouter("/user", &controllers.CompanyController{}, "post:DepartmentDelete"),
),
beego.NSNamespace("position",
beego.NSRouter("/list", &controllers.CompanyController{}, "post:PositionList"),
beego.NSRouter("/add", &controllers.CompanyController{}, "post:PositionAdd"),
beego.NSRouter("/edit", &controllers.CompanyController{}, "post:PositionEdit"),
beego.NSRouter("/delete", &controllers.CompanyController{}, "post:PositionDelete"),
),
beego.NSNamespace("/rbac",
beego.NSRouter("/role/add", &controllers.RbacController{}, "post:RoleAdd"),
beego.NSRouter("/role/edit", &controllers.RbacController{}, "post:RoleUpdate"),
beego.NSRouter("/role/delete", &controllers.RbacController{}, "post:RoleDelete"),
beego.NSRouter("/role_group/add", &controllers.RbacController{}, "post:RoleGroupAdd"),
beego.NSRouter("/role_group/edit", &controllers.RbacController{}, "post:RoleGroupUpdate"),
beego.NSRouter("/role_group/delete", &controllers.RbacController{}, "post:RoleGroupDelete"),
beego.NSRouter("/role/list", &controllers.RbacController{}, "post:RoleList"),
),
beego.NSNamespace("/user",
beego.NSRouter("/list", &controllers.CompanyController{}, "post:UserList"),
beego.NSRouter("/add", &controllers.CompanyController{}, "post:UserAdd"),
beego.NSRouter("/edit", &controllers.CompanyController{}, "post:UserEdit"),
beego.NSRouter("/delete", &controllers.CompanyController{}, "post:UserDelete"),
),
beego.NSNamespace("/auth",
beego.NSRouter("/change_company", &controllers.AuthController{}, "post:ChangeCompany"),
beego.NSRouter("/refresh_token", &controllers.AuthController{}, "post:RefreshToken"),
beego.NSRouter("/me", &controllers.AuthController{}, "post:Me"),
),
beego.NSNamespace("/bulletin",
beego.NSRouter("/add", &controllers.BulletinController{}, "post:BulletinRelease"),
beego.NSRouter("/list", &controllers.BulletinController{}, "post:BulletinList"),
beego.NSRouter("/get", &controllers.BulletinController{}, "post:GetBulletin"),
beego.NSRouter("/update", &controllers.BulletinController{}, "post:UpdateBulletin"),
beego.NSRouter("/operate", &controllers.BulletinController{}, "post:OperateBulletin"),
),
beego.NSNamespace("/common",
beego.NSRouter("/department", &controllers.CommonController{}, "post:SelectorDepartment"),
beego.NSRouter("/role", &controllers.CommonController{}, "post:SelectorRole"),
beego.NSRouter("/position", &controllers.CommonController{}, "post:SelectorPosition"),
),
beego.NSNamespace("/template",
beego.NSRouter("/add", &controllers.TemplateController{}, "post:TemplateAdd"),
beego.NSRouter("/list", &controllers.TemplateController{}, "post:TemplateList"),
beego.NSRouter("/get", &controllers.TemplateController{}, "post:TemplateGet"),
beego.NSRouter("/update", &controllers.TemplateController{}, "post:TemplateUpdate"),
beego.NSRouter("/editVisible", &controllers.TemplateController{}, "post:TemplateEditVisible"),
beego.NSRouter("/operateCategory", &controllers.TemplateController{}, "post:TemplateOperateCategory"),
),
)
nsAuth := beego.NewNamespace("/auth",
beego.NSBefore(middleware.AllowOption),
beego.NSBefore(middleware.LogRequestData),
beego.NSRouter("/login", &controllers.AuthController{}, "post:Login"),
)
nsUcenter := beego.NewNamespace("/ucenter",
beego.NSBefore(middleware.LogRequestData),
beego.NSRouter("/company", &controllers.CompanyController{}, "post:InitCompany"),
)
beego.AddNamespace(nsV1)
beego.AddNamespace(nsAuth)
beego.AddNamespace(nsUcenter)
}
//routerPermission 路由对应的权限
// var routerPermission = map[string]string{
// : "show",
// "post:/v1/company/position": "add",
// "put:/v1/company/position": "edit",
// "delete:/v1/company/position": "delete",
// }