增加提取castile到游戏的数据库表,定义API接口等;

This commit is contained in:
yuming88
2025-04-28 14:12:44 +08:00
parent 109d76cd2e
commit e50137a90e
14 changed files with 692 additions and 3 deletions

View File

@@ -1,5 +1,5 @@
// Code generated by goctl. DO NOT EDIT.
// goctl 1.7.6
// goctl 1.7.3
package handler
@@ -12,6 +12,7 @@ import (
kgen "nova_task/internal/handler/kgen"
stakepoint "nova_task/internal/handler/stakepoint"
task "nova_task/internal/handler/task"
transfercastile "nova_task/internal/handler/transfercastile"
"nova_task/internal/svc"
"github.com/zeromicro/go-zero/rest"
@@ -235,4 +236,23 @@ func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) {
rest.WithJwt(serverCtx.Config.Auth.AccessSecret),
rest.WithPrefix("/gapi/task/v1"),
)
server.AddRoutes(
[]rest.Route{
{
// 获取提取castile到游戏的记录
Method: http.MethodPost,
Path: "/list",
Handler: transfercastile.TransferCastileToGameListHandler(serverCtx),
},
{
// 提取castile到游戏
Method: http.MethodPost,
Path: "/save",
Handler: transfercastile.TransferCastileToGameHandler(serverCtx),
},
},
rest.WithJwt(serverCtx.Config.Auth.AccessSecret),
rest.WithPrefix("/gapi/transfercastile/v1"),
)
}

View File

@@ -0,0 +1,29 @@
package transfercastile
import (
"net/http"
"github.com/zeromicro/go-zero/rest/httpx"
"nova_task/internal/logic/transfercastile"
"nova_task/internal/svc"
"nova_task/internal/types"
)
// 提取castile到游戏
func TransferCastileToGameHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.TransferCastileToGameReq
if err := httpx.Parse(r, &req); err != nil {
httpx.ErrorCtx(r.Context(), w, err)
return
}
l := transfercastile.NewTransferCastileToGameLogic(r.Context(), svcCtx)
resp, err := l.TransferCastileToGame(&req)
if err != nil {
httpx.ErrorCtx(r.Context(), w, err)
} else {
httpx.OkJsonCtx(r.Context(), w, resp)
}
}
}

View File

@@ -0,0 +1,29 @@
package transfercastile
import (
"net/http"
"github.com/zeromicro/go-zero/rest/httpx"
"nova_task/internal/logic/transfercastile"
"nova_task/internal/svc"
"nova_task/internal/types"
)
// 获取提取castile到游戏的记录
func TransferCastileToGameListHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.TransferCastileToGameListReq
if err := httpx.Parse(r, &req); err != nil {
httpx.ErrorCtx(r.Context(), w, err)
return
}
l := transfercastile.NewTransferCastileToGameListLogic(r.Context(), svcCtx)
resp, err := l.TransferCastileToGameList(&req)
if err != nil {
httpx.ErrorCtx(r.Context(), w, err)
} else {
httpx.OkJsonCtx(r.Context(), w, resp)
}
}
}