完善资源关闭逻辑,添加数据库和Redis连接的退出处理

This commit is contained in:
2025-04-01 11:26:37 +08:00
parent 6d89470a89
commit 87eecdb8cb
7 changed files with 74 additions and 50 deletions

View File

@@ -1,20 +1,22 @@
package handlers
import (
"platform/pkg/rds"
q "platform/web/queries"
"time"
"github.com/gofiber/fiber/v2"
)
func Temp(c *fiber.Ctx) error {
id := c.Query("id")
result, err := rds.Client.Get(c.Context(), "channel:"+id).Result()
channels, err := q.Channel.Debug().Where(
q.Channel.Expiration.Lt(time.Now().Add(3 * time.Minute)),
).Find()
if err != nil {
return err
}
return c.JSON(fiber.Map{
"result": result,
"result": channels,
})
}