Commit b1950f68 authored by shajiaiming's avatar shajiaiming

fix

parent 189f8881
...@@ -19,6 +19,10 @@ type Fee struct { ...@@ -19,6 +19,10 @@ type Fee struct {
CoinInfo *Coin `gorm:"foreignkey:Cid" json:"coin,omitempty"` CoinInfo *Coin `gorm:"foreignkey:Cid" json:"coin,omitempty"`
} }
type FeeCoinNameResp struct {
CoinName string `json:"coin_name"`
}
func (c Fee) TableName() string { func (c Fee) TableName() string {
return setting.DatabaseSetting.Name_Sources + ".wallet_fees" return setting.DatabaseSetting.Name_Sources + ".wallet_fees"
} }
......
...@@ -8,7 +8,7 @@ import ( ...@@ -8,7 +8,7 @@ import (
type LiveCharge struct { type LiveCharge struct {
Model Model
Unit string `json:"title"` Unit string `json:"unit"`
PlatformId int64 `json:"platform_id"` PlatformId int64 `json:"platform_id"`
UnitPrice float64 `json:"unit_price"` UnitPrice float64 `json:"unit_price"`
} }
......
...@@ -11,6 +11,42 @@ import ( ...@@ -11,6 +11,42 @@ import (
"strings" "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) { func GetTransactionFees(c *gin.Context) {
token := c.Request.Header.Get("Token") token := c.Request.Header.Get("Token")
......
...@@ -102,6 +102,7 @@ func InitRouter() *gin.Engine { ...@@ -102,6 +102,7 @@ func InitRouter() *gin.Engine {
api.PUT("/recommend-coin", backend.EditRecommendCoin) api.PUT("/recommend-coin", backend.EditRecommendCoin)
api.DELETE("/recommend-coin", backend.DeleteRecommendCoin) api.DELETE("/recommend-coin", backend.DeleteRecommendCoin)
api.GET("/transaction-fees", backend.GetTransactionFees) api.GET("/transaction-fees", backend.GetTransactionFees)
api.GET("/transaction-coins", backend.GetTransactionCoins)
api.PUT("/transaction-fees", backend.EditTransactionFees) api.PUT("/transaction-fees", backend.EditTransactionFees)
api.GET("/trusteeship-coins", backend.GetTrusteeshipCoins) api.GET("/trusteeship-coins", backend.GetTrusteeshipCoins)
......
...@@ -79,6 +79,25 @@ func (f *Fee) Search() (*models.Fee, error) { ...@@ -79,6 +79,25 @@ func (f *Fee) Search() (*models.Fee, error) {
return fee, nil 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 { func (c *Fee) DeleteByCondition() error {
return models.DeleteFeeByCondition(c.getMaps()) return models.DeleteFeeByCondition(c.getMaps())
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment