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
a69f166e
authored
Aug 25, 2025
by
CaIon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: add SaveWithoutKey method to Channel and update status saving logic
parent
1a5ba750
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
4 deletions
+8
-4
model/channel.go
+5
-1
service/channel.go
+3
-3
No files found.
model/channel.go
View file @
a69f166e
...
@@ -247,6 +247,10 @@ func (channel *Channel) Save() error {
...
@@ -247,6 +247,10 @@ func (channel *Channel) Save() error {
return
DB
.
Save
(
channel
)
.
Error
return
DB
.
Save
(
channel
)
.
Error
}
}
func
(
channel
*
Channel
)
SaveWithoutKey
()
error
{
return
DB
.
Omit
(
"key"
)
.
Save
(
channel
)
.
Error
}
func
GetAllChannels
(
startIdx
int
,
num
int
,
selectAll
bool
,
idSort
bool
)
([]
*
Channel
,
error
)
{
func
GetAllChannels
(
startIdx
int
,
num
int
,
selectAll
bool
,
idSort
bool
)
([]
*
Channel
,
error
)
{
var
channels
[]
*
Channel
var
channels
[]
*
Channel
var
err
error
var
err
error
...
@@ -645,7 +649,7 @@ func UpdateChannelStatus(channelId int, usingKey string, status int, reason stri
...
@@ -645,7 +649,7 @@ func UpdateChannelStatus(channelId int, usingKey string, status int, reason stri
channel
.
Status
=
status
channel
.
Status
=
status
shouldUpdateAbilities
=
true
shouldUpdateAbilities
=
true
}
}
err
=
channel
.
Save
()
err
=
channel
.
Save
WithoutKey
()
if
err
!=
nil
{
if
err
!=
nil
{
common
.
SysLog
(
fmt
.
Sprintf
(
"failed to update channel status: channel_id=%d, status=%d, error=%v"
,
channel
.
Id
,
status
,
err
))
common
.
SysLog
(
fmt
.
Sprintf
(
"failed to update channel status: channel_id=%d, status=%d, error=%v"
,
channel
.
Id
,
status
,
err
))
return
false
return
false
...
...
service/channel.go
View file @
a69f166e
...
@@ -18,11 +18,11 @@ func formatNotifyType(channelId int, status int) string {
...
@@ -18,11 +18,11 @@ func formatNotifyType(channelId int, status int) string {
// disable & notify
// disable & notify
func
DisableChannel
(
channelError
types
.
ChannelError
,
reason
string
)
{
func
DisableChannel
(
channelError
types
.
ChannelError
,
reason
string
)
{
common
.
SysLog
(
fmt
.
Sprintf
(
"通道「%s」(#%d)发生错误,准备禁用,原因:%s"
,
channelError
.
ChannelName
,
channelError
.
ChannelId
,
reason
))
// 检查是否启用自动禁用功能
// 检查是否启用自动禁用功能
if
!
channelError
.
AutoBan
{
if
!
channelError
.
AutoBan
{
if
common
.
DebugEnabled
{
common
.
SysLog
(
fmt
.
Sprintf
(
"通道「%s」(#%d)未启用自动禁用功能,跳过禁用操作"
,
channelError
.
ChannelName
,
channelError
.
ChannelId
))
common
.
SysLog
(
fmt
.
Sprintf
(
"通道「%s」(#%d)未启用自动禁用功能,跳过禁用操作"
,
channelError
.
ChannelName
,
channelError
.
ChannelId
))
}
return
return
}
}
...
...
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