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
b1950f68
Commit
b1950f68
authored
Jan 08, 2021
by
shajiaiming
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix
parent
189f8881
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
61 additions
and
1 deletion
+61
-1
fee.go
models/fee.go
+4
-0
live_charge.go
models/live_charge.go
+1
-1
fee.go
routers/api/backend/fee.go
+36
-0
router.go
routers/router.go
+1
-0
fee.go
service/fee_service/fee.go
+19
-0
No files found.
models/fee.go
View file @
b1950f68
...
...
@@ -19,6 +19,10 @@ type Fee struct {
CoinInfo
*
Coin
`gorm:"foreignkey:Cid" json:"coin,omitempty"`
}
type
FeeCoinNameResp
struct
{
CoinName
string
`json:"coin_name"`
}
func
(
c
Fee
)
TableName
()
string
{
return
setting
.
DatabaseSetting
.
Name_Sources
+
".wallet_fees"
}
...
...
models/live_charge.go
View file @
b1950f68
...
...
@@ -8,7 +8,7 @@ import (
type
LiveCharge
struct
{
Model
Unit
string
`json:"
title
"`
Unit
string
`json:"
unit
"`
PlatformId
int64
`json:"platform_id"`
UnitPrice
float64
`json:"unit_price"`
}
...
...
routers/api/backend/fee.go
View file @
b1950f68
...
...
@@ -11,6 +11,42 @@ import (
"strings"
)
func
GetTransactionCoins
(
c
*
gin
.
Context
)
{
token
:=
c
.
Request
.
Header
.
Get
(
"Token"
)
user
,
_
:=
util
.
ParseToken
(
token
)
group
:=
user
.
UserInfo
.
Group
var
platform_id
int
platform_id
=
user
.
UserInfo
.
PlatformId
if
(
"administrator"
==
group
)
{
if
arg
:=
c
.
Query
(
"platform_id"
);
arg
!=
""
{
platform_id
=
com
.
StrTo
(
c
.
Query
(
"platform_id"
))
.
MustInt
()
}
}
feeService
:=
fee_service
.
Fee
{
PlatformId
:
platform_id
,
PageNum
:
util
.
GetPage
(
c
),
PageSize
:
util
.
GetLimit
(
c
),
}
fees
,
err
:=
feeService
.
GetAllCoinName
()
if
err
!=
nil
{
handler
.
SendResponse
(
c
,
errno
.
InternalServerError
,
nil
)
return
}
vals
:=
[]
string
{}
for
_
,
value
:=
range
fees
{
if
""
==
value
.
CoinName
{
continue
}
vals
=
append
(
vals
,
value
.
CoinName
)
}
handler
.
SendResponse
(
c
,
nil
,
vals
)
}
func
GetTransactionFees
(
c
*
gin
.
Context
)
{
token
:=
c
.
Request
.
Header
.
Get
(
"Token"
)
...
...
routers/router.go
View file @
b1950f68
...
...
@@ -102,6 +102,7 @@ func InitRouter() *gin.Engine {
api
.
PUT
(
"/recommend-coin"
,
backend
.
EditRecommendCoin
)
api
.
DELETE
(
"/recommend-coin"
,
backend
.
DeleteRecommendCoin
)
api
.
GET
(
"/transaction-fees"
,
backend
.
GetTransactionFees
)
api
.
GET
(
"/transaction-coins"
,
backend
.
GetTransactionCoins
)
api
.
PUT
(
"/transaction-fees"
,
backend
.
EditTransactionFees
)
api
.
GET
(
"/trusteeship-coins"
,
backend
.
GetTrusteeshipCoins
)
...
...
service/fee_service/fee.go
View file @
b1950f68
...
...
@@ -79,6 +79,25 @@ func (f *Fee) Search() (*models.Fee, error) {
return
fee
,
nil
}
func
(
c
*
Fee
)
GetAllCoinName
()
([]
*
models
.
FeeCoinNameResp
,
error
)
{
var
fee
[]
*
models
.
Fee
fee
,
err
:=
models
.
GetFees
(
c
.
PageNum
,
c
.
PageSize
,
c
.
getMaps
())
if
err
!=
nil
{
return
nil
,
err
}
var
records
=
[]
*
models
.
FeeCoinNameResp
{}
for
_
,
value
:=
range
fee
{
record
:=
&
models
.
FeeCoinNameResp
{}
record
.
CoinName
=
value
.
CoinName
records
=
append
(
records
,
record
)
}
return
records
,
nil
}
func
(
c
*
Fee
)
DeleteByCondition
()
error
{
return
models
.
DeleteFeeByCondition
(
c
.
getMaps
())
}
...
...
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