Files
bdgrp_go/routes/api/user/param_userid/liveboost.go
2026-09-06 21:57:03 +08:00

41 lines
706 B
Go

package param_userid
import (
"bdgrp_go/pbutil"
"bdgrp_go/routes"
"bdgrp_go/utils"
"fmt"
"time"
"github.com/gofiber/fiber/v2"
)
func init() {
path := routes.PathOf()
routes.Register(func(app *fiber.App) {
app.Get(path, liveBoost)
fmt.Println("Loaded:", path)
})
}
func liveBoost(c *fiber.Ctx) error {
data := map[string]any{
"userId": c.Params("userId"),
"count": 67,
"serverDate": time.Now().UnixMilli(),
"liveBoostBonusType": "default",
}
encoded, err := pbutil.Encode("UserLiveBoost", data)
if err != nil {
fmt.Println(err)
}
encrypted, err := utils.Encrypt(encoded)
if err != nil {
fmt.Println(err)
}
return c.Send(encrypted)
}