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
b4ab5e9e
Commit
b4ab5e9e
authored
Jan 27, 2021
by
shajiaiming
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
设备托管手续费优化
parent
646dc158
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
25 additions
and
2 deletions
+25
-2
fee.go
models/fee.go
+2
-0
fee.go
routers/api/app/fee.go
+9
-1
fee.go
routers/api/backend/fee.go
+4
-1
recommend_coin.go
routers/api/backend/recommend_coin.go
+4
-0
fee.go
service/fee_service/fee.go
+6
-0
No files found.
models/fee.go
View file @
b4ab5e9e
...
...
@@ -15,6 +15,7 @@ type Fee struct {
Fees
float32
`json:"fees"`
TransactionFees
float32
`json:"transaction_fees"`
CoinName
string
`json:"coin_name"`
TransferType
uint8
`json:"transfer_type"`
CoinInfo
*
Coin
`gorm:"foreignkey:Cid" json:"coin,omitempty"`
}
...
...
@@ -79,6 +80,7 @@ func AddFee(data map[string]interface{}) (error) {
Cid
:
data
[
"cid"
]
.
(
int
),
PlatformId
:
data
[
"platform_id"
]
.
(
int
),
CoinName
:
data
[
"coin_name"
]
.
(
string
),
TransferType
:
data
[
"transfer_type"
]
.
(
uint8
),
}
if
err
:=
db
.
Create
(
&
fee
)
.
Error
;
err
!=
nil
{
return
err
...
...
routers/api/app/fee.go
View file @
b4ab5e9e
...
...
@@ -18,6 +18,8 @@ func GetTransactionFee(c *gin.Context) {
name
:=
c
.
DefaultQuery
(
"name"
,
""
)
valid
.
Required
(
name
,
"name"
)
.
Message
(
"币种不能为空"
)
transfer_type
:=
com
.
StrTo
(
c
.
DefaultQuery
(
"transfer_type"
,
"1"
))
.
MustUint8
()
if
valid
.
HasErrors
()
{
handler
.
SendResponse
(
c
,
valid
.
Errors
[
0
],
nil
)
return
...
...
@@ -26,16 +28,22 @@ func GetTransactionFee(c *gin.Context) {
feeService
:=
fee_service
.
Fee
{
PlatformId
:
platform_id
,
CoinName
:
name
,
TransferType
:
transfer_type
,
PageNum
:
util
.
GetPage
(
c
),
PageSize
:
util
.
GetLimit
(
c
),
}
total_fee
,
err_fee
:=
feeService
.
Count
()
if
err_fee
!=
nil
||
0
==
total_fee
{
if
err_fee
!=
nil
{
handler
.
SendResponse
(
c
,
errno
.
ErrCountCoin
,
nil
)
return
}
if
0
==
total_fee
{
handler
.
SendResponse
(
c
,
errno
.
ErrCoinNotFound
,
nil
)
return
}
fee
,
err
:=
feeService
.
Search
()
if
err
!=
nil
{
handler
.
SendResponse
(
c
,
errno
.
ErrCountCoin
,
nil
)
...
...
routers/api/backend/fee.go
View file @
b4ab5e9e
...
...
@@ -37,7 +37,7 @@ func GetTransactionCoins(c *gin.Context) {
}
vals
:=
[]
string
{}
for
_
,
value
:=
range
fees
{
for
_
,
value
:=
range
fees
{
if
""
==
value
.
CoinName
{
continue
}
...
...
@@ -61,8 +61,11 @@ func GetTransactionFees(c *gin.Context) {
}
}
transfer_type
:=
com
.
StrTo
(
c
.
DefaultQuery
(
"transfer_type"
,
"1"
))
.
MustUint8
()
feeService
:=
fee_service
.
Fee
{
PlatformId
:
platform_id
,
TransferType
:
transfer_type
,
PageNum
:
util
.
GetPage
(
c
),
PageSize
:
util
.
GetLimit
(
c
),
}
...
...
routers/api/backend/recommend_coin.go
View file @
b4ab5e9e
...
...
@@ -121,9 +121,11 @@ func AddRecommendCoin(c *gin.Context) {
recommendCoinService
.
Add
()
if
2
==
recommend_coin
.
Type
{
for
i
:=
1
;
i
<
3
;
i
++
{
feeValidate
:=
fee_service
.
Fee
{
PlatformId
:
platform_id
,
Cid
:
coin_id
,
TransferType
:
uint8
(
i
),
}
total_fee
,
err
:=
feeValidate
.
Count
()
if
err
!=
nil
||
total_fee
>
0
{
...
...
@@ -136,11 +138,13 @@ func AddRecommendCoin(c *gin.Context) {
Cid
:
coin_id
,
PlatformId
:
platform_id
,
CoinName
:
coin
.
Name
,
TransferType
:
uint8
(
i
),
}
feeService
.
Add
()
}
}
}
handler
.
SendResponse
(
c
,
nil
,
nil
)
...
...
service/fee_service/fee.go
View file @
b4ab5e9e
...
...
@@ -12,6 +12,7 @@ type Fee struct {
Fees
float32
TransactionFees
float32
CoinName
string
TransferType
uint8
PageNum
int
PageSize
int
...
...
@@ -43,6 +44,7 @@ func (c *Fee) Add() error {
"cid"
:
c
.
Cid
,
"platform_id"
:
c
.
PlatformId
,
"coin_name"
:
c
.
CoinName
,
"transfer_type"
:
c
.
TransferType
,
}
if
err
:=
models
.
AddFee
(
fee
);
err
!=
nil
{
...
...
@@ -117,5 +119,9 @@ func (c *Fee) getMaps() (map[string]interface{}) {
maps
[
"coin_name"
]
=
c
.
CoinName
}
if
c
.
TransferType
!=
0
{
maps
[
"transfer_type"
]
=
c
.
TransferType
}
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