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
1016ef75
authored
Sep 18, 2023
by
JustSong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: fix gorm expression
Co-authored-by: 初音控灬 <xyfacai@gmail.com>
parent
489eeff4
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
2 additions
and
2 deletions
+2
-2
model/ability.go
+2
-2
No files found.
model/ability.go
View file @
1016ef75
...
@@ -19,9 +19,9 @@ func GetRandomSatisfiedChannel(group string, model string) (*Channel, error) {
...
@@ -19,9 +19,9 @@ func GetRandomSatisfiedChannel(group string, model string) (*Channel, error) {
maxPrioritySubQuery
:=
DB
.
Model
(
&
Ability
{})
.
Select
(
"MAX(priority)"
)
.
Where
(
"`group` = ? and model = ? and enabled = 1"
,
group
,
model
)
maxPrioritySubQuery
:=
DB
.
Model
(
&
Ability
{})
.
Select
(
"MAX(priority)"
)
.
Where
(
"`group` = ? and model = ? and enabled = 1"
,
group
,
model
)
channelQuery
:=
DB
.
Where
(
"`group` = ? and model = ? and enabled = 1 and priority = (?)"
,
group
,
model
,
maxPrioritySubQuery
)
channelQuery
:=
DB
.
Where
(
"`group` = ? and model = ? and enabled = 1 and priority = (?)"
,
group
,
model
,
maxPrioritySubQuery
)
if
common
.
UsingSQLite
{
if
common
.
UsingSQLite
{
err
=
channelQuery
.
Order
(
"RANDOM()"
)
.
Limit
(
1
)
.
First
(
&
ability
)
.
Error
err
=
channelQuery
.
Order
(
"RANDOM()"
)
.
First
(
&
ability
)
.
Error
}
else
{
}
else
{
err
=
channelQuery
.
Order
(
"RAND()"
)
.
Limit
(
1
)
.
First
(
&
ability
)
.
Error
err
=
channelQuery
.
Order
(
"RAND()"
)
.
First
(
&
ability
)
.
Error
}
}
if
err
!=
nil
{
if
err
!=
nil
{
return
nil
,
err
return
nil
,
err
...
...
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