🚧 developing...

This commit is contained in:
2025-03-27 01:01:30 +08:00
parent 781a71a27c
commit afcd128256
30 changed files with 1696 additions and 44 deletions

View File

@@ -381,6 +381,16 @@ func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) {
Path: "/image/all/list",
Handler: storage.QueryAllImageListHandler(serverCtx),
},
{
Method: http.MethodPost,
Path: "/image/bed/upload",
Handler: storage.ImageBedUploadHandler(serverCtx),
},
{
Method: http.MethodPost,
Path: "/image/bed/upload/list",
Handler: storage.GetImageBedUploadListHandler(serverCtx),
},
{
Method: http.MethodPost,
Path: "/image/delete",
@@ -411,6 +421,11 @@ func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) {
Path: "/image/recent/list",
Handler: storage.QueryRecentImageListHandler(serverCtx),
},
{
Method: http.MethodPost,
Path: "/image/recover",
Handler: storage.RecoverImageHandler(serverCtx),
},
{
Method: http.MethodPost,
Path: "/image/search",
@@ -468,11 +483,41 @@ func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) {
rest.WithMiddlewares(
[]rest.Middleware{serverCtx.SecurityHeadersMiddleware, serverCtx.CasbinVerifyMiddleware, serverCtx.NonceMiddleware, serverCtx.AuthMiddleware},
[]rest.Route{
{
Method: http.MethodPost,
Path: "/comment/list",
Handler: system.GetAllCommentListHandler(serverCtx),
},
{
Method: http.MethodPost,
Path: "/permission/rule/list",
Handler: system.GetPermissionRuleListHandler(serverCtx),
},
{
Method: http.MethodPost,
Path: "/role/list",
Handler: system.GetAllRoleListHandler(serverCtx),
},
{
Method: http.MethodPost,
Path: "/user/list",
Handler: system.GetUserListHandler(serverCtx),
},
{
Method: http.MethodPost,
Path: "/user/login/log/list",
Handler: system.GetUserLoginLogListHandler(serverCtx),
},
{
Method: http.MethodPost,
Path: "/user/storage/config/list",
Handler: system.GetAllStorageListHandler(serverCtx),
},
{
Method: http.MethodPost,
Path: "/user/third/party/login/list",
Handler: system.GetUserThirdPartyLoginListHandler(serverCtx),
},
}...,
),
rest.WithJwt(serverCtx.Config.Auth.AccessSecret),

View File

@@ -0,0 +1,29 @@
package storage
import (
"net/http"
"github.com/zeromicro/go-zero/rest/httpx"
"schisandra-album-cloud-microservices/app/auth/api/internal/logic/storage"
"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 GetImageBedUploadListHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.ImageBedUploadListRequest
if err := httpx.Parse(r, &req); err != nil {
xhttp.JsonBaseResponseCtx(r.Context(), w, err)
return
}
l := storage.NewGetImageBedUploadListLogic(r.Context(), svcCtx)
resp, err := l.GetImageBedUploadList(&req)
if err != nil {
xhttp.JsonBaseResponseCtx(r.Context(), w, err)
} else {
xhttp.JsonBaseResponseCtx(r.Context(), w, resp)
}
}
}

View File

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

View File

@@ -0,0 +1,29 @@
package storage
import (
"net/http"
"github.com/zeromicro/go-zero/rest/httpx"
"schisandra-album-cloud-microservices/app/auth/api/internal/logic/storage"
"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 RecoverImageHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.RecoverImageRequest
if err := httpx.Parse(r, &req); err != nil {
xhttp.JsonBaseResponseCtx(r.Context(), w, err)
return
}
l := storage.NewRecoverImageLogic(r.Context(), svcCtx)
resp, err := l.RecoverImage(&req)
if err != nil {
xhttp.JsonBaseResponseCtx(r.Context(), w, err)
} else {
xhttp.JsonBaseResponseCtx(r.Context(), w, resp)
}
}
}

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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