feat: able to query test log

This commit is contained in:
JustSong
2025-01-31 21:23:12 +08:00
parent 4f68f3e1b3
commit fa2a772731
6 changed files with 377 additions and 184 deletions

View File

@@ -37,6 +37,7 @@ const (
LogTypeConsume
LogTypeManage
LogTypeSystem
LogTypeTest
)
func recordLogHelper(ctx context.Context, log *Log) {
@@ -86,6 +87,12 @@ func RecordConsumeLog(ctx context.Context, log *Log) {
recordLogHelper(ctx, log)
}
func RecordTestLog(ctx context.Context, log *Log) {
log.CreatedAt = helper.GetTimestamp()
log.Type = LogTypeTest
recordLogHelper(ctx, log)
}
func GetAllLogs(logType int, startTimestamp int64, endTimestamp int64, modelName string, username string, tokenName string, startIdx int, num int, channel int) (logs []*Log, err error) {
var tx *gorm.DB
if logType == LogTypeUnknown {