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
185b9a0f
Commit
185b9a0f
authored
Jan 04, 2020
by
shajiaming
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix
parent
45ff7424
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
24 additions
and
33 deletions
+24
-33
coin.go
models/coin.go
+2
-2
coin.go
routers/api/v1/coin.go
+22
-22
coin.go
service/coin_service/coin.go
+0
-9
No files found.
models/coin.go
View file @
185b9a0f
...
...
@@ -114,9 +114,9 @@ func AddCoin(data map[string]interface{}) (error) {
coin
:=
Coin
{
Sid
:
data
[
"sid"
]
.
(
string
),
Name
:
data
[
"name"
]
.
(
string
),
Nickname
:
data
[
"nickname"
]
.
(
string
)
,
Nickname
:
"{
\"
ja
\"
:
\"\"
,
\"
en-US
\"
:
\"\"
,
\"
zh-CN
\"
:
\"
ICON
\"
}"
,
Icon
:
data
[
"icon"
]
.
(
string
),
Introduce
:
data
[
"introduce"
]
.
(
string
)
,
Introduce
:
"{
\"
ja
\"
:
\"\"
,
\"
en-US
\"
:
\"\"
,
\"
zh-CN
\"
:
\"
ICON
\"
}"
,
Official
:
data
[
"official"
]
.
(
string
),
Paper
:
data
[
"paper"
]
.
(
string
),
Platform
:
data
[
"platform"
]
.
(
string
),
...
...
routers/api/v1/coin.go
View file @
185b9a0f
...
...
@@ -7,6 +7,7 @@ import (
"bwallet/service/auth_service"
"bwallet/service/coin_service"
"bwallet/validate_service"
"fmt"
"github.com/Unknwon/com"
"github.com/astaxie/beego/validation"
"github.com/gin-gonic/gin"
...
...
@@ -170,7 +171,6 @@ func GetCoins(c *gin.Context) {
func
AddCoin
(
c
*
gin
.
Context
)
{
coin
:=
validate_service
.
Coin
{}
c
.
ShouldBindJSON
(
&
coin
)
//方法一
if
ok
,
errors
:=
validateCoinInputs
(
coin
);
!
ok
{
for
_
,
err
:=
range
errors
{
...
...
@@ -218,11 +218,11 @@ func AddCoin(c *gin.Context) {
}
func
EditCoin
(
c
*
gin
.
Context
)
{
wallet
:=
validate_service
.
EditCoin
{}
c
.
ShouldBindJSON
(
&
wallet
)
coin
:=
validate_service
.
EditCoin
{}
c
.
ShouldBindJSON
(
&
coin
)
//方法一
if
ok
,
errors
:=
validateCoinInputs
(
wallet
);
!
ok
{
if
ok
,
errors
:=
validateCoinInputs
(
coin
);
!
ok
{
for
_
,
err
:=
range
errors
{
handler
.
SendResponse
(
c
,
errno
.
ErrBind
,
strings
.
Join
(
err
,
" "
))
return
...
...
@@ -230,23 +230,23 @@ func EditCoin(c *gin.Context) {
}
coinService
:=
coin_service
.
Coin
{
Id
:
wallet
.
Id
,
Sid
:
wallet
.
Sid
,
Name
:
wallet
.
Name
,
Nickname
:
wallet
.
Nickname
,
Icon
:
wallet
.
Icon
,
Introduce
:
wallet
.
Introduce
,
Official
:
wallet
.
Official
,
Paper
:
wallet
.
Paper
,
Platform
:
wallet
.
Platform
,
Chain
:
wallet
.
Chain
,
Release
:
wallet
.
Release
,
AreaSearch
:
wallet
.
AreaSearch
,
PublishCount
:
wallet
.
PublishCount
,
CirculateCount
:
wallet
.
CirculateCount
,
Decimals
:
wallet
.
Decimals
,
Address
:
wallet
.
Address
,
Treaty
:
wallet
.
Treaty
,
Id
:
coin
.
Id
,
Sid
:
coin
.
Sid
,
Name
:
coin
.
Name
,
Nickname
:
coin
.
Nickname
,
Icon
:
coin
.
Icon
,
Introduce
:
coin
.
Introduce
,
Official
:
coin
.
Official
,
Paper
:
coin
.
Paper
,
Platform
:
coin
.
Platform
,
Chain
:
coin
.
Chain
,
Release
:
coin
.
Release
,
AreaSearch
:
coin
.
AreaSearch
,
PublishCount
:
coin
.
PublishCount
,
CirculateCount
:
coin
.
CirculateCount
,
Decimals
:
coin
.
Decimals
,
Address
:
coin
.
Address
,
Treaty
:
coin
.
Treaty
,
}
exists
,
err
:=
coinService
.
ExistById
()
...
...
@@ -264,7 +264,7 @@ func EditCoin(c *gin.Context) {
auth
,
_
:=
authService
.
GetUserInfo
()
group
:=
auth
.
Group
if
(
"administrator"
!=
group
)
{
coin_model
:=
coin_service
.
Coin
{
Id
:
wallet
.
Id
}
coin_model
:=
coin_service
.
Coin
{
Id
:
coin
.
Id
}
coin
,
_
:=
coin_model
.
Get
()
if
coin
.
PlatformId
!=
auth
.
PlatformId
{
handler
.
SendResponse
(
c
,
errno
.
ErrUserTokenIncorrect
,
nil
)
...
...
service/coin_service/coin.go
View file @
185b9a0f
...
...
@@ -9,17 +9,14 @@ type Coin struct {
Id
int
Sid
string
Name
string
OptionalName
string
Nickname
string
Icon
string
Introduce
string
Official
string
Paper
string
Exchange
int
Platform
string
Chain
string
Release
string
Price
float64
AreaSearch
string
PublishCount
float64
CirculateCount
float64
...
...
@@ -82,17 +79,14 @@ func (c *Coin) Add() error {
coin
:=
map
[
string
]
interface
{}{
"sid"
:
c
.
Sid
,
"name"
:
c
.
Name
,
"optional_name"
:
c
.
OptionalName
,
"nickname"
:
c
.
Nickname
,
"icon"
:
c
.
Icon
,
"introduce"
:
c
.
Introduce
,
"official"
:
c
.
Official
,
"paper"
:
c
.
Paper
,
"exchange"
:
c
.
Exchange
,
"platform"
:
c
.
Platform
,
"chain"
:
c
.
Chain
,
"release"
:
c
.
Release
,
"price"
:
c
.
Price
,
"area_search"
:
c
.
AreaSearch
,
"publish_count"
:
c
.
PublishCount
,
"circulate_count"
:
c
.
CirculateCount
,
...
...
@@ -118,17 +112,14 @@ func (c *Coin) Edit() error {
return
models
.
EditCoin
(
c
.
Id
,
map
[
string
]
interface
{}{
"sid"
:
c
.
Sid
,
"name"
:
c
.
Name
,
"optional_name"
:
c
.
OptionalName
,
"nickname"
:
c
.
Nickname
,
"icon"
:
c
.
Icon
,
"introduce"
:
c
.
Introduce
,
"official"
:
c
.
Official
,
"paper"
:
c
.
Paper
,
"exchange"
:
c
.
Exchange
,
"platform"
:
c
.
Platform
,
"chain"
:
c
.
Chain
,
"release"
:
c
.
Release
,
"price"
:
c
.
Price
,
"area_search"
:
c
.
AreaSearch
,
"publish_count"
:
c
.
PublishCount
,
"circulate_count"
:
c
.
CirculateCount
,
...
...
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