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