🏗️ microservice fabric splitting

This commit is contained in:
2024-12-24 00:38:41 +08:00
parent 462e811742
commit 89d64336f5
311 changed files with 18384 additions and 2428 deletions

View File

@@ -0,0 +1,21 @@
package captcha
import (
"net/http"
"schisandra-album-cloud-microservices/common/xhttp"
"schisandra-album-cloud-microservices/app/auth/api/internal/logic/captcha"
"schisandra-album-cloud-microservices/app/auth/api/internal/svc"
)
func GenerateRotateCaptchaHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
l := captcha.NewGenerateRotateCaptchaLogic(r.Context(), svcCtx)
resp, err := l.GenerateRotateCaptcha()
if err != nil {
xhttp.JsonBaseResponseCtx(r.Context(), w, err)
} else {
xhttp.JsonBaseResponseCtx(r.Context(), w, resp)
}
}
}

View File

@@ -0,0 +1,21 @@
package captcha
import (
"net/http"
"schisandra-album-cloud-microservices/common/xhttp"
"schisandra-album-cloud-microservices/app/auth/api/internal/logic/captcha"
"schisandra-album-cloud-microservices/app/auth/api/internal/svc"
)
func GenerateSlideBasicCaptchaHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
l := captcha.NewGenerateSlideBasicCaptchaLogic(r.Context(), svcCtx)
resp, err := l.GenerateSlideBasicCaptcha()
if err != nil {
xhttp.JsonBaseResponseCtx(r.Context(), w, err)
} else {
xhttp.JsonBaseResponseCtx(r.Context(), w, resp)
}
}
}

View File

@@ -0,0 +1,23 @@
package client
import (
"net/http"
"schisandra-album-cloud-microservices/common/utils"
"schisandra-album-cloud-microservices/common/xhttp"
"schisandra-album-cloud-microservices/app/auth/api/internal/logic/client"
"schisandra-album-cloud-microservices/app/auth/api/internal/svc"
)
func GenerateClientIdHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
clientIP := utils.GetClientIP(r)
l := client.NewGenerateClientIdLogic(r.Context(), svcCtx)
resp, err := l.GenerateClientId(clientIP)
if err != nil {
xhttp.JsonBaseResponseCtx(r.Context(), w, err)
} else {
xhttp.JsonBaseResponseCtx(r.Context(), w, resp)
}
}
}

View File

@@ -0,0 +1,21 @@
package oauth
import (
"net/http"
"schisandra-album-cloud-microservices/common/xhttp"
"schisandra-album-cloud-microservices/app/auth/api/internal/logic/oauth"
"schisandra-album-cloud-microservices/app/auth/api/internal/svc"
)
func GetGiteeOauthUrlHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
l := oauth.NewGetGiteeOauthUrlLogic(r.Context(), svcCtx)
resp, err := l.GetGiteeOauthUrl()
if err != nil {
xhttp.JsonBaseResponseCtx(r.Context(), w, err)
} else {
xhttp.JsonBaseResponseCtx(r.Context(), w, resp)
}
}
}

View File

@@ -0,0 +1,29 @@
package oauth
import (
"github.com/zeromicro/go-zero/rest/httpx"
"net/http"
"schisandra-album-cloud-microservices/common/xhttp"
"schisandra-album-cloud-microservices/app/auth/api/internal/logic/oauth"
"schisandra-album-cloud-microservices/app/auth/api/internal/svc"
"schisandra-album-cloud-microservices/app/auth/api/internal/types"
)
func GetGithubOauthUrlHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.OAuthRequest
if err := httpx.Parse(r, &req); err != nil {
httpx.ErrorCtx(r.Context(), w, err)
return
}
l := oauth.NewGetGithubOauthUrlLogic(r.Context(), svcCtx)
resp, err := l.GetGithubOauthUrl(&req)
if err != nil {
xhttp.JsonBaseResponseCtx(r.Context(), w, err)
} else {
xhttp.JsonBaseResponseCtx(r.Context(), w, resp)
}
}
}

View File

