调整日志输出方式,更新数据库日志存储结构;首页查询统计数据接口实现
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user