diff --git a/goctl_template/api/main.tpl b/goctl_template/api/main.tpl index 6d173f86..f4a688cb 100644 --- a/goctl_template/api/main.tpl +++ b/goctl_template/api/main.tpl @@ -3,6 +3,10 @@ package main import ( "flag" "fmt" + "net/http" + "time" + + "fusenapi/utils/auth" {{.importPackages}} ) @@ -15,9 +19,7 @@ func main() { var c config.Config conf.MustLoad(*configFile, &c) c.Timeout = int64(time.Second * 15) - - server := rest.MustNewServer(c.RestConf, rest.WithCustomCors(auth.FsCors, func(w http.ResponseWriter) { - + server := rest.MustNewServer(c.RestConf, rest.WithCustomCors(auth.FsCors, func(w http.ResponseWriter) { })) defer server.Stop() diff --git a/goctl_template_backend/api/main.tpl b/goctl_template_backend/api/main.tpl index 1b353bcb..71e4fb99 100644 --- a/goctl_template_backend/api/main.tpl +++ b/goctl_template_backend/api/main.tpl @@ -3,6 +3,10 @@ package main import ( "flag" "fmt" + "net/http" + "time" + + "fusenapi/utils/auth" {{.importPackages}} ) @@ -16,9 +20,9 @@ func main() { conf.MustLoad(*configFile, &c) c.Timeout = int64(time.Second * 15) - server := rest.MustNewServer(c.RestConf, rest.WithCustomCors(auth.FsCors, func(w http.ResponseWriter) { - + server := rest.MustNewServer(c.RestConf, rest.WithCustomCors(auth.FsCors, func(w http.ResponseWriter) { })) + defer server.Stop() ctx := svc.NewServiceContext(c) diff --git a/server/assistant/assistant.go b/server/assistant/assistant.go index 2f0bf734..8ae0cf8e 100644 --- a/server/assistant/assistant.go +++ b/server/assistant/assistant.go @@ -3,6 +3,10 @@ package main import ( "flag" "fmt" + "net/http" + "time" + + "fusenapi/utils/auth" "fusenapi/server/assistant/internal/config" "fusenapi/server/assistant/internal/handler" @@ -20,9 +24,7 @@ func main() { var c config.Config conf.MustLoad(*configFile, &c) c.Timeout = int64(time.Second * 15) - server := rest.MustNewServer(c.RestConf, rest.WithCustomCors(auth.FsCors, func(w http.ResponseWriter) { - })) defer server.Stop() diff --git a/server/assistant/etc/assistant.yaml b/server/assistant/etc/assistant.yaml index 2c83cce3..4fd902f0 100644 --- a/server/assistant/etc/assistant.yaml +++ b/server/assistant/etc/assistant.yaml @@ -1,6 +1,6 @@ Name: assistant Host: 0.0.0.0 -Port: 8888 +Port: 9950 SourceMysql: "" Auth: AccessSecret: fusen2023 diff --git a/server/assistant/internal/logic/redirectlogic.go b/server/assistant/internal/logic/redirectlogic.go index d61d2a3a..a054a32d 100644 --- a/server/assistant/internal/logic/redirectlogic.go +++ b/server/assistant/internal/logic/redirectlogic.go @@ -1,8 +1,10 @@ package logic import ( + "fmt" "fusenapi/utils/auth" "fusenapi/utils/basic" + "net/http" "context" @@ -31,8 +33,31 @@ func NewRedirectLogic(ctx context.Context, svcCtx *svc.ServiceContext) *Redirect // } // 处理逻辑后 w,r 如:重定向 -// func (l *RedirectLogic) AfterLogic(w http.ResponseWriter, r *http.Request, resp *basic.Response) { -// } +func (l *RedirectLogic) AfterLogic(w http.ResponseWriter, r *http.Request, resp *basic.Response) { + html := ` + + +
+