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
e5bb8042
Commit
e5bb8042
authored
Mar 10, 2021
by
shajiaiming
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix
parent
1d38c6f8
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
5 deletions
+15
-5
coin.go
routers/api/backend/coin.go
+1
-1
wallet_coin_relation.go
routers/api/backend/wallet_coin_relation.go
+14
-4
No files found.
routers/api/backend/coin.go
View file @
e5bb8042
...
@@ -146,7 +146,7 @@ func AddCoin(c *gin.Context) {
...
@@ -146,7 +146,7 @@ func AddCoin(c *gin.Context) {
Decimals
:
coin
.
Decimals
,
Decimals
:
coin
.
Decimals
,
Address
:
coin
.
Address
,
Address
:
coin
.
Address
,
Treaty
:
coin
.
Treaty
,
Treaty
:
coin
.
Treaty
,
PlatformId
:
"
1
"
,
PlatformId
:
"
[1]
"
,
}
}
if
err
:=
coinService
.
Add
();
err
!=
nil
{
if
err
:=
coinService
.
Add
();
err
!=
nil
{
...
...
routers/api/backend/wallet_coin_relation.go
View file @
e5bb8042
...
@@ -108,15 +108,21 @@ func AddWalletCoinRelationCoinRelation(c *gin.Context) {
...
@@ -108,15 +108,21 @@ func AddWalletCoinRelationCoinRelation(c *gin.Context) {
}
}
coin_exist
,
_
:=
coinService
.
Get
()
coin_exist
,
_
:=
coinService
.
Get
()
platform_id_arr
:=
strings
.
Split
(
coin_exist
.
PlatformId
,
","
)
is_exist
:=
false
is_exist
:=
false
temp_exist_platform_ids
:=
strings
.
Replace
(
coin_exist
.
PlatformId
,
"["
,
""
,
-
1
)
temp_exist_platform_ids
=
strings
.
Replace
(
temp_exist_platform_ids
,
"]"
,
""
,
-
1
)
temp_exist_platform_ids
=
strings
.
Replace
(
temp_exist_platform_ids
,
" "
,
""
,
-
1
)
platform_id_arr
:=
strings
.
Split
(
temp_exist_platform_ids
,
","
)
for
_
,
exist_platform_id
:=
range
platform_id_arr
{
for
_
,
exist_platform_id
:=
range
platform_id_arr
{
if
util
.
ToInt
(
exist_platform_id
)
==
coin_relation
.
PlatformId
{
if
util
.
ToInt
(
exist_platform_id
)
==
coin_relation
.
PlatformId
{
is_exist
=
true
is_exist
=
true
}
}
}
}
if
is_exist
==
false
{
if
is_exist
==
false
{
coinService
.
PlatformId
=
coin_exist
.
PlatformId
+
","
+
strconv
.
Itoa
(
coin_relation
.
PlatformId
)
coinService
.
PlatformId
=
strings
.
Replace
(
coin_exist
.
PlatformId
,
"]"
,
","
,
-
1
)
+
strconv
.
Itoa
(
coin_relation
.
PlatformId
)
+
"]"
coinService
.
UpdateCoinRelation
()
coinService
.
UpdateCoinRelation
()
}
}
}
}
...
@@ -163,7 +169,11 @@ func DeleteWalletCoinRelationCoinRelation(c *gin.Context) {
...
@@ -163,7 +169,11 @@ func DeleteWalletCoinRelationCoinRelation(c *gin.Context) {
}
}
coin_exist
,
_
:=
coinService
.
Get
()
coin_exist
,
_
:=
coinService
.
Get
()
platform_id_arr
:=
strings
.
Split
(
coin_exist
.
PlatformId
,
","
)
temp_exist_platform_ids
:=
strings
.
Replace
(
coin_exist
.
PlatformId
,
"["
,
""
,
-
1
)
temp_exist_platform_ids
=
strings
.
Replace
(
temp_exist_platform_ids
,
"]"
,
""
,
-
1
)
temp_exist_platform_ids
=
strings
.
Replace
(
temp_exist_platform_ids
,
" "
,
""
,
-
1
)
platform_id_arr
:=
strings
.
Split
(
temp_exist_platform_ids
,
","
)
var
new_platform_id
string
var
new_platform_id
string
for
_
,
exist_platform_id
:=
range
platform_id_arr
{
for
_
,
exist_platform_id
:=
range
platform_id_arr
{
...
@@ -173,7 +183,7 @@ func DeleteWalletCoinRelationCoinRelation(c *gin.Context) {
...
@@ -173,7 +183,7 @@ func DeleteWalletCoinRelationCoinRelation(c *gin.Context) {
new_platform_id
=
strings
.
Join
([]
string
{
exist_platform_id
,
new_platform_id
},
","
)
new_platform_id
=
strings
.
Join
([]
string
{
exist_platform_id
,
new_platform_id
},
","
)
new_platform_id
=
strings
.
TrimRight
(
new_platform_id
,
","
)
new_platform_id
=
strings
.
TrimRight
(
new_platform_id
,
","
)
}
}
coinService
.
PlatformId
=
new_platform_id
coinService
.
PlatformId
=
"["
+
new_platform_id
+
"]"
coinService
.
UpdateCoinRelation
()
coinService
.
UpdateCoinRelation
()
handler
.
SendResponse
(
c
,
nil
,
nil
)
handler
.
SendResponse
(
c
,
nil
,
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