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
b9842b73
authored
Nov 19, 2025
by
Seefs
Committed by
GitHub
Nov 19, 2025
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #2247 from feitianbubu/pr/channel-omit-key
feat: channel by tag omit key
parents
ea9be41f
edf76d3f
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
6 deletions
+10
-6
controller/channel.go
+3
-3
model/channel.go
+7
-3
No files found.
controller/channel.go
View file @
b9842b73
...
@@ -92,7 +92,7 @@ func GetAllChannels(c *gin.Context) {
...
@@ -92,7 +92,7 @@ func GetAllChannels(c *gin.Context) {
if
tag
==
nil
||
*
tag
==
""
{
if
tag
==
nil
||
*
tag
==
""
{
continue
continue
}
}
tagChannels
,
err
:=
model
.
GetChannelsByTag
(
*
tag
,
idSort
)
tagChannels
,
err
:=
model
.
GetChannelsByTag
(
*
tag
,
idSort
,
false
)
if
err
!=
nil
{
if
err
!=
nil
{
continue
continue
}
}
...
@@ -278,7 +278,7 @@ func SearchChannels(c *gin.Context) {
...
@@ -278,7 +278,7 @@ func SearchChannels(c *gin.Context) {
}
}
for
_
,
tag
:=
range
tags
{
for
_
,
tag
:=
range
tags
{
if
tag
!=
nil
&&
*
tag
!=
""
{
if
tag
!=
nil
&&
*
tag
!=
""
{
tagChannel
,
err
:=
model
.
GetChannelsByTag
(
*
tag
,
idSort
)
tagChannel
,
err
:=
model
.
GetChannelsByTag
(
*
tag
,
idSort
,
false
)
if
err
==
nil
{
if
err
==
nil
{
channelData
=
append
(
channelData
,
tagChannel
...
)
channelData
=
append
(
channelData
,
tagChannel
...
)
}
}
...
@@ -1028,7 +1028,7 @@ func GetTagModels(c *gin.Context) {
...
@@ -1028,7 +1028,7 @@ func GetTagModels(c *gin.Context) {
return
return
}
}
channels
,
err
:=
model
.
GetChannelsByTag
(
tag
,
false
)
// Assuming false for idSort is fine her
e
channels
,
err
:=
model
.
GetChannelsByTag
(
tag
,
false
,
false
)
// idSort=false, selectAll=fals
e
if
err
!=
nil
{
if
err
!=
nil
{
c
.
JSON
(
http
.
StatusInternalServerError
,
gin
.
H
{
c
.
JSON
(
http
.
StatusInternalServerError
,
gin
.
H
{
"success"
:
false
,
"success"
:
false
,
...
...
model/channel.go
View file @
b9842b73
...
@@ -272,13 +272,17 @@ func GetAllChannels(startIdx int, num int, selectAll bool, idSort bool) ([]*Chan
...
@@ -272,13 +272,17 @@ func GetAllChannels(startIdx int, num int, selectAll bool, idSort bool) ([]*Chan
return
channels
,
err
return
channels
,
err
}
}
func
GetChannelsByTag
(
tag
string
,
idSort
bool
)
([]
*
Channel
,
error
)
{
func
GetChannelsByTag
(
tag
string
,
idSort
bool
,
selectAll
bool
)
([]
*
Channel
,
error
)
{
var
channels
[]
*
Channel
var
channels
[]
*
Channel
order
:=
"priority desc"
order
:=
"priority desc"
if
idSort
{
if
idSort
{
order
=
"id desc"
order
=
"id desc"
}
}
err
:=
DB
.
Where
(
"tag = ?"
,
tag
)
.
Order
(
order
)
.
Find
(
&
channels
)
.
Error
query
:=
DB
.
Where
(
"tag = ?"
,
tag
)
.
Order
(
order
)
if
!
selectAll
{
query
=
query
.
Omit
(
"key"
)
}
err
:=
query
.
Find
(
&
channels
)
.
Error
return
channels
,
err
return
channels
,
err
}
}
...
@@ -728,7 +732,7 @@ func EditChannelByTag(tag string, newTag *string, modelMapping *string, models *
...
@@ -728,7 +732,7 @@ func EditChannelByTag(tag string, newTag *string, modelMapping *string, models *
return
err
return
err
}
}
if
shouldReCreateAbilities
{
if
shouldReCreateAbilities
{
channels
,
err
:=
GetChannelsByTag
(
updatedTag
,
false
)
channels
,
err
:=
GetChannelsByTag
(
updatedTag
,
false
,
false
)
if
err
==
nil
{
if
err
==
nil
{
for
_
,
channel
:=
range
channels
{
for
_
,
channel
:=
range
channels
{
err
=
channel
.
UpdateAbilities
(
nil
)
err
=
channel
.
UpdateAbilities
(
nil
)
...
...
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