@@ -0,0 +1,29 @@
package oauth
import (
"github.com/zeromicro/go-zero/rest/httpx"
"net/http"
"schisandra-album-cloud-microservices/common/xhttp"
"schisandra-album-cloud-microservices/app/auth/api/internal/logic/oauth"
"schisandra-album-cloud-microservices/app/auth/api/internal/svc"
"schisandra-album-cloud-microservices/app/auth/api/internal/types"
)
func GetQqOauthUrlHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.OAuthRequest
if err := httpx.Parse(r, &req); err != nil {
httpx.ErrorCtx(r.Context(), w, err)
return
}
l := oauth.NewGetQqOauthUrlLogic(r.Context(), svcCtx)
resp, err := l.GetQqOauthUrl(&req)
if err != nil {
xhttp.JsonBaseResponseCtx(r.Context(), w, err)
} else {
xhttp.JsonBaseResponseCtx(r.Context(), w, resp)
}
}
}

View File

@@ -0,0 +1,29 @@
package oauth
import (
"github.com/zeromicro/go-zero/rest/httpx"
"net/http"
"schisandra-album-cloud-microservices/common/xhttp"
"schisandra-album-cloud-microservices/app/auth/api/internal/logic/oauth"
"schisandra-album-cloud-microservices/app/auth/api/internal/svc"
"schisandra-album-cloud-microservices/app/auth/api/internal/types"
)
func GiteeCallbackHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.OAuthCallbackRequest
if err := httpx.Parse(r, &req); err != nil {
xhttp.JsonBaseResponseCtx(r.Context(), w, err)
return
}
l := oauth.NewGiteeCallbackLogic(r.Context(), svcCtx)
data, err := l.GiteeCallback(r, &req)
if err != nil {
xhttp.JsonBaseResponseCtx(r.Context(), w, err)
} else {
xhttp.OkHTML(w, data)
}
}
}

View File

@@ -0,0 +1,28 @@
package oauth
import (
"github.com/zeromicro/go-zero/rest/httpx"
"net/http"
"schisandra-album-cloud-microservices/app/auth/api/internal/logic/oauth"
"schisandra-album-cloud-microservices/app/auth/api/internal/svc"
"schisandra-album-cloud-microservices/app/auth/api/internal/types"
"schisandra-album-cloud-microservices/common/xhttp"
)
func GithubCallbackHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.OAuthCallbackRequest
if err := httpx.Parse(r, &req); err != nil {
xhttp.JsonBaseResponseCtx(r.Context(), w, err)
return
}
l := oauth.NewGithubCallbackLogic(r.Context(), svcCtx)
data, err := l.GithubCallback(r, &req)
if err != nil {
xhttp.JsonBaseResponseCtx(r.Context(), w, err)
} else {
xhttp.OkHTML(w, data)
}
}
}

View File

@@ -0,0 +1,28 @@
package oauth
import (
"github.com/zeromicro/go-zero/rest/httpx"
"net/http"
"schisandra-album-cloud-microservices/app/auth/api/internal/logic/oauth"
"schisandra-album-cloud-microservices/app/auth/api/internal/svc"
"schisandra-album-cloud-microservices/app/auth/api/internal/types"
"schisandra-album-cloud-microservices/common/xhttp"
)
func QqCallbackHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.OAuthCallbackRequest
if err := httpx.Parse(r, &req); err != nil {
xhttp.JsonBaseResponseCtx(r.Context(), w, err)
return
}
l := oauth.NewQqCallbackLogic(r.Context(), svcCtx)
data, err := l.QqCallback(r, &req)
if err != nil {
xhttp.JsonBaseResponseCtx(r.Context(), w, err)
} else {
xhttp.OkHTML(w, data)
}
}
}

View File

@@ -0,0 +1,21 @@
package oauth
import (
"github.com/ArtisanCloud/PowerLibs/v3/http/helper"
"net/http"
"schisandra-album-cloud-microservices/app/auth/api/internal/logic/oauth"
"schisandra-album-cloud-microservices/app/auth/api/internal/svc"
"schisandra-album-cloud-microservices/common/xhttp"
)
func WechatOffiaccountCallbackHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
l := oauth.NewWechatOffiaccountCallbackLogic(r.Context(), svcCtx)
res, err := l.WechatOffiaccountCallback(r)
if err != nil {
xhttp.JsonBaseResponseCtx(r.Context(), w, err)
} else {
_ = helper.HttpResponseSend(res, w)
}
}
}

