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
d4fc50ed
Commit
d4fc50ed
authored
Apr 15, 2020
by
shajiaiming
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
添加平台时唯一验证
parent
1e906084
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
12 additions
and
1 deletion
+12
-1
errno.go
pkg/errno/errno.go
+1
-0
chain.go
routers/api/v1/chain.go
+6
-0
chain.go
service/chain_service/chain.go
+4
-0
chain.go
validate_service/chain.go
+1
-1
No files found.
pkg/errno/errno.go
View file @
d4fc50ed
...
@@ -97,6 +97,7 @@ var (
...
@@ -97,6 +97,7 @@ var (
ErrAddChain
=
&
Errno
{
Code
:
20101
,
Message
:
"The chain add error."
}
ErrAddChain
=
&
Errno
{
Code
:
20101
,
Message
:
"The chain add error."
}
ErrUpdateChain
=
&
Errno
{
Code
:
20102
,
Message
:
"The chain update error."
}
ErrUpdateChain
=
&
Errno
{
Code
:
20102
,
Message
:
"The chain update error."
}
ErrDeleteChain
=
&
Errno
{
Code
:
20102
,
Message
:
"The chain delete error."
}
ErrDeleteChain
=
&
Errno
{
Code
:
20102
,
Message
:
"The chain delete error."
}
ErrExistChain
=
&
Errno
{
Code
:
20103
,
Message
:
"The chain already exists."
}
// supported currency errors
// supported currency errors
ErrSupportedCurrencyNotFound
=
&
Errno
{
Code
:
20101
,
Message
:
"The supported currency was not found."
}
ErrSupportedCurrencyNotFound
=
&
Errno
{
Code
:
20101
,
Message
:
"The supported currency was not found."
}
...
...
routers/api/v1/chain.go
View file @
d4fc50ed
...
@@ -147,6 +147,12 @@ func AddChain(c *gin.Context) {
...
@@ -147,6 +147,12 @@ func AddChain(c *gin.Context) {
Lock
:
chain
.
Lock
,
Lock
:
chain
.
Lock
,
}
}
count
,
err
:=
chainService
.
Count
()
if
err
!=
nil
||
count
>
0
{
handler
.
SendResponse
(
c
,
errno
.
ErrExistChain
,
nil
)
return
}
if
err
:=
chainService
.
Add
();
err
!=
nil
{
if
err
:=
chainService
.
Add
();
err
!=
nil
{
handler
.
SendResponse
(
c
,
errno
.
ErrAddChain
,
nil
)
handler
.
SendResponse
(
c
,
errno
.
ErrAddChain
,
nil
)
return
return
...
...
service/chain_service/chain.go
View file @
d4fc50ed
...
@@ -99,5 +99,9 @@ func (c *Chain) getMaps() (map[string]interface{}) {
...
@@ -99,5 +99,9 @@ func (c *Chain) getMaps() (map[string]interface{}) {
maps
[
"id"
]
=
c
.
ID
maps
[
"id"
]
=
c
.
ID
}
}
if
c
.
Platform
!=
""
{
maps
[
"platform"
]
=
c
.
Platform
}
return
maps
return
maps
}
}
validate_service/chain.go
View file @
d4fc50ed
...
@@ -8,7 +8,7 @@ type Chain struct {
...
@@ -8,7 +8,7 @@ type Chain struct {
Token
string
`json:"token" validate:"omitempty"`
Token
string
`json:"token" validate:"omitempty"`
Fee
float32
`json:"fee" validate:"omitempty"`
Fee
float32
`json:"fee" validate:"omitempty"`
BrowerUrl
string
`json:"brower_url" validate:"omitempty,url"`
BrowerUrl
string
`json:"brower_url" validate:"omitempty,url"`
Lock
int
`json:"lock" validate:"
omitempty
"`
Lock
int
`json:"lock" validate:"
min=1,max=2
"`
}
}
type
EditChain
struct
{
type
EditChain
struct
{
...
...
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