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
abd5de79
authored
Mar 09, 2025
by
1808837298@qq.com
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
refactor: Make Channel Setting nullable and improve setting handling #836
parent
8fffa159
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
4 deletions
+4
-4
model/channel.go
+4
-4
No files found.
model/channel.go
View file @
abd5de79
...
@@ -35,7 +35,7 @@ type Channel struct {
...
@@ -35,7 +35,7 @@ type Channel struct {
AutoBan
*
int
`json:"auto_ban" gorm:"default:1"`
AutoBan
*
int
`json:"auto_ban" gorm:"default:1"`
OtherInfo
string
`json:"other_info"`
OtherInfo
string
`json:"other_info"`
Tag
*
string
`json:"tag" gorm:"index"`
Tag
*
string
`json:"tag" gorm:"index"`
Setting
string
`json:"setting" gorm:"type:text"`
Setting
*
string
`json:"setting" gorm:"type:text"`
}
}
func
(
channel
*
Channel
)
GetModels
()
[]
string
{
func
(
channel
*
Channel
)
GetModels
()
[]
string
{
...
@@ -493,8 +493,8 @@ func SearchTags(keyword string, group string, model string, idSort bool) ([]*str
...
@@ -493,8 +493,8 @@ func SearchTags(keyword string, group string, model string, idSort bool) ([]*str
func
(
channel
*
Channel
)
GetSetting
()
map
[
string
]
interface
{}
{
func
(
channel
*
Channel
)
GetSetting
()
map
[
string
]
interface
{}
{
setting
:=
make
(
map
[
string
]
interface
{})
setting
:=
make
(
map
[
string
]
interface
{})
if
channel
.
Setting
!=
""
{
if
channel
.
Setting
!=
nil
&&
*
channel
.
Setting
!=
""
{
err
:=
json
.
Unmarshal
([]
byte
(
channel
.
Setting
),
&
setting
)
err
:=
json
.
Unmarshal
([]
byte
(
*
channel
.
Setting
),
&
setting
)
if
err
!=
nil
{
if
err
!=
nil
{
common
.
SysError
(
"failed to unmarshal setting: "
+
err
.
Error
())
common
.
SysError
(
"failed to unmarshal setting: "
+
err
.
Error
())
}
}
...
@@ -508,7 +508,7 @@ func (channel *Channel) SetSetting(setting map[string]interface{}) {
...
@@ -508,7 +508,7 @@ func (channel *Channel) SetSetting(setting map[string]interface{}) {
common
.
SysError
(
"failed to marshal setting: "
+
err
.
Error
())
common
.
SysError
(
"failed to marshal setting: "
+
err
.
Error
())
return
return
}
}
channel
.
Setting
=
string
(
settingBytes
)
channel
.
Setting
=
common
.
GetPointer
[
string
](
string
(
settingBytes
)
)
}
}
func
GetChannelsByIds
(
ids
[]
int
)
([]
*
Channel
,
error
)
{
func
GetChannelsByIds
(
ids
[]
int
)
([]
*
Channel
,
error
)
{
...
...
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