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
07724ce3
authored
Apr 08, 2024
by
Xyfacai
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: 修复渠道一次性添加很多model失败
修复渠道一次性添加很多model并且group多 提示失败 too many SQL variables
parent
0d44e462
Show 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 @
07724ce3
...
@@ -3,6 +3,7 @@ package model
...
@@ -3,6 +3,7 @@ package model
import
(
import
(
"errors"
"errors"
"fmt"
"fmt"
"github.com/samber/lo"
"gorm.io/gorm"
"gorm.io/gorm"
"one-api/common"
"one-api/common"
"strings"
"strings"
...
@@ -134,7 +135,16 @@ func (channel *Channel) AddAbilities() error {
...
@@ -134,7 +135,16 @@ func (channel *Channel) AddAbilities() error {
abilities
=
append
(
abilities
,
ability
)
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
{
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