1、
This commit is contained in:
39
app/admin/fronted/line_coin_network.go
Normal file
39
app/admin/fronted/line_coin_network.go
Normal file
@ -0,0 +1,39 @@
|
||||
package fronted
|
||||
|
||||
import (
|
||||
"go-admin/app/admin/service"
|
||||
"go-admin/app/admin/service/dto"
|
||||
"go-admin/common/service/sysservice/sysstatuscode"
|
||||
statuscode "go-admin/common/status_code"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
"github.com/go-admin-team/go-admin-core/sdk/api"
|
||||
)
|
||||
|
||||
type LineCoinnetwork struct {
|
||||
api.Api
|
||||
}
|
||||
|
||||
// 获取区块链网络列表
|
||||
func (e LineCoinnetwork) GetList(c *gin.Context) {
|
||||
s := service.LineCoinnetwork{}
|
||||
err := e.MakeContext(c).
|
||||
MakeOrm().
|
||||
MakeService(&s.Service).
|
||||
Errors
|
||||
if err != nil {
|
||||
e.Logger.Error(err)
|
||||
e.Error(500, err, err.Error())
|
||||
return
|
||||
}
|
||||
|
||||
data := make([]dto.LineCoinnetworkAppResp, 0)
|
||||
code := s.GetOpenList(&data)
|
||||
|
||||
if code != statuscode.OK {
|
||||
e.Error(code, nil, sysstatuscode.GetStatusCodeDescription(c, code))
|
||||
return
|
||||
}
|
||||
|
||||
e.OK(data, "success")
|
||||
}
|
||||
@ -2,6 +2,8 @@ package models
|
||||
|
||||
import (
|
||||
"go-admin/common/models"
|
||||
|
||||
"github.com/shopspring/decimal"
|
||||
)
|
||||
|
||||
type LineCoinnetwork struct {
|
||||
@ -12,7 +14,8 @@ type LineCoinnetwork struct {
|
||||
ArrivalNum int64 `json:"arrivalNum" gorm:"type:int;comment:充值区块确认数"`
|
||||
UnlockNum int64 `json:"unlockNum" gorm:"type:int;comment:提现解锁确认数"`
|
||||
UnlockTime int64 `json:"unlockTime" gorm:"type:int;comment:提现确认平均时间,单位分钟"`
|
||||
Fee string `json:"fee" gorm:"type:decimal(32,6);comment:网络手续费,该字段是动态的,后面会有服务定时更新该字段"`
|
||||
Fee decimal.Decimal `json:"fee" gorm:"type:decimal(32,6);comment:网络手续费(百分比)"`
|
||||
MinWithdrawal decimal.Decimal `json:"minWithdrawal" gorm:"type:decimal(32,6);comment:最小提现金额"`
|
||||
models.ModelTime
|
||||
models.ControlBy
|
||||
}
|
||||
|
||||
@ -5,12 +5,14 @@ import (
|
||||
jwt "github.com/go-admin-team/go-admin-core/sdk/pkg/jwtauth"
|
||||
|
||||
"go-admin/app/admin/apis"
|
||||
"go-admin/common/middleware"
|
||||
"go-admin/app/admin/fronted"
|
||||
"go-admin/common/actions"
|
||||
"go-admin/common/middleware"
|
||||
)
|
||||
|
||||
func init() {
|
||||
routerCheckRole = append(routerCheckRole, registerLineCoinnetworkRouter)
|
||||
routerFrontedCheckRole = append(routerFrontedCheckRole, registerLineCoinnetworkFrontedRouter)
|
||||
}
|
||||
|
||||
// registerLineCoinnetworkRouter
|
||||
@ -25,3 +27,11 @@ func registerLineCoinnetworkRouter(v1 *gin.RouterGroup, authMiddleware *jwt.GinJ
|
||||
r.DELETE("", api.Delete)
|
||||
}
|
||||
}
|
||||
|
||||
func registerLineCoinnetworkFrontedRouter(v1 *gin.RouterGroup) {
|
||||
api := fronted.LineCoinnetwork{}
|
||||
r := v1.Group("/line-coinnetwork")
|
||||
{
|
||||
r.GET("/list", api.GetList)
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,10 +1,11 @@
|
||||
package dto
|
||||
|
||||
import (
|
||||
|
||||
"go-admin/app/admin/models"
|
||||
"go-admin/common/dto"
|
||||
common "go-admin/common/models"
|
||||
|
||||
"github.com/shopspring/decimal"
|
||||
)
|
||||
|
||||
type LineCoinnetworkGetPageReq struct {
|
||||
@ -25,13 +26,19 @@ type LineCoinnetworkOrder struct {
|
||||
CreatedAt string `form:"createdAtOrder" search:"type:order;column:created_at;table:line_coinnetwork"`
|
||||
UpdatedAt string `form:"updatedAtOrder" search:"type:order;column:updated_at;table:line_coinnetwork"`
|
||||
DeletedAt string `form:"deletedAtOrder" search:"type:order;column:deleted_at;table:line_coinnetwork"`
|
||||
|
||||
}
|
||||
|
||||
func (m *LineCoinnetworkGetPageReq) GetNeedSearch() interface{} {
|
||||
return *m
|
||||
}
|
||||
|
||||
type LineCoinnetworkAppResp struct {
|
||||
Id int `json:"id"`
|
||||
NetworkName string `json:"networkName"`
|
||||
MinWithdrawal decimal.Decimal `json:"minWithdrawal"`
|
||||
Fee decimal.Decimal `json:"fee"`
|
||||
}
|
||||
|
||||
type LineCoinnetworkInsertReq struct {
|
||||
Id int `json:"-" comment:"主键ID"` // 主键ID
|
||||
NetworkName string `json:"networkName" comment:"网络名称"`
|
||||
@ -39,7 +46,8 @@ type LineCoinnetworkInsertReq struct {
|
||||
ArrivalNum int64 `json:"arrivalNum" comment:"充值区块确认数"`
|
||||
UnlockNum int64 `json:"unlockNum" comment:"提现解锁确认数"`
|
||||
UnlockTime int64 `json:"unlockTime" comment:"提现确认平均时间,单位分钟"`
|
||||
Fee string `json:"fee" comment:"网络手续费,该字段是动态的,后面会有服务定时更新该字段"`
|
||||
Fee decimal.Decimal `json:"fee" comment:"网络手续费百分比"`
|
||||
MinWithdrawal decimal.Decimal `json:"minWithdrawal" comment:"最小提现金额"`
|
||||
common.ControlBy
|
||||
}
|
||||
|
||||
@ -53,6 +61,7 @@ func (s *LineCoinnetworkInsertReq) Generate(model *models.LineCoinnetwork) {
|
||||
model.UnlockNum = s.UnlockNum
|
||||
model.UnlockTime = s.UnlockTime
|
||||
model.Fee = s.Fee
|
||||
model.MinWithdrawal = s.MinWithdrawal
|
||||
model.CreateBy = s.CreateBy // 添加这而,需要记录是被谁创建的
|
||||
}
|
||||
|
||||
@ -67,7 +76,8 @@ type LineCoinnetworkUpdateReq struct {
|
||||
ArrivalNum int64 `json:"arrivalNum" comment:"充值区块确认数"`
|
||||
UnlockNum int64 `json:"unlockNum" comment:"提现解锁确认数"`
|
||||
UnlockTime int64 `json:"unlockTime" comment:"提现确认平均时间,单位分钟"`
|
||||
Fee string `json:"fee" comment:"网络手续费,该字段是动态的,后面会有服务定时更新该字段"`
|
||||
Fee decimal.Decimal `json:"fee" comment:"网络手续费百分比"`
|
||||
MinWithdrawal decimal.Decimal `json:"minWithdrawal" comment:"最小提现金额"`
|
||||
common.ControlBy
|
||||
}
|
||||
|
||||
@ -81,6 +91,7 @@ func (s *LineCoinnetworkUpdateReq) Generate(model *models.LineCoinnetwork) {
|
||||
model.UnlockNum = s.UnlockNum
|
||||
model.UnlockTime = s.UnlockTime
|
||||
model.Fee = s.Fee
|
||||
model.MinWithdrawal = s.MinWithdrawal
|
||||
model.UpdateBy = s.UpdateBy // 添加这而,需要记录是被谁更新的
|
||||
}
|
||||
|
||||
@ -92,6 +103,7 @@ func (s *LineCoinnetworkUpdateReq) GetId() interface{} {
|
||||
type LineCoinnetworkGetReq struct {
|
||||
Id int `uri:"id"`
|
||||
}
|
||||
|
||||
func (s *LineCoinnetworkGetReq) GetId() interface{} {
|
||||
return s.Id
|
||||
}
|
||||
|
||||
@ -4,12 +4,14 @@ import (
|
||||
"errors"
|
||||
|
||||
"github.com/go-admin-team/go-admin-core/sdk/service"
|
||||
"github.com/jinzhu/copier"
|
||||
"gorm.io/gorm"
|
||||
|
||||
"go-admin/app/admin/models"
|
||||
"go-admin/app/admin/service/dto"
|
||||
"go-admin/common/actions"
|
||||
cDto "go-admin/common/dto"
|
||||
statuscode "go-admin/common/status_code"
|
||||
)
|
||||
|
||||
type LineCoinnetwork struct {
|
||||
@ -107,3 +109,21 @@ func (e *LineCoinnetwork) Remove(d *dto.LineCoinnetworkDeleteReq, p *actions.Dat
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// 获取区块链列表
|
||||
// 状态码
|
||||
func (e *LineCoinnetwork) GetOpenList(list *[]dto.LineCoinnetworkAppResp) int {
|
||||
var datas []models.LineCoinnetwork
|
||||
item := dto.LineCoinnetworkAppResp{}
|
||||
|
||||
if err := e.Orm.Model(&models.LineCoinnetwork{}).Find(&datas).Error; err != nil {
|
||||
return statuscode.ServerError
|
||||
}
|
||||
|
||||
for _, v := range datas {
|
||||
copier.Copy(&item, v)
|
||||
|
||||
*list = append(*list, item)
|
||||
}
|
||||
return statuscode.OK
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user