fixed lots of bugs
This commit is contained in:
@@ -0,0 +1,51 @@
|
||||
package genericanimation
|
||||
|
||||
import (
|
||||
"bdgrp_go/master"
|
||||
"bdgrp_go/pbutil"
|
||||
"bdgrp_go/routes"
|
||||
"bdgrp_go/utils"
|
||||
"fmt"
|
||||
|
||||
"github.com/gofiber/fiber/v2"
|
||||
)
|
||||
|
||||
func init() {
|
||||
path := routes.PathOf()
|
||||
routes.Register(func(app *fiber.App) {
|
||||
app.Post(path, animation)
|
||||
fmt.Println("Loaded:", path)
|
||||
})
|
||||
}
|
||||
|
||||
func animation(c *fiber.Ctx) error {
|
||||
userid := c.Params("userid")
|
||||
m := master.GetMaster()
|
||||
|
||||
entries := map[string]any{}
|
||||
if gam, ok := m["masterGenericAnimationMap"].(map[string]any); ok {
|
||||
for id := range gam["entries"].(map[string]any) {
|
||||
entries[id] = map[string]any{
|
||||
"userId": userid,
|
||||
"genericAnimationId": id,
|
||||
"status": "already_read",
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
data := map[string]any{
|
||||
"userGenericAnimationMap": map[string]any{"entries": entries},
|
||||
}
|
||||
|
||||
encoded, err := pbutil.Encode("SuiteUserGetResponse", data)
|
||||
if err != nil {
|
||||
return c.Status(500).SendString(err.Error())
|
||||
}
|
||||
|
||||
encrypted, err := utils.Encrypt(encoded)
|
||||
if err != nil {
|
||||
return c.Status(500).SendString(err.Error())
|
||||
}
|
||||
|
||||
return c.Send(encrypted)
|
||||
}
|
||||
Reference in New Issue
Block a user