View File

@@ -0,0 +1,21 @@
package oauth
import (
"github.com/ArtisanCloud/PowerLibs/v3/http/helper"
"net/http"
"schisandra-album-cloud-microservices/app/auth/api/internal/logic/oauth"
"schisandra-album-cloud-microservices/app/auth/api/internal/svc"
"schisandra-album-cloud-microservices/common/xhttp"
)
func WechatOffiaccountCallbackVerifyHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
l := oauth.NewWechatOffiaccountCallbackVerifyLogic(r.Context(), svcCtx)
res, err := l.WechatOffiaccountCallbackVerify(r)
if err != nil {
xhttp.JsonBaseResponseCtx(r.Context(), w, err)
} else {
_ = helper.HttpResponseSend(res, w)
}
}
}

View File

@@ -0,0 +1,206 @@
// Code generated by goctl. DO NOT EDIT.
// goctl 1.7.3
package handler
import (
"net/http"
"time"
captcha "schisandra-album-cloud-microservices/app/auth/api/internal/handler/captcha"
client "schisandra-album-cloud-microservices/app/auth/api/internal/handler/client"
oauth "schisandra-album-cloud-microservices/app/auth/api/internal/handler/oauth"
sms "schisandra-album-cloud-microservices/app/auth/api/internal/handler/sms"
token "schisandra-album-cloud-microservices/app/auth/api/internal/handler/token"
user "schisandra-album-cloud-microservices/app/auth/api/internal/handler/user"
websocket "schisandra-album-cloud-microservices/app/auth/api/internal/handler/websocket"
"schisandra-album-cloud-microservices/app/auth/api/internal/svc"
"github.com/zeromicro/go-zero/rest"
)
func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) {
server.AddRoutes(
rest.WithMiddlewares(
[]rest.Middleware{serverCtx.SecurityHeadersMiddleware, serverCtx.NonceMiddleware},
[]rest.Route{
{
Method: http.MethodGet,
Path: "/rotate/generate",
Handler: captcha.GenerateRotateCaptchaHandler(serverCtx),
},
{
Method: http.MethodGet,
Path: "/slide/generate",
Handler: captcha.GenerateSlideBasicCaptchaHandler(serverCtx),
},
}...,
),
rest.WithPrefix("/api/captcha"),
rest.WithTimeout(10000*time.Millisecond),
rest.WithMaxBytes(1048576),
)
server.AddRoutes(
rest.WithMiddlewares(
[]rest.Middleware{serverCtx.SecurityHeadersMiddleware, serverCtx.NonceMiddleware},
[]rest.Route{
{
Method: http.MethodGet,
Path: "/generate",
Handler: client.GenerateClientIdHandler(serverCtx),
},
}...,
),
rest.WithPrefix("/api/client"),
rest.WithTimeout(10000*time.Millisecond),
rest.WithMaxBytes(1048576),
)
server.AddRoutes(
rest.WithMiddlewares(
[]rest.Middleware{serverCtx.SecurityHeadersMiddleware},
[]rest.Route{
{
Method: http.MethodGet,
Path: "/gitee/callback",
Handler: oauth.GiteeCallbackHandler(serverCtx),
},
{
Method: http.MethodGet,
Path: "/gitee/url",
Handler: oauth.GetGiteeOauthUrlHandler(serverCtx),
},
{
Method: http.MethodGet,
Path: "/github/callback",
Handler: oauth.GithubCallbackHandler(serverCtx),
},
{
Method: http.MethodGet,
Path: "/github/url",
Handler: oauth.GetGithubOauthUrlHandler(serverCtx),
},
{
Method: http.MethodGet,
Path: "/qq/callback",
Handler: oauth.QqCallbackHandler(serverCtx),
},
{
Method: http.MethodGet,
Path: "/qq/url",
Handler: oauth.GetQqOauthUrlHandler(serverCtx),
},
{
Method: http.MethodPost,
Path: "/wechat/offiaccount/callback",
Handler: oauth.WechatOffiaccountCallbackHandler(serverCtx),
},
{
Method: http.MethodGet,
Path: "/wechat/offiaccount/callback",
Handler: oauth.WechatOffiaccountCallbackVerifyHandler(serverCtx),
},
}...,
),
rest.WithPrefix("/api/oauth"),
rest.WithTimeout(10000*time.Millisecond),
rest.WithMaxBytes(1048576),
)
server.AddRoutes(
rest.WithMiddlewares(
[]rest.Middleware{serverCtx.SecurityHeadersMiddleware, serverCtx.NonceMiddleware},
[]rest.Route{
{
Method: http.MethodPost,
Path: "/ali/send",
Handler: sms.SendSmsByAliyunHandler(serverCtx),
},
{
Method: http.MethodPost,
Path: "/smsbao/send",
Handler: sms.SendSmsBySmsbaoHandler(serverCtx),
},
{
Method: http.MethodPost,
Path: "/test/send",
Handler: sms.SendSmsByTestHandler(serverCtx),
},
}...,
),
rest.WithPrefix("/api/sms"),
rest.WithTimeout(10000*time.Millisecond),
rest.WithMaxBytes(1048576),
)
server.AddRoutes(
rest.WithMiddlewares(
[]rest.Middleware{serverCtx.SecurityHeadersMiddleware, serverCtx.CasbinVerifyMiddleware, serverCtx.NonceMiddleware},
[]rest.Route{
{
Method: http.MethodPost,
Path: "/token/refresh",
Handler: token.RefreshTokenHandler(serverCtx),
},
}...,
),
rest.WithSignature(serverCtx.Config.Signature),
rest.WithPrefix("/api/auth"),
rest.WithTimeout(10000*time.Millisecond),
rest.WithMaxBytes(1048576),
)
server.AddRoutes(
rest.WithMiddlewares(
[]rest.Middleware{serverCtx.SecurityHeadersMiddleware, serverCtx.NonceMiddleware},
[]rest.Route{
{
Method: http.MethodPost,
Path: "/login",
Handler: user.AccountLoginHandler(serverCtx),
},
{
Method: http.MethodPost,
Path: "/phone/login",
Handler: user.PhoneLoginHandler(serverCtx),
},
{
Method: http.MethodPost,
Path: "/reset/password",
Handler: user.ResetPasswordHandler(serverCtx),
},
{
Method: http.MethodPost,
Path: "/wechat/offiaccount/login",
Handler: user.WechatOffiaccountLoginHandler(serverCtx),
},
{
Method: http.MethodPost,
Path: "/wechat/offiaccount/qrcode",
Handler: user.GetWechatOffiaccountQrcodeHandler(serverCtx),
},
}...,
),
rest.WithSignature(serverCtx.Config.Signature),
rest.WithPrefix("/api/user"),
rest.WithTimeout(10000*time.Millisecond),
rest.WithMaxBytes(1048576),
)
server.AddRoutes(
[]rest.Route{
{
Method: http.MethodGet,
Path: "/message",
Handler: websocket.MessageWebsocketHandler(serverCtx),
},
{
Method: http.MethodGet,
Path: "/qrcode",
Handler: websocket.QrcodeWebsocketHandler(serverCtx),
},
},
rest.WithPrefix("/api/ws"),
)
}

