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
62790096
Commit
62790096
authored
Jan 17, 2020
by
shajiaiming
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix
parent
daf62281
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
17 additions
and
11 deletions
+17
-11
wallet_coin_relation.go
models/wallet_coin_relation.go
+5
-1
wallet_coin_relation.go
routers/api/v1/wallet_coin_relation.go
+6
-6
wallet_coin_relation.go
service/wallet_coin_relation_service/wallet_coin_relation.go
+6
-4
No files found.
models/wallet_coin_relation.go
View file @
62790096
...
@@ -40,7 +40,11 @@ func GetWalletCoinRelationTotal(maps interface{}) (int, error) {
...
@@ -40,7 +40,11 @@ func GetWalletCoinRelationTotal(maps interface{}) (int, error) {
func
GetWalletCoinRelations
(
pageNum
,
pageSize
int
,
maps
interface
{})
([]
*
WalletCoinRelation
,
error
)
{
func
GetWalletCoinRelations
(
pageNum
,
pageSize
int
,
maps
interface
{})
([]
*
WalletCoinRelation
,
error
)
{
var
coins
[]
*
WalletCoinRelation
var
coins
[]
*
WalletCoinRelation
err
:=
db
.
Preload
(
"Coin"
)
.
Where
(
maps
)
.
Offset
(
pageNum
)
.
Limit
(
pageSize
)
.
Find
(
&
coins
)
.
Error
conditions
:=
make
(
map
[
string
]
interface
{})
conditions
[
"name"
]
=
"ETH"
conditions
[
"sid"
]
=
"ethereum"
conditions
[
"platform"
]
=
"ethereum"
err
:=
db
.
Preload
(
"Coin"
,
conditions
)
.
Debug
()
.
Where
(
maps
)
.
Offset
(
pageNum
)
.
Limit
(
pageSize
)
.
Find
(
&
coins
)
.
Error
if
err
!=
nil
&&
err
!=
gorm
.
ErrRecordNotFound
{
if
err
!=
nil
&&
err
!=
gorm
.
ErrRecordNotFound
{
return
nil
,
err
return
nil
,
err
}
}
...
...
routers/api/v1/wallet_coin_relation.go
View file @
62790096
...
@@ -26,19 +26,19 @@ func GetWalletCoinRelationCoinRelations(c *gin.Context) {
...
@@ -26,19 +26,19 @@ func GetWalletCoinRelationCoinRelations(c *gin.Context) {
platform_id
=
auth
.
PlatformId
platform_id
=
auth
.
PlatformId
}
}
walletCoinRelateionService
:=
wallet_coin_relation_service
.
WalletCoinRelation
{}
walletCoinRelateionService
:=
wallet_coin_relation_service
.
WalletCoinRelation
{
walletCoinRelateionService
=
wallet_coin_relation_service
.
WalletCoinRelation
{
PlatformId
:
platform_id
,
PlatformId
:
platform_id
,
PageNum
:
util
.
GetPage
(
c
),
PageNum
:
util
.
GetPage
(
c
),
PageSize
:
util
.
GetLimit
(
c
),
PageSize
:
util
.
GetLimit
(
c
),
}
}
total
,
err
:=
walletCoinRelateionService
.
Count
()
/*
_, err := walletCoinRelateionService.Count()
if err != nil {
if err != nil {
//
handler.SendResponse(c, errno.ErrCountWalletCoinRelation, nil)
handler.SendResponse(c, errno.ErrCountWalletCoinRelation, nil)
return
return
}
}
*/
coins
,
err
:=
walletCoinRelateionService
.
GetAll
()
coins
,
err
:=
walletCoinRelateionService
.
GetAll
()
if
err
!=
nil
{
if
err
!=
nil
{
...
@@ -48,7 +48,7 @@ func GetWalletCoinRelationCoinRelations(c *gin.Context) {
...
@@ -48,7 +48,7 @@ func GetWalletCoinRelationCoinRelations(c *gin.Context) {
data
:=
make
(
map
[
string
]
interface
{})
data
:=
make
(
map
[
string
]
interface
{})
data
[
"items"
]
=
coins
data
[
"items"
]
=
coins
data
[
"total"
]
=
total
data
[
"total"
]
=
len
(
coins
)
handler
.
SendResponse
(
c
,
nil
,
data
)
handler
.
SendResponse
(
c
,
nil
,
data
)
}
}
...
...
service/wallet_coin_relation_service/wallet_coin_relation.go
View file @
62790096
...
@@ -5,8 +5,9 @@ import (
...
@@ -5,8 +5,9 @@ import (
)
)
type
WalletCoinRelation
struct
{
type
WalletCoinRelation
struct
{
PlatformId
int
PlatformId
int
CoinId
int
CoinId
int
CoinInfo
models
.
Coin
PageNum
int
PageNum
int
PageSize
int
PageSize
int
...
@@ -20,9 +21,10 @@ func (w *WalletCoinRelation) GetAll() ([]*models.Coin, error) {
...
@@ -20,9 +21,10 @@ func (w *WalletCoinRelation) GetAll() ([]*models.Coin, error) {
return
nil
,
err
return
nil
,
err
}
}
var
coins
[]
*
models
.
Coin
var
coins
[]
*
models
.
Coin
for
_
,
value
:=
range
wallet_coin_relations
{
for
_
,
value
:=
range
wallet_coin_relations
{
coins
=
append
(
coins
,
value
.
Coin
)
if
nil
!=
value
.
Coin
{
coins
=
append
(
coins
,
value
.
Coin
)
}
}
}
return
coins
,
nil
return
coins
,
nil
...
...
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