fix
This commit is contained in:
parent
ac54bf45ee
commit
2e7d9fb5ee
12
app/app.go
12
app/app.go
@ -7,6 +7,7 @@ import (
|
||||
"gitea.pena/PenaSide/common/log_mw"
|
||||
"gitea.pena/PenaSide/hlog"
|
||||
"gitea.pena/PenaSide/trashlog/wrappers/zaptrashlog"
|
||||
"gitea.pena/SQuiz/answerer/clients"
|
||||
dalBS "gitea.pena/SQuiz/answerer/dal"
|
||||
"gitea.pena/SQuiz/answerer/models"
|
||||
"gitea.pena/SQuiz/answerer/savewc"
|
||||
@ -19,7 +20,6 @@ import (
|
||||
"github.com/go-redis/redis/v8"
|
||||
"github.com/gofiber/fiber/v2"
|
||||
"github.com/minio/minio-go/v7"
|
||||
"gitea.pena/SQuiz/answerer/clients"
|
||||
"github.com/minio/minio-go/v7/pkg/credentials"
|
||||
"github.com/skeris/appInit"
|
||||
"go.uber.org/zap"
|
||||
@ -175,6 +175,16 @@ func New(ctx context.Context, opts interface{}, ver appInit.Version) (appInit.Co
|
||||
go saveClientWorker.Start(ctx)
|
||||
|
||||
app := fiber.New(fiber.Config{BodyLimit: 70 * 1024 * 1024})
|
||||
|
||||
app.Use(func(c *fiber.Ctx) error {
|
||||
defer func() {
|
||||
if err := recover(); err != nil {
|
||||
c.Status(fiber.StatusInternalServerError).SendString("internal server error")
|
||||
}
|
||||
}()
|
||||
return c.Next()
|
||||
})
|
||||
|
||||
app.Use(middleware.AnswererChain())
|
||||
app.Use(log_mw.ContextLogger(loggerHlog))
|
||||
app.Get("/liveness", healthchecks.Liveness)
|
||||
|
4
go.mod
4
go.mod
@ -18,8 +18,10 @@ require (
|
||||
)
|
||||
|
||||
require (
|
||||
gitea.pena/PenaSide/linters-golang v0.0.0-20241207122018-933207374735 // indirect
|
||||
github.com/ClickHouse/clickhouse-go v1.5.4 // indirect
|
||||
github.com/andybalholm/brotli v1.1.0 // indirect
|
||||
github.com/caarlos0/env/v8 v8.0.0 // indirect
|
||||
github.com/cespare/xxhash/v2 v2.2.0 // indirect
|
||||
github.com/cloudflare/golz4 v0.0.0-20150217214814-ef862a3cdc58 // indirect
|
||||
github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f // indirect
|
||||
@ -36,6 +38,7 @@ require (
|
||||
github.com/mattn/go-isatty v0.0.20 // indirect
|
||||
github.com/mattn/go-runewidth v0.0.16 // indirect
|
||||
github.com/minio/md5-simd v1.1.2 // indirect
|
||||
github.com/pkg/errors v0.9.1 // indirect
|
||||
github.com/rivo/uniseg v0.2.0 // indirect
|
||||
github.com/tealeg/xlsx v1.0.5 // indirect
|
||||
github.com/valyala/bytebufferpool v1.0.0 // indirect
|
||||
@ -50,4 +53,5 @@ require (
|
||||
google.golang.org/genproto/googleapis/rpc v0.0.0-20240610135401-a8a62080eff3 // indirect
|
||||
google.golang.org/grpc v1.64.0 // indirect
|
||||
google.golang.org/protobuf v1.34.2 // indirect
|
||||
gopkg.in/tucnak/telebot.v2 v2.5.0 // indirect
|
||||
)
|
||||
|
5
go.sum
5
go.sum
@ -2,6 +2,10 @@ gitea.pena/PenaSide/common v0.0.0-20250103085335-91ea31fee517 h1:EgBe8VcdPwmxbSz
|
||||
gitea.pena/PenaSide/common v0.0.0-20250103085335-91ea31fee517/go.mod h1:91EuBCgcqgJ6mG36n2pds8sPwwfaJytLWOzY3h2YFKU=
|
||||
gitea.pena/PenaSide/hlog v0.0.0-20241125221102-a54c29c002a9 h1:tBkXWNIt8icmkMMnq8MA421RWkUy4OZh5P7C3q8uCu4=
|
||||
gitea.pena/PenaSide/hlog v0.0.0-20241125221102-a54c29c002a9/go.mod h1:sanhSL8aEsfcq21P+eItYiAnKAre+B67nGJmDfk2cf0=
|
||||
gitea.pena/PenaSide/linters-golang v0.0.0-20241119212350-2759fa93724a h1:UySqMgaOKNsR42Y6GQXoM2wn/waYNc9cakMUSvbEEAg=
|
||||
gitea.pena/PenaSide/linters-golang v0.0.0-20241119212350-2759fa93724a/go.mod h1:gdd+vOT6up9STkEbxa2qESLIMZFjCmRbkcheFQCVgZU=
|
||||
gitea.pena/PenaSide/linters-golang v0.0.0-20241207122018-933207374735 h1:jDVeUhGBTXBibmW5dmtJg2m2+z5z2Rf6J4G0LpjVoJ0=
|
||||
gitea.pena/PenaSide/linters-golang v0.0.0-20241207122018-933207374735/go.mod h1:gdd+vOT6up9STkEbxa2qESLIMZFjCmRbkcheFQCVgZU=
|
||||
gitea.pena/PenaSide/trashlog v0.0.0-20250224122049-ddb4d72e9d07 h1:bUIUgzXQt16aBqSccI//BaODpRCTIaqlddSepM98QSc=
|
||||
gitea.pena/PenaSide/trashlog v0.0.0-20250224122049-ddb4d72e9d07/go.mod h1:GRfWJerTUlgy82CiYAxE4tVYSVV54zEJJQy17Fx46E4=
|
||||
gitea.pena/SQuiz/common v0.0.0-20250207214652-9994f2d4d43f h1:458FCN98jVkjAqg3yyspgkUdJnKz3BNMiZosrVtPpv8=
|
||||
@ -107,6 +111,7 @@ github.com/skeris/appInit v1.0.2/go.mod h1:4ElEeXWVGzU3dlYq/eMWJ/U5hd+LKisc1z3+y
|
||||
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
||||
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
|
||||
github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=
|
||||
github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA=
|
||||
github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg=
|
||||
github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
|
||||
github.com/tealeg/xlsx v1.0.5 h1:+f8oFmvY8Gw1iUXzPk+kz+4GpbDZPK1FhPiQRd+ypgE=
|
||||
|
@ -13,10 +13,10 @@ import (
|
||||
"gitea.pena/SQuiz/common/utils"
|
||||
"github.com/gofiber/fiber/v2"
|
||||
"net/url"
|
||||
"strconv"
|
||||
"strings"
|
||||
"sync"
|
||||
"time"
|
||||
"strconv"
|
||||
|
||||
"github.com/rs/xid"
|
||||
)
|
||||
@ -239,6 +239,11 @@ func (s *Service) GetQuizData(c *fiber.Ctx) error {
|
||||
fp = cfp
|
||||
}
|
||||
|
||||
if req.NeedConfig {
|
||||
if len(questions) == 0 {
|
||||
return c.Status(fiber.StatusNotFound).SendString("question not found")
|
||||
}
|
||||
|
||||
answers, errs := s.dal.AnswerRepo.CreateAnswers(c.Context(), []model.Answer{{
|
||||
Content: "start",
|
||||
QuestionId: questions[0].Id,
|
||||
@ -266,6 +271,8 @@ func (s *Service) GetQuizData(c *fiber.Ctx) error {
|
||||
CtxIDInt: int64(answers[0].Id),
|
||||
CtxSession: cs,
|
||||
})
|
||||
}
|
||||
|
||||
fmt.Println("SETTIIIIII", cnt <= req.Limit, result)
|
||||
|
||||
if cnt <= req.Limit {
|
||||
|
Loading…
Reference in New Issue
Block a user