feat: key status

This commit is contained in:
tbphp
2025-07-07 15:50:47 +08:00
parent 0f85381082
commit 3228cdad64
4 changed files with 11 additions and 6 deletions

View File

@@ -103,7 +103,7 @@ func (s *Server) Login(c *gin.Context) {
func (s *Server) Health(c *gin.Context) {
var totalKeys, healthyKeys int64
s.DB.Model(&models.APIKey{}).Count(&totalKeys)
s.DB.Model(&models.APIKey{}).Where("status = ?", "active").Count(&healthyKeys)
s.DB.Model(&models.APIKey{}).Where("status = ?", models.KeyStatusActive).Count(&healthyKeys)
status := "healthy"
httpStatus := http.StatusOK