🐛 fix session bug

This commit is contained in:
landaiqing
2024-11-17 20:02:59 +08:00
parent 34c4690f80
commit 78a162a19a
72 changed files with 1304 additions and 453 deletions

View File

@@ -3,7 +3,9 @@ package oauth
import (
"net/http"
"github.com/zeromicro/go-zero/core/logx"
"github.com/zeromicro/go-zero/rest/httpx"
"schisandra-album-cloud-microservices/app/core/api/internal/logic/oauth"
"schisandra-album-cloud-microservices/app/core/api/internal/svc"
)
@@ -13,7 +15,8 @@ func GetGiteeOauthUrlHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
l := oauth.NewGetGiteeOauthUrlLogic(r.Context(), svcCtx)
resp, err := l.GetGiteeOauthUrl()
if err != nil {
httpx.ErrorCtx(r.Context(), w, err)
logx.Error(err)
httpx.WriteJsonCtx(r.Context(), w, http.StatusInternalServerError, resp)
} else {
httpx.OkJsonCtx(r.Context(), w, resp)
}

View File

@@ -3,7 +3,9 @@ package oauth
import (
"net/http"
"github.com/zeromicro/go-zero/core/logx"
"github.com/zeromicro/go-zero/rest/httpx"
"schisandra-album-cloud-microservices/app/core/api/internal/logic/oauth"
"schisandra-album-cloud-microservices/app/core/api/internal/svc"
"schisandra-album-cloud-microservices/app/core/api/internal/types"
@@ -20,7 +22,8 @@ func GetGithubOauthUrlHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
l := oauth.NewGetGithubOauthUrlLogic(r.Context(), svcCtx)
resp, err := l.GetGithubOauthUrl(&req)
if err != nil {
httpx.ErrorCtx(r.Context(), w, err)
logx.Error(err)
httpx.WriteJsonCtx(r.Context(), w, http.StatusInternalServerError, resp)
} else {
httpx.OkJsonCtx(r.Context(), w, resp)
}

View File

@@ -3,7 +3,9 @@ package oauth
import (
"net/http"
"github.com/zeromicro/go-zero/core/logx"
"github.com/zeromicro/go-zero/rest/httpx"
"schisandra-album-cloud-microservices/app/core/api/internal/logic/oauth"
"schisandra-album-cloud-microservices/app/core/api/internal/svc"
"schisandra-album-cloud-microservices/app/core/api/internal/types"
@@ -20,7 +22,8 @@ func GetQqOauthUrlHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
l := oauth.NewGetQqOauthUrlLogic(r.Context(), svcCtx)
resp, err := l.GetQqOauthUrl(&req)
if err != nil {
httpx.ErrorCtx(r.Context(), w, err)
logx.Error(err)
httpx.WriteJsonCtx(r.Context(), w, http.StatusInternalServerError, resp)
} else {
httpx.OkJsonCtx(r.Context(), w, resp)
}

View File

@@ -3,6 +3,7 @@ package oauth
import (
"net/http"
"github.com/zeromicro/go-zero/core/logx"
"github.com/zeromicro/go-zero/rest/httpx"
"schisandra-album-cloud-microservices/app/core/api/internal/logic/oauth"
@@ -21,7 +22,8 @@ func GetWechatQrcodeHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
l := oauth.NewGetWechatQrcodeLogic(r.Context(), svcCtx)
resp, err := l.GetWechatQrcode(r, &req)
if err != nil {
httpx.ErrorCtx(r.Context(), w, err)
logx.Error(err)
httpx.WriteJsonCtx(r.Context(), w, http.StatusInternalServerError, resp)
} else {
httpx.OkJsonCtx(r.Context(), w, resp)
}

View File

@@ -1,8 +1,10 @@
package oauth
import (
"errors"
"net/http"
"github.com/zeromicro/go-zero/core/logx"
"github.com/zeromicro/go-zero/rest/httpx"
"schisandra-album-cloud-microservices/app/core/api/internal/logic/oauth"
@@ -21,7 +23,8 @@ func GiteeCallbackHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
l := oauth.NewGiteeCallbackLogic(r.Context(), svcCtx)
err := l.GiteeCallback(w, r, &req)
if err != nil {
httpx.ErrorCtx(r.Context(), w, err)
logx.Error(err)
httpx.ErrorCtx(r.Context(), w, errors.New("server error"))
} else {
httpx.Ok(w)
}

View File

@@ -1,8 +1,10 @@
package oauth
import (
"errors"
"net/http"
"github.com/zeromicro/go-zero/core/logx"
"github.com/zeromicro/go-zero/rest/httpx"
"schisandra-album-cloud-microservices/app/core/api/internal/logic/oauth"
@@ -21,7 +23,8 @@ func GithubCallbackHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
l := oauth.NewGithubCallbackLogic(r.Context(), svcCtx)
err := l.GithubCallback(w, r, &req)
if err != nil {
httpx.ErrorCtx(r.Context(), w, err)
logx.Error(err)
httpx.ErrorCtx(r.Context(), w, errors.New("server error"))
} else {
httpx.Ok(w)
}

View File

@@ -1,8 +1,10 @@
package oauth
import (
"errors"
"net/http"
"github.com/zeromicro/go-zero/core/logx"
"github.com/zeromicro/go-zero/rest/httpx"
"schisandra-album-cloud-microservices/app/core/api/internal/logic/oauth"
@@ -21,7 +23,8 @@ func QqCallbackHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
l := oauth.NewQqCallbackLogic(r.Context(), svcCtx)
err := l.QqCallback(w, r, &req)
if err != nil {
httpx.ErrorCtx(r.Context(), w, err)
logx.Error(err)
httpx.ErrorCtx(r.Context(), w, errors.New("server error"))
} else {
httpx.Ok(w)
}

View File

@@ -1,8 +1,10 @@
package oauth
import (
"errors"
"net/http"
"github.com/zeromicro/go-zero/core/logx"
"github.com/zeromicro/go-zero/rest/httpx"
"schisandra-album-cloud-microservices/app/core/api/internal/logic/oauth"
@@ -14,7 +16,8 @@ func WechatCallbackHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
l := oauth.NewWechatCallbackLogic(r.Context(), svcCtx)
err := l.WechatCallback(w, r)
if err != nil {
httpx.ErrorCtx(r.Context(), w, err)
logx.Error(err)
httpx.ErrorCtx(r.Context(), w, errors.New("server error"))
} else {
httpx.Ok(w)
}