diff --git a/.idea/workspace.xml b/.idea/workspace.xml
index 7167327..242e749 100644
--- a/.idea/workspace.xml
+++ b/.idea/workspace.xml
@@ -4,9 +4,10 @@
-
+
-
+
+
@@ -159,7 +160,6 @@
-
@@ -184,7 +184,8 @@
-
+
+
diff --git a/pkg/internal/http/api/check_in_api.go b/pkg/internal/http/api/check_in_api.go
index 9d59024..ba47505 100644
--- a/pkg/internal/http/api/check_in_api.go
+++ b/pkg/internal/http/api/check_in_api.go
@@ -99,7 +99,7 @@ func doCheckIn(c *fiber.Ctx) error {
if record, err := services.CheckIn(user); err != nil {
return fiber.NewError(fiber.StatusBadRequest, err.Error())
} else {
- services.AddEvent(user.ID, "dailySign", strconv.Itoa(int(record.ID)), c.IP(), c.Get(fiber.HeaderUserAgent))
+ services.AddEvent(user.ID, "checkIn", strconv.Itoa(int(record.ID)), c.IP(), c.Get(fiber.HeaderUserAgent))
return c.JSON(record)
}
}
diff --git a/pkg/internal/services/check_in.go b/pkg/internal/services/check_in.go
index fbe0e0a..0f30164 100644
--- a/pkg/internal/services/check_in.go
+++ b/pkg/internal/services/check_in.go
@@ -6,7 +6,6 @@ import (
"git.solsynth.dev/hypernet/passport/pkg/authkit/models"
"git.solsynth.dev/hypernet/passport/pkg/internal/database"
"gorm.io/gorm"
- "math"
"math/rand"
"time"
)
@@ -38,9 +37,11 @@ const CheckInResultModifiersLength = 4
func CheckIn(user models.Account) (models.CheckInRecord, error) {
tier := rand.Intn(5)
+ expMax := 100 * (tier + 1)
+ expMin := 100
record := models.CheckInRecord{
ResultTier: tier,
- ResultExperience: rand.Intn(int(math.Max(float64(tier), 1)*100)+1-100) + 100,
+ ResultExperience: rand.Intn(expMax-expMin) + expMin,
AccountID: user.ID,
}