View File

@@ -0,0 +1,25 @@
package sms
import (
"github.com/zeromicro/go-zero/rest/httpx"
"net/http"
"schisandra-album-cloud-microservices/common/xhttp"
"schisandra-album-cloud-microservices/app/auth/api/internal/logic/sms"
"schisandra-album-cloud-microservices/app/auth/api/internal/svc"
"schisandra-album-cloud-microservices/app/auth/api/internal/types"
)
func SendSmsByAliyunHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.SmsSendRequest
if err := httpx.Parse(r, &req); err != nil {
xhttp.JsonBaseResponseCtx(r.Context(), w, err)
return
}
l := sms.NewSendSmsByAliyunLogic(r.Context(), svcCtx)
err := l.SendSmsByAliyun(&req)
xhttp.JsonBaseResponseCtx(r.Context(), w, err)
}
}

View File

@@ -0,0 +1,25 @@
package sms
import (
"github.com/zeromicro/go-zero/rest/httpx"
"net/http"
"schisandra-album-cloud-microservices/common/xhttp"
"schisandra-album-cloud-microservices/app/auth/api/internal/logic/sms"
"schisandra-album-cloud-microservices/app/auth/api/internal/svc"
"schisandra-album-cloud-microservices/app/auth/api/internal/types"
)
func SendSmsBySmsbaoHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.SmsSendRequest
if err := httpx.Parse(r, &req); err != nil {
xhttp.JsonBaseResponseCtx(r.Context(), w, err)
return
}
l := sms.NewSendSmsBySmsbaoLogic(r.Context(), svcCtx)
err := l.SendSmsBySmsbao(&req)
xhttp.JsonBaseResponseCtx(r.Context(), w, err)
}
}

