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
590e6db6
authored
Jul 31, 2025
by
CaIon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: 修复被禁用的渠道无法测试的问题
parent
40848f28
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
0 deletions
+17
-0
controller/channel-test.go
+3
-0
model/channel_cache.go
+14
-0
No files found.
controller/channel-test.go
View file @
590e6db6
...
...
@@ -332,9 +332,12 @@ func TestChannel(c *gin.Context) {
}
channel
,
err
:=
model
.
CacheGetChannel
(
channelId
)
if
err
!=
nil
{
channel
,
err
=
model
.
GetChannelById
(
channelId
,
true
)
if
err
!=
nil
{
common
.
ApiError
(
c
,
err
)
return
}
}
//defer func() {
// if channel.ChannelInfo.IsMultiKey {
// go func() { _ = channel.SaveChannelInfo() }()
...
...
model/channel_cache.go
View file @
590e6db6
...
...
@@ -239,6 +239,20 @@ func CacheUpdateChannelStatus(id int, status int) {
if
channel
,
ok
:=
channelsIDM
[
id
];
ok
{
channel
.
Status
=
status
}
if
status
!=
common
.
ChannelStatusEnabled
{
// delete the channel from group2model2channels
for
group
,
model2channels
:=
range
group2model2channels
{
for
model
,
channels
:=
range
model2channels
{
for
i
,
channelId
:=
range
channels
{
if
channelId
==
id
{
// remove the channel from the slice
group2model2channels
[
group
][
model
]
=
append
(
channels
[
:
i
],
channels
[
i
+
1
:
]
...
)
break
}
}
}
}
}
}
func
CacheUpdateChannel
(
channel
*
Channel
)
{
...
...
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