增加提取castile到游戏的数据库表,定义API接口等;
This commit is contained in:
@@ -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)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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)
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user