View File

@@ -0,0 +1,25 @@
package sms
import (
"github.com/zeromicro/go-zero/rest/httpx"
"net/http"
"schisandra-album-cloud-microservices/common/xhttp"
"schisandra-album-cloud-microservices/app/auth/api/internal/logic/sms"
"schisandra-album-cloud-microservices/app/auth/api/internal/svc"
"schisandra-album-cloud-microservices/app/auth/api/internal/types"
)
func SendSmsByTestHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.SmsSendRequest
if err := httpx.Parse(r, &req); err != nil {
xhttp.JsonBaseResponseCtx(r.Context(), w, err)
return
}
l := sms.NewSendSmsByTestLogic(r.Context(), svcCtx)
err := l.SendSmsByTest(&req)
xhttp.JsonBaseResponseCtx(r.Context(), w, err)
}
}

View File

@@ -0,0 +1,21 @@
package token
import (
"net/http"
"schisandra-album-cloud-microservices/common/xhttp"
"schisandra-album-cloud-microservices/app/auth/api/internal/logic/token"
"schisandra-album-cloud-microservices/app/auth/api/internal/svc"
)
func RefreshTokenHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
l := token.NewRefreshTokenLogic(r.Context(), svcCtx)
resp, err := l.RefreshToken(r)
if err != nil {
xhttp.JsonBaseResponseCtx(r.Context(), w, err)
} else {
xhttp.JsonBaseResponseCtx(r.Context(), w, resp)
}
}
}

View File

@@ -0,0 +1,29 @@
package user
import (
"github.com/zeromicro/go-zero/rest/httpx"
"net/http"
"schisandra-album-cloud-microservices/common/xhttp"
"schisandra-album-cloud-microservices/app/auth/api/internal/logic/user"
"schisandra-album-cloud-microservices/app/auth/api/internal/svc"
"schisandra-album-cloud-microservices/app/auth/api/internal/types"
)
func AccountLoginHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.AccountLoginRequest
if err := httpx.Parse(r, &req); err != nil {
xhttp.JsonBaseResponseCtx(r.Context(), w, err)
return
}
l := user.NewAccountLoginLogic(r.Context(), svcCtx)
resp, err := l.AccountLogin(r, &req)
if err != nil {
xhttp.JsonBaseResponseCtx(r.Context(), w, err)
} else {
xhttp.JsonBaseResponseCtx(r.Context(), w, resp)
}
}
}

View File

@@ -0,0 +1,28 @@
package user
import (
"github.com/zeromicro/go-zero/rest/httpx"
"net/http"
"schisandra-album-cloud-microservices/app/auth/api/internal/logic/user"
"schisandra-album-cloud-microservices/app/auth/api/internal/svc"
"schisandra-album-cloud-microservices/app/auth/api/internal/types"
"schisandra-album-cloud-microservices/common/xhttp"
)
func GetWechatOffiaccountQrcodeHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.OAuthWechatRequest
if err := httpx.Parse(r, &req); err != nil {
xhttp.JsonBaseResponseCtx(r.Context(), w, err)
return
}
l := user.NewGetWechatOffiaccountQrcodeLogic(r.Context(), svcCtx)
resp, err := l.GetWechatOffiaccountQrcode(r, &req)
if err != nil {
xhttp.JsonBaseResponseCtx(r.Context(), w, err)
} else {
xhttp.JsonBaseResponseCtx(r.Context(), w, resp)
}
}
}

