增加添加部门接口
This commit is contained in:
@@ -11,7 +11,7 @@ import (
|
||||
"fusenapi/server/ldap-admin/internal/types"
|
||||
)
|
||||
|
||||
func GetDepartmentsHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
||||
func GetOrganizationsHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
||||
return func(w http.ResponseWriter, r *http.Request) {
|
||||
|
||||
var req types.Request
|
||||
@@ -21,12 +21,12 @@ func GetDepartmentsHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
||||
}
|
||||
|
||||
// 创建一个业务逻辑层实例
|
||||
l := logic.NewGetDepartmentsLogic(r.Context(), svcCtx)
|
||||
l := logic.NewGetOrganizationsLogic(r.Context(), svcCtx)
|
||||
|
||||
rl := reflect.ValueOf(l)
|
||||
basic.BeforeLogic(w, r, rl)
|
||||
|
||||
resp := l.GetDepartments(&req, userinfo)
|
||||
resp := l.GetOrganizations(&req, userinfo)
|
||||
|
||||
if !basic.AfterLogic(w, r, rl, resp) {
|
||||
basic.NormalAfterLogic(w, r, resp)
|
||||
@@ -44,8 +44,8 @@ func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) {
|
||||
},
|
||||
{
|
||||
Method: http.MethodGet,
|
||||
Path: "/api/ldap-admin/get_departments",
|
||||
Handler: GetDepartmentsHandler(serverCtx),
|
||||
Path: "/api/ldap-admin/get_organizations",
|
||||
Handler: GetOrganizationsHandler(serverCtx),
|
||||
},
|
||||
{
|
||||
Method: http.MethodPost,
|
||||
|
||||
Reference in New Issue
Block a user