Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
B
bwallet
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
JIRA
JIRA
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Go
bwallet
Commits
d01b2880
Commit
d01b2880
authored
Mar 24, 2020
by
shajiaiming
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix
parent
27ceb447
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
4 deletions
+14
-4
coin.go
models/coin.go
+13
-3
util.go
pkg/util/util.go
+1
-1
No files found.
models/coin.go
View file @
d01b2880
...
...
@@ -68,8 +68,13 @@ func GetCoinTotal(maps interface{}) (int, error) {
term
[
key
]
=
val
}
}
if
err
:=
db
.
Model
(
&
Coin
{})
.
Where
(
"FIND_IN_SET(?, platform_id)"
,
platform_id
)
.
Where
(
term
)
.
Count
(
&
count
)
.
Error
;
err
!=
nil
{
var
err
error
if
0
==
platform_id
{
err
=
db
.
Model
(
&
Coin
{})
.
Where
(
term
)
.
Count
(
&
count
)
.
Error
}
else
{
err
=
db
.
Model
(
&
Coin
{})
.
Where
(
"FIND_IN_SET(?, platform_id)"
,
platform_id
)
.
Where
(
term
)
.
Count
(
&
count
)
.
Error
}
if
err
!=
nil
{
return
0
,
err
}
...
...
@@ -93,7 +98,12 @@ func GetCoins(pageNum, pageSize int, maps interface{}) ([]*Coin, error) {
}
}
err
:=
db
.
Where
(
"FIND_IN_SET(?, platform_id)"
,
platform_id
)
.
Where
(
term
)
.
Offset
(
pageNum
)
.
Limit
(
pageSize
)
.
Find
(
&
coins
)
.
Error
var
err
error
if
0
==
platform_id
{
err
=
db
.
Where
(
term
)
.
Offset
(
pageNum
)
.
Limit
(
pageSize
)
.
Find
(
&
coins
)
.
Error
}
else
{
err
=
db
.
Where
(
"FIND_IN_SET(?, platform_id)"
,
platform_id
)
.
Where
(
term
)
.
Offset
(
pageNum
)
.
Limit
(
pageSize
)
.
Find
(
&
coins
)
.
Error
}
if
err
!=
nil
&&
err
!=
gorm
.
ErrRecordNotFound
{
return
nil
,
err
...
...
pkg/util/util.go
View file @
d01b2880
...
...
@@ -12,7 +12,7 @@ func Setup() {
func
ToInt
(
o
interface
{})
int
{
if
o
==
nil
{
return
0
return
1
}
switch
t
:=
o
.
(
type
)
{
case
float64
:
...
...
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