任意时间区间(月流量)统计,无视重启~

This commit is contained in:
naiba
2021-07-14 23:53:37 +08:00
parent dff1e29c40
commit 63bb1570d2
16 changed files with 290 additions and 77 deletions

View File

@@ -3,6 +3,7 @@ package controller
import (
"fmt"
"html/template"
"net/http"
"strings"
"time"
@@ -14,7 +15,7 @@ import (
"github.com/naiba/nezha/service/dao"
)
func ServeWeb(port uint) {
func ServeWeb(port uint) *http.Server {
gin.SetMode(gin.ReleaseMode)
r := gin.Default()
if dao.Conf.Debug {
@@ -112,7 +113,11 @@ func ServeWeb(port uint) {
r.Static("/static", "resource/static")
r.LoadHTMLGlob("resource/template/**/*")
routers(r)
r.Run(fmt.Sprintf(":%d", port))
srv := &http.Server{
Addr: fmt.Sprintf(":%d", port),
Handler: r,
}
return srv
}
func routers(r *gin.Engine) {