add config

This commit is contained in:
2026-01-05 12:49:57 +08:00
parent 64b758a36d
commit 9e42257e4e
14 changed files with 253 additions and 60 deletions

View File

@@ -3,12 +3,13 @@ package admin_agent
import (
"net/http"
"github.com/zeromicro/go-zero/rest/httpx"
"tydata-server/app/main/api/internal/logic/admin_agent"
"tydata-server/app/main/api/internal/svc"
"tydata-server/app/main/api/internal/types"
"tydata-server/common/result"
"tydata-server/pkg/lzkit/validator"
"github.com/zeromicro/go-zero/rest/httpx"
)
func AdminBatchUnfreezeAgentCommissionHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {

View File

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

View File

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

View File

@@ -132,6 +132,16 @@ func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) {
Path: "/statistics",
Handler: admin_agent.AdminGetAgentStatisticsHandler(serverCtx),
},
{
Method: http.MethodGet,
Path: "/system-config",
Handler: admin_agent.AdminGetSystemConfigHandler(serverCtx),
},
{
Method: http.MethodPost,
Path: "/system-config",
Handler: admin_agent.AdminUpdateSystemConfigHandler(serverCtx),
},
{
Method: http.MethodGet,
Path: "/wallet/:agent_id",