From a8cddf020fa007f6bcbe510048380f2ef6a6576b Mon Sep 17 00:00:00 2001 From: laodaming <11058467+laudamine@user.noreply.gitee.com> Date: Thu, 16 Nov 2023 16:59:51 +0800 Subject: [PATCH] fix --- ...ationshandler.go => getldaporginationshandler.go} | 6 +++--- server/ldap-admin/internal/handler/routes.go | 2 +- ...rginationslogic.go => getldaporginationslogic.go} | 12 ++++++------ server_api/ldap-admin.api | 2 +- 4 files changed, 11 insertions(+), 11 deletions(-) rename server/ldap-admin/internal/handler/{getorginationshandler.go => getldaporginationshandler.go} (75%) rename server/ldap-admin/internal/logic/{getorginationslogic.go => getldaporginationslogic.go} (86%) diff --git a/server/ldap-admin/internal/handler/getorginationshandler.go b/server/ldap-admin/internal/handler/getldaporginationshandler.go similarity index 75% rename from server/ldap-admin/internal/handler/getorginationshandler.go rename to server/ldap-admin/internal/handler/getldaporginationshandler.go index 2b64abcb..0ba2eb2a 100644 --- a/server/ldap-admin/internal/handler/getorginationshandler.go +++ b/server/ldap-admin/internal/handler/getldaporginationshandler.go @@ -11,7 +11,7 @@ import ( "fusenapi/server/ldap-admin/internal/types" ) -func GetorginationsHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { +func GetLdapOrginationsHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { var req types.Request @@ -21,12 +21,12 @@ func GetorginationsHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { } // 创建一个业务逻辑层实例 - l := logic.NewGetorginationsLogic(r.Context(), svcCtx) + l := logic.NewGetLdapOrginationsLogic(r.Context(), svcCtx) rl := reflect.ValueOf(l) basic.BeforeLogic(w, r, rl) - resp := l.Getorginations(&req, userinfo) + resp := l.GetLdapOrginations(&req, userinfo) if !basic.AfterLogic(w, r, rl, resp) { basic.NormalAfterLogic(w, r, resp) diff --git a/server/ldap-admin/internal/handler/routes.go b/server/ldap-admin/internal/handler/routes.go index 0c0edc2e..f17e1a45 100644 --- a/server/ldap-admin/internal/handler/routes.go +++ b/server/ldap-admin/internal/handler/routes.go @@ -45,7 +45,7 @@ func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) { { Method: http.MethodGet, Path: "/api/ldap-admin/get_ldap_orginations", - Handler: GetorginationsHandler(serverCtx), + Handler: GetLdapOrginationsHandler(serverCtx), }, { Method: http.MethodPost, diff --git a/server/ldap-admin/internal/logic/getorginationslogic.go b/server/ldap-admin/internal/logic/getldaporginationslogic.go similarity index 86% rename from server/ldap-admin/internal/logic/getorginationslogic.go rename to server/ldap-admin/internal/logic/getldaporginationslogic.go index 8e42358f..3a2d3707 100644 --- a/server/ldap-admin/internal/logic/getorginationslogic.go +++ b/server/ldap-admin/internal/logic/getldaporginationslogic.go @@ -15,14 +15,14 @@ import ( "github.com/zeromicro/go-zero/core/logx" ) -type GetorginationsLogic struct { +type GetLdapOrginationsLogic struct { logx.Logger ctx context.Context svcCtx *svc.ServiceContext } -func NewGetorginationsLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetorginationsLogic { - return &GetorginationsLogic{ +func NewGetLdapOrginationsLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetLdapOrginationsLogic { + return &GetLdapOrginationsLogic{ Logger: logx.WithContext(ctx), ctx: ctx, svcCtx: svcCtx, @@ -30,7 +30,7 @@ func NewGetorginationsLogic(ctx context.Context, svcCtx *svc.ServiceContext) *Ge } // 处理进入前逻辑w,r -// func (l *GetorginationsLogic) BeforeLogic(w http.ResponseWriter, r *http.Request) { +// func (l *GetLdapOrginationsLogic) BeforeLogic(w http.ResponseWriter, r *http.Request) { // } type DNItem struct { Attribute map[string]interface{} `json:"attribute"` @@ -40,7 +40,7 @@ type DNItem struct { Child []*DNItem `json:"child"` } -func (l *GetorginationsLogic) Getorginations(req *types.Request, userinfo *auth.UserInfo) (resp *basic.Response) { +func (l *GetLdapOrginationsLogic) GetLdapOrginations(req *types.Request, userinfo *auth.UserInfo) (resp *basic.Response) { //从ldap获取组织架构数据 rootCn := strings.Split(l.svcCtx.Config.Ldap.RootDN, ",") if len(rootCn) == 0 { @@ -119,6 +119,6 @@ func (l *GetorginationsLogic) Getorginations(req *types.Request, userinfo *auth. } // 处理逻辑后 w,r 如:重定向, resp 必须重新处理 -// func (l *GetorginationsLogic) AfterLogic(w http.ResponseWriter, r *http.Request, resp *basic.Response) { +// func (l *GetLdapOrginationsLogic) AfterLogic(w http.ResponseWriter, r *http.Request, resp *basic.Response) { // // httpx.OkJsonCtx(r.Context(), w, resp) // } diff --git a/server_api/ldap-admin.api b/server_api/ldap-admin.api index e2b65bdf..700cefb3 100644 --- a/server_api/ldap-admin.api +++ b/server_api/ldap-admin.api @@ -31,7 +31,7 @@ service ldap-admin { @handler GetMenusHandler get /api/ldap-admin/get_menus(GetMenusReq) returns (response); //获取ldap组织列表 - @handler GetorginationsHandler + @handler GetLdapOrginationsHandler get /api/ldap-admin/get_ldap_orginations(request) returns (response); //增加ldap组织 @handler CreateLdapOrginationHandler