Files
Prism/internal/api/handlers_country.go
T
renjue 2780eaf30c
CI / test (push) Successful in 1m55s
CI / docker (push) Failing after 24s
feat: Prism HTTP/SOCKS5 代理网关及管理台
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-23 15:11:50 +08:00

27 lines
638 B
Go

package api
import (
"net/http"
"github.com/gin-gonic/gin"
)
func (s *Server) listCountries(c *gin.Context) {
items, err := s.app.Store.ListCountryStats(c.Request.Context())
if err != nil {
c.JSON(http.StatusInternalServerError, gin.H{"error": err.Error()})
return
}
c.JSON(http.StatusOK, gin.H{"items": items})
}
func (s *Server) rebuildCountries(c *gin.Context) {
n, err := s.app.Store.RebuildAllNodeCountries(c.Request.Context())
if err != nil {
c.JSON(http.StatusInternalServerError, gin.H{"error": err.Error()})
return
}
_ = s.app.ReloadEngine(c.Request.Context())
c.JSON(http.StatusOK, gin.H{"updated": n})
}