This commit is contained in:
2026-06-19 11:27:53 +08:00
parent b16db987a7
commit 39079b9022
22 changed files with 1673 additions and 7 deletions

View File

@@ -0,0 +1,29 @@
package admin_query_whitelist
import (
"net/http"
"github.com/zeromicro/go-zero/rest/httpx"
"ycc-server/app/main/api/internal/logic/admin_query_whitelist"
"ycc-server/app/main/api/internal/svc"
"ycc-server/app/main/api/internal/types"
"ycc-server/common/result"
"ycc-server/pkg/lzkit/validator"
)
func AdminAppendQueryWhitelistHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.AdminAppendQueryWhitelistReq
if err := httpx.Parse(r, &req); err != nil {
result.ParamErrorResult(r, w, err)
return
}
if err := validator.Validate(req); err != nil {
result.ParamValidateErrorResult(r, w, err)
return
}
l := admin_query_whitelist.NewAdminAppendQueryWhitelistLogic(r.Context(), svcCtx)
resp, err := l.AdminAppendQueryWhitelist(&req)
result.HttpResult(r, w, resp, err)
}
}

View File

@@ -0,0 +1,29 @@
package admin_query_whitelist
import (
"net/http"
"github.com/zeromicro/go-zero/rest/httpx"
"ycc-server/app/main/api/internal/logic/admin_query_whitelist"
"ycc-server/app/main/api/internal/svc"
"ycc-server/app/main/api/internal/types"
"ycc-server/common/result"
"ycc-server/pkg/lzkit/validator"
)
func AdminCreateQueryWhitelistHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.AdminCreateQueryWhitelistReq
if err := httpx.Parse(r, &req); err != nil {
result.ParamErrorResult(r, w, err)
return
}
if err := validator.Validate(req); err != nil {
result.ParamValidateErrorResult(r, w, err)
return
}
l := admin_query_whitelist.NewAdminCreateQueryWhitelistLogic(r.Context(), svcCtx)
resp, err := l.AdminCreateQueryWhitelist(&req)
result.HttpResult(r, w, resp, err)
}
}

View File

@@ -0,0 +1,29 @@
package admin_query_whitelist
import (
"net/http"
"github.com/zeromicro/go-zero/rest/httpx"
"ycc-server/app/main/api/internal/logic/admin_query_whitelist"
"ycc-server/app/main/api/internal/svc"
"ycc-server/app/main/api/internal/types"
"ycc-server/common/result"
"ycc-server/pkg/lzkit/validator"
)
func AdminGetQueryWhitelistOpLogListHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.AdminGetQueryWhitelistOpLogListReq
if err := httpx.Parse(r, &req); err != nil {
result.ParamErrorResult(r, w, err)
return
}
if err := validator.Validate(req); err != nil {
result.ParamValidateErrorResult(r, w, err)
return
}
l := admin_query_whitelist.NewAdminGetQueryWhitelistOpLogListLogic(r.Context(), svcCtx)
resp, err := l.AdminGetQueryWhitelistOpLogList(&req)
result.HttpResult(r, w, resp, err)
}
}

View File

@@ -16,6 +16,7 @@ import (
admin_platform_user "ycc-server/app/main/api/internal/handler/admin_platform_user"
admin_product "ycc-server/app/main/api/internal/handler/admin_product"
admin_query "ycc-server/app/main/api/internal/handler/admin_query"
admin_query_whitelist "ycc-server/app/main/api/internal/handler/admin_query_whitelist"
admin_role "ycc-server/app/main/api/internal/handler/admin_role"
admin_role_api "ycc-server/app/main/api/internal/handler/admin_role_api"
admin_user "ycc-server/app/main/api/internal/handler/admin_user"
@@ -688,6 +689,30 @@ func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) {
rest.WithPrefix("/api/v1/admin/whitelist"),
)
server.AddRoutes(
rest.WithMiddlewares(
[]rest.Middleware{serverCtx.AdminAuthInterceptor},
[]rest.Route{
{
Method: http.MethodGet,
Path: "/op-log/list",
Handler: admin_query_whitelist.AdminGetQueryWhitelistOpLogListHandler(serverCtx),
},
{
Method: http.MethodPost,
Path: "/append",
Handler: admin_query_whitelist.AdminAppendQueryWhitelistHandler(serverCtx),
},
{
Method: http.MethodPost,
Path: "/create",
Handler: admin_query_whitelist.AdminCreateQueryWhitelistHandler(serverCtx),
},
}...,
),
rest.WithPrefix("/api/v1/admin/query-whitelist"),
)
server.AddRoutes(
[]rest.Route{
{