调整日志输出方式,更新数据库日志存储结构;首页查询统计数据接口实现

This commit is contained in:
2025-06-20 15:17:15 +08:00
parent 63fbcbd6dd
commit 546e81fee3
17 changed files with 1423 additions and 42 deletions

View File

@@ -4,6 +4,7 @@ import (
"context"
"database/sql"
"fmt"
"github.com/gofiber/fiber/v2"
"log/slog"
"math"
"math/rand/v2"
@@ -217,6 +218,7 @@ func removeShortChannelExternal(proxies []*m.Proxy, channels []*m.Channel) error
// region 创建通道
func (s *channelService) CreateChannel(
c *fiber.Ctx,
userId int32,
resourceId int32,
protocol channel2.Protocol,
@@ -301,6 +303,18 @@ func (s *channelService) CreateChannel(
return nil, core.NewBizErr("提交异步删除通道任务失败", err)
}
// 记录通道创建日志
slog.Info("创建通道",
slog.Int("user_id", int(userId)),
slog.Int("resource_id", int(resourceId)),
slog.Int("count", count),
slog.String("prov", filter.Prov),
slog.String("city", filter.City),
slog.String("isp", filter.Isp),
slog.String("ip", c.IP()),
slog.Time("time", now),
)
return channels, nil
}