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
371d62e7
Commit
371d62e7
authored
Mar 04, 2020
by
shajiaiming
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix
parent
b640f5e7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
33 additions
and
33 deletions
+33
-33
coin.go
models/coin.go
+4
-4
coin.go
routers/api/v1/coin.go
+6
-6
supported_chain.go
routers/api/v1/supported_chain.go
+6
-6
wallet_coin_relation.go
routers/api/v1/wallet_coin_relation.go
+5
-5
coin.go
service/coin_service/coin.go
+7
-7
wallet_coin_relation.go
service/wallet_coin_relation_service/wallet_coin_relation.go
+3
-3
coin.go
validate_service/coin.go
+2
-2
No files found.
models/coin.go
View file @
371d62e7
...
...
@@ -10,8 +10,8 @@ type Coin struct {
Model
Id
int
`json:"primary_key, id,omitempty"`
Symbol
string
`json:"symbol"`
//简称
N
ame
json
.
RawMessage
`json:"name"`
//全称
Name
string
`json:"name"`
//简称
N
ickname
json
.
RawMessage
`json:"nickname"`
//全称
Icon
string
`json:"icon"`
//币种图标
Introduce
json
.
RawMessage
`json:"introduce"`
//币种介绍
Official
string
`json:"official"`
//官网
...
...
@@ -124,8 +124,8 @@ func GetCoin(id int) (*Coin, error) {
*/
func
AddCoin
(
data
map
[
string
]
interface
{})
(
error
)
{
coin
:=
Coin
{
Symbol
:
data
[
"symbol
"
]
.
(
string
),
N
ame
:
data
[
"
name"
]
.
(
json
.
RawMessage
),
Name
:
data
[
"name
"
]
.
(
string
),
N
ickname
:
data
[
"nick
name"
]
.
(
json
.
RawMessage
),
Icon
:
data
[
"icon"
]
.
(
string
),
Introduce
:
data
[
"introduce"
]
.
(
json
.
RawMessage
),
Official
:
data
[
"official"
]
.
(
string
),
...
...
routers/api/v1/coin.go
View file @
371d62e7
...
...
@@ -64,9 +64,9 @@ func GetCoins(c *gin.Context) {
valid
:=
validation
.
Validation
{}
symbol
:=
""
if
arg
:=
c
.
Query
(
"
symbol
"
);
arg
!=
""
{
symbol
=
c
.
Query
(
"symbol
"
)
name
:=
""
if
arg
:=
c
.
Query
(
"
name
"
);
arg
!=
""
{
name
=
c
.
Query
(
"name
"
)
}
platform
:=
""
...
...
@@ -90,7 +90,7 @@ func GetCoins(c *gin.Context) {
}
coinService
:=
coin_service
.
Coin
{
Symbol
:
symbol
,
Name
:
name
,
Chain
:
chain
,
Platform
:
platform
,
PlatformId
:
platform_id
,
...
...
@@ -140,7 +140,7 @@ func AddCoin(c *gin.Context) {
coinService
:=
coin_service
.
Coin
{
Name
:
coin
.
Name
,
Symbol
:
coin
.
Symbol
,
Nickname
:
coin
.
Nickname
,
Icon
:
coin
.
Icon
,
Introduce
:
coin
.
Introduce
,
Official
:
coin
.
Official
,
...
...
@@ -179,7 +179,7 @@ func EditCoin(c *gin.Context) {
coinService
:=
coin_service
.
Coin
{
Id
:
coin
.
Id
,
Name
:
coin
.
Name
,
Symbol
:
coin
.
Symbol
,
Nickname
:
coin
.
Nickname
,
Icon
:
coin
.
Icon
,
Introduce
:
coin
.
Introduce
,
Official
:
coin
.
Official
,
...
...
routers/api/v1/supported_chain.go
View file @
371d62e7
...
...
@@ -81,8 +81,8 @@ func AddSupportedChain(c *gin.Context) {
}
coinService
:=
coin_service
.
Coin
{
Symbol
:
chain
.
CoinName
,
Chain
:
strings
.
ToUpper
(
chain
.
CoinName
),
Name
:
chain
.
CoinName
,
Chain
:
strings
.
ToUpper
(
chain
.
CoinName
),
}
coin
,
err
:=
coinService
.
Find
()
...
...
@@ -90,10 +90,10 @@ func AddSupportedChain(c *gin.Context) {
handler
.
SendResponse
(
c
,
errno
.
ErrCoinNotFound
,
nil
)
return
}
if
""
==
coin
.
Symbol
{
if
""
==
coin
.
Name
{
coinService
:=
coin_service
.
Coin
{
Symbol
:
chain
.
CoinName
,
Chain
:
"BTY"
,
Name
:
chain
.
CoinName
,
Chain
:
"BTY"
,
}
coin
,
err
=
coinService
.
Find
()
if
err
!=
nil
{
...
...
@@ -101,7 +101,7 @@ func AddSupportedChain(c *gin.Context) {
return
}
}
if
""
==
coin
.
Symbol
{
if
""
==
coin
.
Name
{
handler
.
SendResponse
(
c
,
errno
.
ErrCoinNotFound
,
nil
)
return
}
...
...
routers/api/v1/wallet_coin_relation.go
View file @
371d62e7
...
...
@@ -25,9 +25,9 @@ func GetWalletCoinRelationCoinRelations(c *gin.Context) {
}
else
{
platform_id
=
auth
.
PlatformId
}
symbol
:=
""
if
arg
:=
c
.
Query
(
"
symbol
"
);
arg
!=
""
{
symbol
=
c
.
Query
(
"symbol
"
)
name
:=
""
if
arg
:=
c
.
Query
(
"
name
"
);
arg
!=
""
{
name
=
c
.
Query
(
"name
"
)
}
platform
:=
""
...
...
@@ -43,10 +43,10 @@ func GetWalletCoinRelationCoinRelations(c *gin.Context) {
walletCoinRelateionService
:=
wallet_coin_relation_service
.
WalletCoinRelation
{
PlatformId
:
platform_id
,
CoinCondition
:
struct
{
Symbol
string
Name
string
Chain
string
Platform
string
}{
Symbol
:
symbol
,
Chain
:
chain
,
Platform
:
platform
},
}{
Name
:
name
,
Chain
:
chain
,
Platform
:
platform
},
PageNum
:
util
.
GetPage
(
c
),
PageSize
:
util
.
GetLimit
(
c
),
}
...
...
service/coin_service/coin.go
View file @
371d62e7
...
...
@@ -9,8 +9,8 @@ import (
type
Coin
struct
{
Id
int
Symbol
string
N
ame
json
.
RawMessage
Name
string
N
ickname
json
.
RawMessage
Icon
string
Introduce
json
.
RawMessage
Official
string
...
...
@@ -74,7 +74,7 @@ func (c *Coin) GetAll() ([]*models.Coin, error) {
func
(
c
*
Coin
)
Find
()
(
*
models
.
Coin
,
error
)
{
var
coin
*
models
.
Coin
coin
,
err
:=
models
.
Find
(
c
.
Symbol
,
c
.
Chain
)
coin
,
err
:=
models
.
Find
(
c
.
Name
,
c
.
Chain
)
if
err
!=
nil
{
return
nil
,
err
}
...
...
@@ -88,8 +88,8 @@ func (c *Coin) Find() (*models.Coin, error) {
*/
func
(
c
*
Coin
)
Add
()
error
{
coin
:=
map
[
string
]
interface
{}{
"symbol"
:
c
.
Symbol
,
"name"
:
c
.
Name
,
"nickname"
:
c
.
Nickname
,
"icon"
:
c
.
Icon
,
"introduce"
:
c
.
Introduce
,
"official"
:
c
.
Official
,
...
...
@@ -121,7 +121,7 @@ func (c *Coin) Add() error {
func
(
c
*
Coin
)
Edit
()
error
{
return
models
.
EditCoin
(
c
.
Id
,
map
[
string
]
interface
{}{
"name"
:
c
.
Name
,
"
symbol"
:
c
.
Symbol
,
"
nickname"
:
c
.
Nickname
,
"icon"
:
c
.
Icon
,
"introduce"
:
c
.
Introduce
,
"official"
:
c
.
Official
,
...
...
@@ -184,8 +184,8 @@ func (c *Coin) getMaps() (map[string]interface{}) {
maps
[
"id"
]
=
c
.
Id
}
if
c
.
Symbol
!=
""
{
maps
[
"
symbol"
]
=
c
.
Symbol
if
c
.
Name
!=
""
{
maps
[
"
name"
]
=
c
.
Name
}
if
c
.
Chain
!=
""
{
maps
[
"chain"
]
=
c
.
Chain
...
...
service/wallet_coin_relation_service/wallet_coin_relation.go
View file @
371d62e7
...
...
@@ -14,7 +14,7 @@ type WalletCoinRelation struct {
}
type
CoinCondition
struct
{
Symbol
string
Name
string
Chain
string
Platform
string
}
...
...
@@ -82,8 +82,8 @@ func (c *WalletCoinRelation) getMaps() (map[string]interface{}) {
}
var
condition
=
make
(
map
[
string
]
interface
{})
if
c
.
CoinCondition
.
Symbol
!=
""
{
condition
[
"name"
]
=
c
.
CoinCondition
.
Symbol
if
c
.
CoinCondition
.
Name
!=
""
{
condition
[
"name"
]
=
c
.
CoinCondition
.
Name
}
if
c
.
CoinCondition
.
Chain
!=
""
{
...
...
validate_service/coin.go
View file @
371d62e7
...
...
@@ -3,8 +3,8 @@ package validate_service
import
"encoding/json"
type
Coin
struct
{
Symbol
string
`json:"symbol
" validate:"required"`
N
ame
json
.
RawMessage
`json:"
name" validate:"required"`
Name
string
`json:"name
" validate:"required"`
N
ickname
json
.
RawMessage
`json:"nick
name" validate:"required"`
Icon
string
`json:"icon" validate:"required"`
Introduce
json
.
RawMessage
`json:"introduce" validate:"required"`
...
...
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