Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
phsl
/
new-api
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
49cb5f3f
authored
Jun 14, 2025
by
CaIon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
馃悰
fix(log): optimize channel ID collection by using a map to prevent duplicates
parent
a9ec62ee
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
2 deletions
+7
-2
model/log.go
+7
-2
No files found.
model/log.go
View file @
49cb5f3f
...
@@ -227,13 +227,18 @@ func GetAllLogs(logType int, startTimestamp int64, endTimestamp int64, modelName
...
@@ -227,13 +227,18 @@ func GetAllLogs(logType int, startTimestamp int64, endTimestamp int64, modelName
return
nil
,
0
,
err
return
nil
,
0
,
err
}
}
channelIds
:=
make
([]
int
,
0
)
channelIds
Map
:=
make
(
map
[
int
]
struct
{}
)
channelMap
:=
make
(
map
[
int
]
string
)
channelMap
:=
make
(
map
[
int
]
string
)
for
_
,
log
:=
range
logs
{
for
_
,
log
:=
range
logs
{
if
log
.
ChannelId
!=
0
{
if
log
.
ChannelId
!=
0
{
channelIds
=
append
(
channelIds
,
log
.
ChannelId
)
channelIds
Map
[
log
.
ChannelId
]
=
struct
{}{}
}
}
}
}
channelIds
:=
make
([]
int
,
0
,
len
(
channelIdsMap
))
for
channelId
:=
range
channelIdsMap
{
channelIds
=
append
(
channelIds
,
channelId
)
}
if
len
(
channelIds
)
>
0
{
if
len
(
channelIds
)
>
0
{
var
channels
[]
struct
{
var
channels
[]
struct
{
Id
int
`gorm:"column:id"`
Id
int
`gorm:"column:id"`
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment