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
aa31e5ee
Commit
aa31e5ee
authored
Nov 05, 2020
by
shajiaiming
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
托管币种添加时加入币种名称
parent
30865711
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
16 additions
and
35 deletions
+16
-35
fee.go
models/fee.go
+2
-0
fee.go
routers/api/app/fee.go
+5
-35
recommend_coin.go
routers/api/backend/recommend_coin.go
+3
-0
fee.go
service/fee_service/fee.go
+6
-0
No files found.
models/fee.go
View file @
aa31e5ee
...
@@ -14,6 +14,7 @@ type Fee struct {
...
@@ -14,6 +14,7 @@ type Fee struct {
FeesType
uint8
`json:"fees_type"`
FeesType
uint8
`json:"fees_type"`
Fees
float32
`json:"fees"`
Fees
float32
`json:"fees"`
TransactionFees
float32
`json:"transaction_fees"`
TransactionFees
float32
`json:"transaction_fees"`
CoinName
string
`json:"coin_name"`
CoinInfo
*
Coin
`gorm:"foreignkey:Cid" json:"coin,omitempty"`
CoinInfo
*
Coin
`gorm:"foreignkey:Cid" json:"coin,omitempty"`
}
}
...
@@ -73,6 +74,7 @@ func AddFee(data map[string]interface{}) (error) {
...
@@ -73,6 +74,7 @@ func AddFee(data map[string]interface{}) (error) {
fee
:=
Fee
{
fee
:=
Fee
{
Cid
:
data
[
"cid"
]
.
(
int
),
Cid
:
data
[
"cid"
]
.
(
int
),
PlatformId
:
data
[
"platform_id"
]
.
(
int
),
PlatformId
:
data
[
"platform_id"
]
.
(
int
),
CoinName
:
data
[
"coin_name"
]
.
(
string
),
}
}
if
err
:=
db
.
Create
(
&
fee
)
.
Error
;
err
!=
nil
{
if
err
:=
db
.
Create
(
&
fee
)
.
Error
;
err
!=
nil
{
return
err
return
err
...
...
routers/api/app/fee.go
View file @
aa31e5ee
...
@@ -4,7 +4,6 @@ import (
...
@@ -4,7 +4,6 @@ import (
"bwallet/pkg/errno"
"bwallet/pkg/errno"
"bwallet/pkg/handler"
"bwallet/pkg/handler"
"bwallet/pkg/util"
"bwallet/pkg/util"
"bwallet/service/coin_service"
"bwallet/service/fee_service"
"bwallet/service/fee_service"
"github.com/Unknwon/com"
"github.com/Unknwon/com"
"github.com/astaxie/beego/validation"
"github.com/astaxie/beego/validation"
...
@@ -24,42 +23,13 @@ func GetTransactionFee(c *gin.Context) {
...
@@ -24,42 +23,13 @@ func GetTransactionFee(c *gin.Context) {
return
return
}
}
coinService
:=
coin_service
.
Coin
{
feeService
:=
fee_service
.
Fee
{
Name
:
name
,
PlatformId
:
platform_id
,
PageNum
:
util
.
GetPage
(
c
),
CoinName
:
name
,
PageSize
:
util
.
GetLimit
(
c
),
PageNum
:
util
.
GetPage
(
c
),
PageSize
:
util
.
GetLimit
(
c
),
}
}
total
,
err
:=
coinService
.
Count
()
if
err
!=
nil
||
0
==
total
{
handler
.
SendResponse
(
c
,
errno
.
ErrCountCoin
,
nil
)
return
}
coins
,
err
:=
coinService
.
GetAll
()
if
err
!=
nil
{
handler
.
SendResponse
(
c
,
errno
.
InternalServerError
,
nil
)
return
}
feeService
:=
fee_service
.
Fee
{}
if
name
==
"BBB"
{
feeService
=
fee_service
.
Fee
{
PlatformId
:
platform_id
,
Cid
:
coins
[
1
]
.
ID
,
PageNum
:
util
.
GetPage
(
c
),
PageSize
:
util
.
GetLimit
(
c
),
}
}
else
{
feeService
=
fee_service
.
Fee
{
PlatformId
:
platform_id
,
Cid
:
coins
[
0
]
.
ID
,
PageNum
:
util
.
GetPage
(
c
),
PageSize
:
util
.
GetLimit
(
c
),
}
}
total_fee
,
err_fee
:=
feeService
.
Count
()
total_fee
,
err_fee
:=
feeService
.
Count
()
if
err_fee
!=
nil
||
0
==
total_fee
{
if
err_fee
!=
nil
||
0
==
total_fee
{
handler
.
SendResponse
(
c
,
errno
.
ErrCountCoin
,
nil
)
handler
.
SendResponse
(
c
,
errno
.
ErrCountCoin
,
nil
)
...
...
routers/api/backend/recommend_coin.go
View file @
aa31e5ee
...
@@ -130,9 +130,12 @@ func AddRecommendCoin(c *gin.Context) {
...
@@ -130,9 +130,12 @@ func AddRecommendCoin(c *gin.Context) {
continue
continue
}
}
coin
,
_
:=
coinService
.
Get
()
feeService
:=
fee_service
.
Fee
{
feeService
:=
fee_service
.
Fee
{
Cid
:
coin_id
,
Cid
:
coin_id
,
PlatformId
:
platform_id
,
PlatformId
:
platform_id
,
CoinName
:
coin
.
Name
,
}
}
feeService
.
Add
()
feeService
.
Add
()
...
...
service/fee_service/fee.go
View file @
aa31e5ee
...
@@ -11,6 +11,7 @@ type Fee struct {
...
@@ -11,6 +11,7 @@ type Fee struct {
FeesType
uint8
FeesType
uint8
Fees
float32
Fees
float32
TransactionFees
float32
TransactionFees
float32
CoinName
string
PageNum
int
PageNum
int
PageSize
int
PageSize
int
...
@@ -41,6 +42,7 @@ func (c *Fee) Add() error {
...
@@ -41,6 +42,7 @@ func (c *Fee) Add() error {
fee
:=
map
[
string
]
interface
{}{
fee
:=
map
[
string
]
interface
{}{
"cid"
:
c
.
Cid
,
"cid"
:
c
.
Cid
,
"platform_id"
:
c
.
PlatformId
,
"platform_id"
:
c
.
PlatformId
,
"coin_name"
:
c
.
CoinName
,
}
}
if
err
:=
models
.
AddFee
(
fee
);
err
!=
nil
{
if
err
:=
models
.
AddFee
(
fee
);
err
!=
nil
{
...
@@ -92,5 +94,9 @@ func (c *Fee) getMaps() (map[string]interface{}) {
...
@@ -92,5 +94,9 @@ func (c *Fee) getMaps() (map[string]interface{}) {
maps
[
"cid"
]
=
c
.
Cid
maps
[
"cid"
]
=
c
.
Cid
}
}
if
c
.
CoinName
!=
""
{
maps
[
"coin_name"
]
=
c
.
CoinName
}
return
maps
return
maps
}
}
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