game7 api
This commit is contained in:
29
internal/handler/game7/game7_task_check_handler.go
Normal file
29
internal/handler/game7/game7_task_check_handler.go
Normal file
@@ -0,0 +1,29 @@
|
||||
package game7
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"github.com/zeromicro/go-zero/rest/httpx"
|
||||
"nova_task/internal/logic/game7"
|
||||
"nova_task/internal/svc"
|
||||
"nova_task/internal/types"
|
||||
)
|
||||
|
||||
// Game7任务完成检查
|
||||
func Game7TaskCheckHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
||||
return func(w http.ResponseWriter, r *http.Request) {
|
||||
var req types.Game7TaskCheckReq
|
||||
if err := httpx.Parse(r, &req); err != nil {
|
||||
httpx.ErrorCtx(r.Context(), w, err)
|
||||
return
|
||||
}
|
||||
|
||||
l := game7.NewGame7TaskCheckLogic(r.Context(), svcCtx)
|
||||
resp, err := l.Game7TaskCheck(&req)
|
||||
if err != nil {
|
||||
httpx.ErrorCtx(r.Context(), w, err)
|
||||
} else {
|
||||
httpx.OkJsonCtx(r.Context(), w, resp)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -8,6 +8,7 @@ import (
|
||||
|
||||
admin "nova_task/internal/handler/admin"
|
||||
carv "nova_task/internal/handler/carv"
|
||||
game7 "nova_task/internal/handler/game7"
|
||||
task "nova_task/internal/handler/task"
|
||||
"nova_task/internal/svc"
|
||||
|
||||
@@ -81,6 +82,21 @@ func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) {
|
||||
rest.WithPrefix("/gapi/carv"),
|
||||
)
|
||||
|
||||
server.AddRoutes(
|
||||
rest.WithMiddlewares(
|
||||
[]rest.Middleware{serverCtx.Game7ApiKeyCheck},
|
||||
[]rest.Route{
|
||||
{
|
||||
// Game7任务完成检查
|
||||
Method: http.MethodGet,
|
||||
Path: "/task",
|
||||
Handler: game7.Game7TaskCheckHandler(serverCtx),
|
||||
},
|
||||
}...,
|
||||
),
|
||||
rest.WithPrefix("/gapi/game7"),
|
||||
)
|
||||
|
||||
server.AddRoutes(
|
||||
[]rest.Route{
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user