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
da8917a1
authored
Jul 17, 2025
by
CaIon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
refactor: initialize channel cache after channel operations to ensure data consistency
parent
9660b22c
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
4 deletions
+9
-4
controller/channel.go
+9
-4
No files found.
controller/channel.go
View file @
da8917a1
...
@@ -528,6 +528,7 @@ func DeleteChannel(c *gin.Context) {
...
@@ -528,6 +528,7 @@ func DeleteChannel(c *gin.Context) {
common
.
ApiError
(
c
,
err
)
common
.
ApiError
(
c
,
err
)
return
return
}
}
model
.
InitChannelCache
()
c
.
JSON
(
http
.
StatusOK
,
gin
.
H
{
c
.
JSON
(
http
.
StatusOK
,
gin
.
H
{
"success"
:
true
,
"success"
:
true
,
"message"
:
""
,
"message"
:
""
,
...
@@ -541,6 +542,7 @@ func DeleteDisabledChannel(c *gin.Context) {
...
@@ -541,6 +542,7 @@ func DeleteDisabledChannel(c *gin.Context) {
common
.
ApiError
(
c
,
err
)
common
.
ApiError
(
c
,
err
)
return
return
}
}
model
.
InitChannelCache
()
c
.
JSON
(
http
.
StatusOK
,
gin
.
H
{
c
.
JSON
(
http
.
StatusOK
,
gin
.
H
{
"success"
:
true
,
"success"
:
true
,
"message"
:
""
,
"message"
:
""
,
...
@@ -574,6 +576,7 @@ func DisableTagChannels(c *gin.Context) {
...
@@ -574,6 +576,7 @@ func DisableTagChannels(c *gin.Context) {
common
.
ApiError
(
c
,
err
)
common
.
ApiError
(
c
,
err
)
return
return
}
}
model
.
InitChannelCache
()
c
.
JSON
(
http
.
StatusOK
,
gin
.
H
{
c
.
JSON
(
http
.
StatusOK
,
gin
.
H
{
"success"
:
true
,
"success"
:
true
,
"message"
:
""
,
"message"
:
""
,
...
@@ -596,6 +599,7 @@ func EnableTagChannels(c *gin.Context) {
...
@@ -596,6 +599,7 @@ func EnableTagChannels(c *gin.Context) {
common
.
ApiError
(
c
,
err
)
common
.
ApiError
(
c
,
err
)
return
return
}
}
model
.
InitChannelCache
()
c
.
JSON
(
http
.
StatusOK
,
gin
.
H
{
c
.
JSON
(
http
.
StatusOK
,
gin
.
H
{
"success"
:
true
,
"success"
:
true
,
"message"
:
""
,
"message"
:
""
,
...
@@ -625,6 +629,7 @@ func EditTagChannels(c *gin.Context) {
...
@@ -625,6 +629,7 @@ func EditTagChannels(c *gin.Context) {
common
.
ApiError
(
c
,
err
)
common
.
ApiError
(
c
,
err
)
return
return
}
}
model
.
InitChannelCache
()
c
.
JSON
(
http
.
StatusOK
,
gin
.
H
{
c
.
JSON
(
http
.
StatusOK
,
gin
.
H
{
"success"
:
true
,
"success"
:
true
,
"message"
:
""
,
"message"
:
""
,
...
@@ -652,6 +657,7 @@ func DeleteChannelBatch(c *gin.Context) {
...
@@ -652,6 +657,7 @@ func DeleteChannelBatch(c *gin.Context) {
common
.
ApiError
(
c
,
err
)
common
.
ApiError
(
c
,
err
)
return
return
}
}
model
.
InitChannelCache
()
c
.
JSON
(
http
.
StatusOK
,
gin
.
H
{
c
.
JSON
(
http
.
StatusOK
,
gin
.
H
{
"success"
:
true
,
"success"
:
true
,
"message"
:
""
,
"message"
:
""
,
...
@@ -703,9 +709,7 @@ func UpdateChannel(c *gin.Context) {
...
@@ -703,9 +709,7 @@ func UpdateChannel(c *gin.Context) {
common
.
ApiError
(
c
,
err
)
common
.
ApiError
(
c
,
err
)
return
return
}
}
if
common
.
MemoryCacheEnabled
{
model
.
InitChannelCache
()
model
.
InitChannelCache
()
}
channel
.
Key
=
""
channel
.
Key
=
""
c
.
JSON
(
http
.
StatusOK
,
gin
.
H
{
c
.
JSON
(
http
.
StatusOK
,
gin
.
H
{
"success"
:
true
,
"success"
:
true
,
...
@@ -811,6 +815,7 @@ func BatchSetChannelTag(c *gin.Context) {
...
@@ -811,6 +815,7 @@ func BatchSetChannelTag(c *gin.Context) {
common
.
ApiError
(
c
,
err
)
common
.
ApiError
(
c
,
err
)
return
return
}
}
model
.
InitChannelCache
()
c
.
JSON
(
http
.
StatusOK
,
gin
.
H
{
c
.
JSON
(
http
.
StatusOK
,
gin
.
H
{
"success"
:
true
,
"success"
:
true
,
"message"
:
""
,
"message"
:
""
,
...
@@ -905,7 +910,7 @@ func CopyChannel(c *gin.Context) {
...
@@ -905,7 +910,7 @@ func CopyChannel(c *gin.Context) {
c
.
JSON
(
http
.
StatusOK
,
gin
.
H
{
"success"
:
false
,
"message"
:
err
.
Error
()})
c
.
JSON
(
http
.
StatusOK
,
gin
.
H
{
"success"
:
false
,
"message"
:
err
.
Error
()})
return
return
}
}
model
.
InitChannelCache
()
// success
// success
c
.
JSON
(
http
.
StatusOK
,
gin
.
H
{
"success"
:
true
,
"message"
:
""
,
"data"
:
gin
.
H
{
"id"
:
clone
.
Id
}})
c
.
JSON
(
http
.
StatusOK
,
gin
.
H
{
"success"
:
true
,
"message"
:
""
,
"data"
:
gin
.
H
{
"id"
:
clone
.
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