🐛 Fix panics

This commit is contained in:
LittleSheep 2025-01-29 14:01:34 +08:00
parent 6d7f0b0518
commit 52d6d17bf6
2 changed files with 4 additions and 4 deletions

View File

@ -7,13 +7,13 @@ import (
func MapAPIs(app *fiber.App, baseURL string) {
api := app.Group(baseURL).Name("API")
{
wallet := api.Group("/wallet").Name("Wallet API")
wallet := api.Group("/wallets").Name("Wallet API")
{
wallet.Post("/me", createWallet)
wallet.Get("/me", getMyWallet)
}
transaction := api.Group("/transaction").Name("Transaction API")
transaction := api.Group("/transactions").Name("Transaction API")
{
transaction.Get("/me", getTransaction)
transaction.Get("/:id", getTransactionByID)

View File

@ -14,7 +14,7 @@ func getTransaction(c *fiber.Ctx) error {
if err := sec.EnsureAuthenticated(c); err != nil {
return err
}
user := c.Locals("user").(*sec.UserInfo)
user := c.Locals("nex_user").(*sec.UserInfo)
var wallet models.Wallet
if err := database.C.Where("account_id = ?", user.ID).First(&wallet).Error; err != nil {
@ -46,7 +46,7 @@ func getTransactionByID(c *fiber.Ctx) error {
if err := sec.EnsureAuthenticated(c); err != nil {
return err
}
user := c.Locals("user").(*sec.UserInfo)
user := c.Locals("nex_user").(*sec.UserInfo)
var transaction models.Transaction
if err := database.C.Where("id = ?", id).