fusenapi/server/ldap-admin/internal/handler/createldaporganizationhandler.go

36 lines
785 B
Go
Raw Normal View History

2023-11-13 09:52:20 +00:00
package handler
import (
"net/http"
"reflect"
"fusenapi/utils/basic"
"fusenapi/server/ldap-admin/internal/logic"
"fusenapi/server/ldap-admin/internal/svc"
"fusenapi/server/ldap-admin/internal/types"
)
2023-11-17 02:33:40 +00:00
func CreateLdapOrganizationHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
2023-11-13 09:52:20 +00:00
return func(w http.ResponseWriter, r *http.Request) {
2023-11-17 02:33:40 +00:00
var req types.CreateLdapOrganizationReq
2023-11-13 09:52:20 +00:00
userinfo, err := basic.RequestParse(w, r, svcCtx, &req)
if err != nil {
return
}
// 创建一个业务逻辑层实例
2023-11-17 02:33:40 +00:00
l := logic.NewCreateLdapOrganizationLogic(r.Context(), svcCtx)
2023-11-13 09:52:20 +00:00
rl := reflect.ValueOf(l)
basic.BeforeLogic(w, r, rl)
2023-11-17 02:33:40 +00:00
resp := l.CreateLdapOrganization(&req, userinfo)
2023-11-13 09:52:20 +00:00
if !basic.AfterLogic(w, r, rl, resp) {
basic.NormalAfterLogic(w, r, resp)
}
}
}