View File

@@ -0,0 +1,29 @@
package user
import (
"github.com/zeromicro/go-zero/rest/httpx"
"net/http"
"schisandra-album-cloud-microservices/common/xhttp"
"schisandra-album-cloud-microservices/app/auth/api/internal/logic/user"
"schisandra-album-cloud-microservices/app/auth/api/internal/svc"
"schisandra-album-cloud-microservices/app/auth/api/internal/types"
)
func PhoneLoginHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.PhoneLoginRequest
if err := httpx.Parse(r, &req); err != nil {
xhttp.JsonBaseResponseCtx(r.Context(), w, err)
return
}
l := user.NewPhoneLoginLogic(r.Context(), svcCtx)
resp, err := l.PhoneLogin(r, &req)
if err != nil {
xhttp.JsonBaseResponseCtx(r.Context(), w, err)
} else {
xhttp.JsonBaseResponseCtx(r.Context(), w, resp)
}
}
}

View File

@@ -0,0 +1,24 @@
package user
import (
"github.com/zeromicro/go-zero/rest/httpx"
"net/http"
"schisandra-album-cloud-microservices/common/xhttp"
"schisandra-album-cloud-microservices/app/auth/api/internal/logic/user"
"schisandra-album-cloud-microservices/app/auth/api/internal/svc"
"schisandra-album-cloud-microservices/app/auth/api/internal/types"
)
func ResetPasswordHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.ResetPasswordRequest
if err := httpx.Parse(r, &req); err != nil {
xhttp.JsonBaseResponseCtx(r.Context(), w, err)
return
}
l := user.NewResetPasswordLogic(r.Context(), svcCtx)
err := l.ResetPassword(&req)
xhttp.JsonBaseResponseCtx(r.Context(), w, err)
}
}

View File

@@ -0,0 +1,28 @@
package user
import (
"github.com/zeromicro/go-zero/rest/httpx"
"net/http"
"schisandra-album-cloud-microservices/app/auth/api/internal/logic/user"
"schisandra-album-cloud-microservices/app/auth/api/internal/svc"
"schisandra-album-cloud-microservices/app/auth/api/internal/types"
"schisandra-album-cloud-microservices/common/xhttp"
)
func WechatOffiaccountLoginHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.WechatOffiaccountLoginRequest
if err := httpx.Parse(r, &req); err != nil {
xhttp.JsonBaseResponseCtx(r.Context(), w, err)
return
}
l := user.NewWechatOffiaccountLoginLogic(r.Context(), svcCtx)
resp, err := l.WechatOffiaccountLogin(r, &req)
if err != nil {
xhttp.JsonBaseResponseCtx(r.Context(), w, err)
} else {
xhttp.JsonBaseResponseCtx(r.Context(), w, resp)
}
}
}

View File

@@ -0,0 +1,15 @@
package websocket
import (
"net/http"
"schisandra-album-cloud-microservices/app/auth/api/internal/logic/websocket"
"schisandra-album-cloud-microservices/app/auth/api/internal/svc"
)
func MessageWebsocketHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
l := websocket.NewMessageWebsocketLogic(r.Context(), svcCtx)
l.MessageWebsocket(w, r)
}
}

View File

@@ -0,0 +1,15 @@
package websocket
import (
"net/http"
"schisandra-album-cloud-microservices/app/auth/api/internal/logic/websocket"
"schisandra-album-cloud-microservices/app/auth/api/internal/svc"
)
func QrcodeWebsocketHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
l := websocket.NewQrcodeWebsocketLogic(r.Context(), svcCtx)
l.QrcodeWebsocket(w, r)
}
}