This commit is contained in:
2025-12-09 18:55:28 +08:00
parent 8d00d67540
commit c23ab8338b
209 changed files with 5445 additions and 3963 deletions

View File

@@ -0,0 +1,31 @@
package agent
import (
"net/http"
"ycc-server/app/main/api/internal/logic/agent"
"ycc-server/app/main/api/internal/svc"
"ycc-server/app/main/api/internal/types"
"ycc-server/common/result"
"ycc-server/pkg/lzkit/validator"
"github.com/zeromicro/go-zero/rest/httpx"
)
func GetPromotionQueryListHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.GetPromotionQueryListReq
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 := agent.NewGetPromotionQueryListLogic(r.Context(), svcCtx)
resp, err := l.GetPromotionQueryList(&req)
result.HttpResult(r, w, resp, err)
}
}

View File

@@ -0,0 +1,17 @@
package app
import (
"net/http"
"ycc-server/app/main/api/internal/logic/app"
"ycc-server/app/main/api/internal/svc"
"ycc-server/common/result"
)
func GetAppConfigHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
l := app.NewGetAppConfigLogic(r.Context(), svcCtx)
resp, err := l.GetAppConfig()
result.HttpResult(r, w, resp, err)
}
}

View File

@@ -662,6 +662,11 @@ func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) {
Path: "/product_config",
Handler: agent.GetAgentProductConfigHandler(serverCtx),
},
{
Method: http.MethodGet,
Path: "/promotion/query/list",
Handler: agent.GetPromotionQueryListHandler(serverCtx),
},
{
Method: http.MethodPost,
Path: "/real_name",
@@ -745,6 +750,11 @@ func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) {
server.AddRoutes(
[]rest.Route{
{
Method: http.MethodGet,
Path: "/app/config",
Handler: app.GetAppConfigHandler(serverCtx),
},
{
Method: http.MethodGet,
Path: "/app/version",
@@ -828,7 +838,7 @@ func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) {
server.AddRoutes(
rest.WithMiddlewares(
[]rest.Middleware{serverCtx.UserAuthInterceptor},
[]rest.Middleware{serverCtx.AuthInterceptor},
[]rest.Route{
{
Method: http.MethodPost,
@@ -900,7 +910,7 @@ func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) {
server.AddRoutes(
rest.WithMiddlewares(
[]rest.Middleware{serverCtx.UserAuthInterceptor},
[]rest.Middleware{serverCtx.AuthInterceptor},
[]rest.Route{
{
// query service
@@ -916,7 +926,7 @@ func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) {
server.AddRoutes(
rest.WithMiddlewares(
[]rest.Middleware{serverCtx.UserAuthInterceptor},
[]rest.Middleware{serverCtx.AuthInterceptor},
[]rest.Route{
{
// 生成分享链接
@@ -991,6 +1001,12 @@ func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) {
server.AddRoutes(
[]rest.Route{
{
// unified auth
Method: http.MethodPost,
Path: "/user/auth",
Handler: user.AuthHandler(serverCtx),
},
{
// mobile code login
Method: http.MethodPost,

View File

@@ -0,0 +1,25 @@
package user
import (
"net/http"
logic "ycc-server/app/main/api/internal/logic/user"
"ycc-server/app/main/api/internal/svc"
"ycc-server/app/main/api/internal/types"
"ycc-server/common/result"
"github.com/zeromicro/go-zero/rest/httpx"
)
func AuthHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.AuthReq
if err := httpx.Parse(r, &req); err != nil {
result.ParamErrorResult(r, w, err)
return
}
l := logic.NewAuthLogic(r.Context(), svcCtx)
resp, err := l.Auth(&req)
result.HttpResult(r, w, resp, err)
}
}