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
90a7cc17
authored
Apr 08, 2024
by
Calcium-Ion
Committed by
GitHub
Apr 08, 2024
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #188 from Calcium-Ion/fix/many-model-error
fix: 修复渠道一次性添加很多model失败
parents
0d44e462
07724ce3
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
1 deletions
+11
-1
model/ability.go
+11
-1
No files found.
model/ability.go
View file @
90a7cc17
...
...
@@ -3,6 +3,7 @@ package model
import
(
"errors"
"fmt"
"github.com/samber/lo"
"gorm.io/gorm"
"one-api/common"
"strings"
...
...
@@ -134,7 +135,16 @@ func (channel *Channel) AddAbilities() error {
abilities
=
append
(
abilities
,
ability
)
}
}
return
DB
.
Create
(
&
abilities
)
.
Error
if
len
(
abilities
)
==
0
{
return
nil
}
for
_
,
chunk
:=
range
lo
.
Chunk
(
abilities
,
50
)
{
err
:=
DB
.
Create
(
&
chunk
)
.
Error
if
err
!=
nil
{
return
err
}
}
return
nil
}
func
(
channel
*
Channel
)
DeleteAbilities
()
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