Files
schisandra-album-cloud-micr…/app/auth/internal/handler/user/account_login_handler.go
landaiqing 97ca3fc7b0 🎉 init
2024-11-12 17:00:16 +08:00

29 lines
749 B
Go

package user
import (
"net/http"
"github.com/zeromicro/go-zero/rest/httpx"
"schisandra-album-cloud-microservices/app/auth/internal/logic/user"
"schisandra-album-cloud-microservices/app/auth/internal/svc"
"schisandra-album-cloud-microservices/app/auth/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 {
httpx.ErrorCtx(r.Context(), w, err)
return
}
l := user.NewAccountLoginLogic(r.Context(), svcCtx)
resp, err := l.AccountLogin(&req)
if err != nil {
httpx.ErrorCtx(r.Context(), w, err)
} else {
httpx.OkJsonCtx(r.Context(), w, resp)
}
}
}