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
8a1c7898
Commit
8a1c7898
authored
Apr 27, 2021
by
shajiaiming
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
api menu
parent
78917fd5
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
125 additions
and
470 deletions
+125
-470
api_module.go
models/api_module.go
+31
-0
trusteeship_coin.go
models/trusteeship_coin.go
+0
-105
api_module.go
routers/api/backend/api_module.go
+28
-0
coin.go
routers/api/backend/coin.go
+0
-3
fee.go
routers/api/backend/fee.go
+0
-36
trusteeship_coin.go
routers/api/backend/trusteeship_coin.go
+0
-201
router.go
routers/router.go
+3
-7
api_module.go
service/api_module_service/api_module.go
+63
-0
fee.go
service/fee_service/fee.go
+0
-19
trusteeship_coin.go
service/trusteeship_coin_service/trusteeship_coin.go
+0
-87
trusteeship_coin.go
validate_service/trusteeship_coin.go
+0
-12
No files found.
models/api_module.go
0 → 100644
View file @
8a1c7898
package
models
import
(
"bwallet/pkg/setting"
"github.com/jinzhu/gorm"
)
type
ApiModule
struct
{
Model
Path
string
`json:"path,omitempty"`
Method
string
`json:"method,omitempty"`
Module
string
`json:"module"`
ParentId
int
`json:"parent_id,omitempty"`
Child
[]
*
ApiModule
`json:"child,omitempty"`
}
func
(
a
ApiModule
)
TableName
()
string
{
return
setting
.
DatabaseSetting
.
Name_Manage
+
".gli_api_module"
}
func
GetModules
(
maps
interface
{})
([]
*
ApiModule
,
error
)
{
var
modules
[]
*
ApiModule
err
:=
db
.
Where
(
maps
)
.
Find
(
&
modules
)
.
Error
if
err
!=
nil
&&
err
!=
gorm
.
ErrRecordNotFound
{
return
nil
,
err
}
return
modules
,
nil
}
models/trusteeship_coin.go
deleted
100644 → 0
View file @
78917fd5
package
models
import
(
"bwallet/pkg/setting"
"github.com/jinzhu/gorm"
)
type
TrusteeshipCoin
struct
{
Model
Id
int
`json:"primary_key,omitempty"`
Cid
int
`json:"cid"`
Sort
int
`json:"sort"`
PlatformId
int
`json:"platform_id"`
CoinInfo
*
Coin
`gorm:"foreignkey:Cid" json:"coin"`
}
func
(
c
TrusteeshipCoin
)
TableName
()
string
{
return
setting
.
DatabaseSetting
.
Name_Sources
+
".wallet_trusteeship_coin"
}
func
GetTrusteeshipCoin
(
id
int
)
(
*
TrusteeshipCoin
,
error
)
{
var
trusteeshipCoin
TrusteeshipCoin
err
:=
db
.
Where
(
"id = ?"
,
id
)
.
First
(
&
trusteeshipCoin
)
.
Error
if
err
!=
nil
&&
err
!=
gorm
.
ErrRecordNotFound
{
return
nil
,
err
}
err
=
db
.
Model
(
&
trusteeshipCoin
)
.
Error
if
err
!=
nil
&&
err
!=
gorm
.
ErrRecordNotFound
{
return
nil
,
err
}
return
&
trusteeshipCoin
,
nil
}
func
ExistTrusteeshipCoinById
(
id
int
)
(
bool
,
error
)
{
var
coinRecommend
TrusteeshipCoin
err
:=
db
.
Select
(
"id"
)
.
Where
(
"id = ?"
,
id
)
.
First
(
&
coinRecommend
)
.
Error
if
err
!=
nil
&&
err
!=
gorm
.
ErrRecordNotFound
{
return
false
,
err
}
if
coinRecommend
.
ID
>
0
{
return
true
,
nil
}
return
false
,
nil
}
func
GetTrusteeshipCoinTotal
(
maps
interface
{})
(
int
,
error
)
{
var
count
int
if
err
:=
db
.
Model
(
&
TrusteeshipCoin
{})
.
Where
(
maps
)
.
Count
(
&
count
)
.
Error
;
err
!=
nil
{
return
0
,
err
}
return
count
,
nil
}
func
GetTrusteeshipCoins
(
pageNum
,
pageSize
int
,
maps
interface
{})
([]
*
TrusteeshipCoin
,
error
)
{
var
coinsRecommend
[]
*
TrusteeshipCoin
err
:=
db
.
Preload
(
"CoinInfo"
)
.
Where
(
maps
)
.
Order
(
"sort"
)
.
Offset
(
pageNum
)
.
Limit
(
pageSize
)
.
Find
(
&
coinsRecommend
)
.
Error
if
err
!=
nil
&&
err
!=
gorm
.
ErrRecordNotFound
{
return
nil
,
err
}
return
coinsRecommend
,
nil
}
func
AddTrusteeshipCoin
(
data
map
[
string
]
interface
{})
(
error
)
{
coinRecommend
:=
TrusteeshipCoin
{
Cid
:
data
[
"cid"
]
.
(
int
),
Sort
:
data
[
"sort"
]
.
(
int
),
PlatformId
:
data
[
"platform_id"
]
.
(
int
),
}
if
err
:=
db
.
Create
(
&
coinRecommend
)
.
Error
;
err
!=
nil
{
return
err
}
return
nil
}
func
EditTrusteeshipCoin
(
id
int
,
data
interface
{})
error
{
if
err
:=
db
.
Model
(
&
TrusteeshipCoin
{})
.
Where
(
"id = ?"
,
id
)
.
Updates
(
data
)
.
Error
;
err
!=
nil
{
return
err
}
return
nil
}
func
DeleteTrusteeshipCoin
(
id
int
)
error
{
if
err
:=
db
.
Where
(
"id = ?"
,
id
)
.
Delete
(
TrusteeshipCoin
{})
.
Error
;
err
!=
nil
{
return
err
}
return
nil
}
func
DeleteTrusteeshipByCondition
(
maps
interface
{})
error
{
if
err
:=
db
.
Where
(
maps
)
.
Delete
(
TrusteeshipCoin
{})
.
Error
;
err
!=
nil
{
return
err
}
return
nil
}
routers/api/backend/api_module.go
0 → 100644
View file @
8a1c7898
package
backend
import
(
"bwallet/pkg/errno"
"bwallet/pkg/handler"
"bwallet/pkg/util"
"bwallet/service/api_module_service"
"github.com/gin-gonic/gin"
)
func
GetApiModules
(
c
*
gin
.
Context
)
{
token
:=
c
.
Request
.
Header
.
Get
(
"Token"
)
user
,
_
:=
util
.
ParseToken
(
token
)
if
(
"administrator"
!=
user
.
UserInfo
.
Group
)
{
handler
.
SendResponse
(
c
,
errno
.
ErrUserAuthIncorrect
,
nil
)
return
}
apiModuleService
:=
api_module_service
.
ApiModule
{}
moudles
,
err
:=
apiModuleService
.
GetAll
()
if
err
!=
nil
{
handler
.
SendResponse
(
c
,
errno
.
InternalServerError
,
nil
)
return
}
handler
.
SendResponse
(
c
,
nil
,
moudles
)
}
routers/api/backend/coin.go
View file @
8a1c7898
...
@@ -8,7 +8,6 @@ import (
...
@@ -8,7 +8,6 @@ import (
"bwallet/pkg/util"
"bwallet/pkg/util"
"bwallet/service/coin_service"
"bwallet/service/coin_service"
"bwallet/service/recommend_coin_service"
"bwallet/service/recommend_coin_service"
"bwallet/service/trusteeship_coin_service"
"bwallet/validate_service"
"bwallet/validate_service"
"github.com/Unknwon/com"
"github.com/Unknwon/com"
"github.com/astaxie/beego/validation"
"github.com/astaxie/beego/validation"
...
@@ -258,8 +257,6 @@ func DeleteCoin(c *gin.Context) {
...
@@ -258,8 +257,6 @@ func DeleteCoin(c *gin.Context) {
recommendCoinService
:=
recommend_coin_service
.
RecommendCoin
{
Cid
:
id
}
recommendCoinService
:=
recommend_coin_service
.
RecommendCoin
{
Cid
:
id
}
recommendCoinService
.
DeleteByCondition
()
recommendCoinService
.
DeleteByCondition
()
trusteeshipCoinService
:=
trusteeship_coin_service
.
TrusteeshipCoin
{
Cid
:
id
}
trusteeshipCoinService
.
DeleteTrusteeshipByCondition
()
handler
.
SendResponse
(
c
,
nil
,
nil
)
handler
.
SendResponse
(
c
,
nil
,
nil
)
}
}
...
...
routers/api/backend/fee.go
View file @
8a1c7898
...
@@ -11,42 +11,6 @@ import (
...
@@ -11,42 +11,6 @@ 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"
)
...
...
routers/api/backend/trusteeship_coin.go
deleted
100644 → 0
View file @
78917fd5
package
backend
import
(
"bwallet/pkg/errno"
"bwallet/pkg/handler"
"bwallet/pkg/util"
"bwallet/service/coin_service"
"bwallet/service/trusteeship_coin_service"
"bwallet/validate_service"
"github.com/Unknwon/com"
"github.com/astaxie/beego/validation"
"github.com/gin-gonic/gin"
"strconv"
"strings"
)
func
GetTrusteeshipCoins
(
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
()
}
}
trusteeshipCoinService
:=
trusteeship_coin_service
.
TrusteeshipCoin
{
PlatformId
:
platform_id
,
PageNum
:
util
.
GetPage
(
c
),
PageSize
:
util
.
GetLimit
(
c
),
}
total
,
err
:=
trusteeshipCoinService
.
Count
()
if
err
!=
nil
{
handler
.
SendResponse
(
c
,
errno
.
ErrCountCoin
,
nil
)
return
}
coinTrusteeships
,
err
:=
trusteeshipCoinService
.
GetAll
()
if
err
!=
nil
{
handler
.
SendResponse
(
c
,
errno
.
InternalServerError
,
nil
)
return
}
data
:=
make
(
map
[
string
]
interface
{})
data
[
"items"
]
=
coinTrusteeships
data
[
"total"
]
=
total
handler
.
SendResponse
(
c
,
nil
,
data
)
}
func
AddTrusteeshipCoin
(
c
*
gin
.
Context
)
{
trusteeship_coin
:=
validate_service
.
TrusteeshipCoin
{}
c
.
ShouldBindJSON
(
&
trusteeship_coin
)
//方法一
if
ok
,
errors
:=
validate_service
.
ValidateInputs
(
trusteeship_coin
);
!
ok
{
for
_
,
err
:=
range
errors
{
handler
.
SendResponse
(
c
,
errno
.
ErrBind
,
strings
.
Join
(
err
,
" "
))
return
}
}
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
trusteeship_coin
.
PlatformId
!=
0
{
platform_id
=
trusteeship_coin
.
PlatformId
}
}
for
_
,
id
:=
range
strings
.
Split
(
trusteeship_coin
.
Cid
,
","
)
{
if
id
==
""
{
continue
}
coin_id
,
err
:=
strconv
.
Atoi
(
id
)
if
(
nil
!=
err
)
{
continue
}
coinService
:=
coin_service
.
Coin
{
Id
:
coin_id
,
}
exists
,
err
:=
coinService
.
ExistById
()
if
err
!=
nil
||
!
exists
{
continue
}
trusteeshipCoinValidate
:=
trusteeship_coin_service
.
TrusteeshipCoin
{
PlatformId
:
platform_id
,
Cid
:
coin_id
,
}
total
,
err
:=
trusteeshipCoinValidate
.
Count
()
if
err
!=
nil
||
total
>
0
{
continue
}
trusteeshipCoinService
:=
trusteeship_coin_service
.
TrusteeshipCoin
{
Cid
:
coin_id
,
PlatformId
:
platform_id
,
Sort
:
trusteeship_coin
.
Sort
,
}
trusteeshipCoinService
.
Add
()
}
handler
.
SendResponse
(
c
,
nil
,
nil
)
}
func
EditTrusteeshipCoin
(
c
*
gin
.
Context
)
{
trusteeship_coin
:=
validate_service
.
EditTrusteeshipCoin
{}
c
.
ShouldBindJSON
(
&
trusteeship_coin
)
//方法一
if
ok
,
errors
:=
validate_service
.
ValidateInputs
(
trusteeship_coin
);
!
ok
{
for
_
,
err
:=
range
errors
{
handler
.
SendResponse
(
c
,
errno
.
ErrBind
,
strings
.
Join
(
err
,
" "
))
return
}
}
trusteeshipCoinService
:=
trusteeship_coin_service
.
TrusteeshipCoin
{
Id
:
trusteeship_coin
.
Id
,
Sort
:
trusteeship_coin
.
Sort
,
}
exists
,
err
:=
trusteeshipCoinService
.
ExistById
()
if
err
!=
nil
{
handler
.
SendResponse
(
c
,
errno
.
ErrCoinNotFound
,
nil
)
return
}
if
!
exists
{
handler
.
SendResponse
(
c
,
errno
.
ErrCoinNotFound
,
nil
)
return
}
token
:=
c
.
Request
.
Header
.
Get
(
"Token"
)
user
,
_
:=
util
.
ParseToken
(
token
)
group
:=
user
.
UserInfo
.
Group
if
(
"administrator"
!=
group
)
{
trusteeship_coin_model
:=
trusteeship_coin_service
.
TrusteeshipCoin
{
Id
:
trusteeship_coin
.
Id
}
trusteeship_coin
,
_
:=
trusteeship_coin_model
.
Get
()
if
trusteeship_coin
.
PlatformId
!=
user
.
UserInfo
.
PlatformId
{
handler
.
SendResponse
(
c
,
errno
.
ErrUserAuthIncorrect
,
nil
)
return
}
}
if
err
:=
trusteeshipCoinService
.
Edit
();
err
!=
nil
{
handler
.
SendResponse
(
c
,
errno
.
ErrUpdateCoin
,
nil
)
return
}
handler
.
SendResponse
(
c
,
nil
,
nil
)
}
func
DeleteTrusteeshipCoin
(
c
*
gin
.
Context
)
{
id
:=
com
.
StrTo
(
c
.
DefaultQuery
(
"id"
,
"0"
))
.
MustInt
()
valid
:=
validation
.
Validation
{}
valid
.
Min
(
id
,
1
,
"id"
)
.
Message
(
"ID必须大于0"
)
if
valid
.
HasErrors
()
{
handler
.
SendResponse
(
c
,
errno
.
ErrValidation
,
nil
)
return
}
trusteeshipCoinService
:=
trusteeship_coin_service
.
TrusteeshipCoin
{
Id
:
id
}
exists
,
err
:=
trusteeshipCoinService
.
ExistById
()
if
err
!=
nil
{
handler
.
SendResponse
(
c
,
errno
.
ErrCoinNotFound
,
nil
)
return
}
if
!
exists
{
handler
.
SendResponse
(
c
,
errno
.
ErrCoinNotFound
,
nil
)
return
}
token
:=
c
.
Request
.
Header
.
Get
(
"Token"
)
user
,
_
:=
util
.
ParseToken
(
token
)
group
:=
user
.
UserInfo
.
Group
if
(
"administrator"
!=
group
)
{
trusteeship_coin
,
_
:=
trusteeshipCoinService
.
Get
()
if
trusteeship_coin
.
PlatformId
!=
user
.
UserInfo
.
PlatformId
{
handler
.
SendResponse
(
c
,
errno
.
ErrUserAuthIncorrect
,
nil
)
return
}
}
err
=
trusteeshipCoinService
.
Delete
()
if
err
!=
nil
{
handler
.
SendResponse
(
c
,
errno
.
ErrDeleteCoin
,
nil
)
return
}
handler
.
SendResponse
(
c
,
nil
,
nil
)
}
routers/router.go
View file @
8a1c7898
...
@@ -53,7 +53,7 @@ func InitRouter() *gin.Engine {
...
@@ -53,7 +53,7 @@ func InitRouter() *gin.Engine {
api
:=
r
.
Group
(
"/api"
)
api
:=
r
.
Group
(
"/api"
)
api
.
Use
(
jwt
.
JWT
())
.
Use
(
auth
.
AUTH
())
api
.
Use
(
jwt
.
JWT
())
.
Use
(
auth
.
Casbin
())
api
.
POST
(
"/log"
,
backend
.
AddOperationLog
)
api
.
POST
(
"/log"
,
backend
.
AddOperationLog
)
api
.
GET
(
"/logs"
,
backend
.
GetOperationLogs
)
api
.
GET
(
"/logs"
,
backend
.
GetOperationLogs
)
api
.
Use
(
log
.
LogMiddleware
(
e
.
HandleTableName
))
api
.
Use
(
log
.
LogMiddleware
(
e
.
HandleTableName
))
...
@@ -109,12 +109,6 @@ func InitRouter() *gin.Engine {
...
@@ -109,12 +109,6 @@ func InitRouter() *gin.Engine {
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
.
PUT
(
"/transaction-fees"
,
backend
.
EditTransactionFees
)
api
.
PUT
(
"/transaction-fees"
,
backend
.
EditTransactionFees
)
api
.
GET
(
"/transaction-coins"
,
backend
.
GetTransactionCoins
)
api
.
GET
(
"/trusteeship-coins"
,
backend
.
GetTrusteeshipCoins
)
api
.
POST
(
"/trusteeship-coin"
,
backend
.
AddTrusteeshipCoin
)
api
.
PUT
(
"/trusteeship-coin"
,
backend
.
EditTrusteeshipCoin
)
api
.
DELETE
(
"/trusteeship-coin"
,
backend
.
DeleteTrusteeshipCoin
)
api
.
GET
(
"/supported-currencies"
,
backend
.
GetSupportedCurrencies
)
api
.
GET
(
"/supported-currencies"
,
backend
.
GetSupportedCurrencies
)
api
.
POST
(
"/supported-currency"
,
backend
.
AddSupportedCurrency
)
api
.
POST
(
"/supported-currency"
,
backend
.
AddSupportedCurrency
)
...
@@ -160,6 +154,8 @@ func InitRouter() *gin.Engine {
...
@@ -160,6 +154,8 @@ func InitRouter() *gin.Engine {
api
.
GET
(
"/user-roles"
,
backend
.
GetAdminRoles
)
api
.
GET
(
"/user-roles"
,
backend
.
GetAdminRoles
)
api
.
POST
(
"/user-role"
,
backend
.
AddAdminRole
)
api
.
POST
(
"/user-role"
,
backend
.
AddAdminRole
)
api
.
DELETE
(
"/user-role"
,
backend
.
DeleteAdminRole
)
api
.
DELETE
(
"/user-role"
,
backend
.
DeleteAdminRole
)
api
.
GET
(
"/api-modules"
,
backend
.
GetApiModules
)
}
}
return
r
return
r
...
...
service/api_module_service/api_module.go
0 → 100644
View file @
8a1c7898
package
api_module_service
import
(
"bwallet/models"
)
type
ApiModule
struct
{
Id
int
Path
string
Method
string
Module
string
ParentId
int
Child
[]
*
ApiModule
`json:"child,omitempty"`
}
func
(
a
*
ApiModule
)
GetAll
()
([]
*
models
.
ApiModule
,
error
)
{
var
modules
[]
*
models
.
ApiModule
modules
,
err
:=
models
.
GetModules
(
a
.
getMaps
())
if
err
!=
nil
{
return
nil
,
err
}
data
:=
buildData
(
modules
)
result
:=
makeTreeCore
(
0
,
data
)
return
result
,
nil
}
func
(
a
*
ApiModule
)
getMaps
()
(
map
[
string
]
interface
{})
{
maps
:=
make
(
map
[
string
]
interface
{})
if
a
.
ParentId
!=
0
{
maps
[
"id"
]
=
a
.
Id
}
return
maps
}
func
buildData
(
list
[]
*
models
.
ApiModule
)
map
[
int
]
map
[
int
]
*
models
.
ApiModule
{
var
data
=
make
(
map
[
int
]
map
[
int
]
*
models
.
ApiModule
)
for
_
,
v
:=
range
list
{
id
:=
v
.
ID
fid
:=
v
.
ParentId
if
_
,
ok
:=
data
[
fid
];
!
ok
{
data
[
fid
]
=
make
(
map
[
int
]
*
models
.
ApiModule
)
}
data
[
fid
][
id
]
=
v
}
return
data
}
func
makeTreeCore
(
index
int
,
data
map
[
int
]
map
[
int
]
*
models
.
ApiModule
)
[]
*
models
.
ApiModule
{
tmp
:=
make
([]
*
models
.
ApiModule
,
0
)
for
id
,
item
:=
range
data
[
index
]
{
if
data
[
id
]
!=
nil
{
item
.
Child
=
makeTreeCore
(
id
,
data
)
}
tmp
=
append
(
tmp
,
item
)
}
return
tmp
}
service/fee_service/fee.go
View file @
8a1c7898
...
@@ -81,25 +81,6 @@ func (f *Fee) Search() (*models.Fee, error) {
...
@@ -81,25 +81,6 @@ 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
())
}
}
...
...
service/trusteeship_coin_service/trusteeship_coin.go
deleted
100644 → 0
View file @
78917fd5
package
trusteeship_coin_service
import
(
"bwallet/models"
)
type
TrusteeshipCoin
struct
{
Id
int
Cid
int
Sort
int
PlatformId
int
CategoryId
uint8
PageNum
int
PageSize
int
}
func
(
c
*
TrusteeshipCoin
)
Get
()
(
*
models
.
TrusteeshipCoin
,
error
)
{
coinTrusteeship
,
err
:=
models
.
GetTrusteeshipCoin
(
c
.
Id
)
if
err
!=
nil
{
return
nil
,
err
}
return
coinTrusteeship
,
nil
}
func
(
c
*
TrusteeshipCoin
)
GetAll
()
([]
*
models
.
TrusteeshipCoin
,
error
)
{
var
coinsTrusteeship
[]
*
models
.
TrusteeshipCoin
coinsTrusteeship
,
err
:=
models
.
GetTrusteeshipCoins
(
c
.
PageNum
,
c
.
PageSize
,
c
.
getMaps
())
if
err
!=
nil
{
return
nil
,
err
}
return
coinsTrusteeship
,
nil
}
func
(
c
*
TrusteeshipCoin
)
Add
()
error
{
coinTrusteeship
:=
map
[
string
]
interface
{}{
"cid"
:
c
.
Cid
,
"sort"
:
c
.
Sort
,
"platform_id"
:
c
.
PlatformId
,
}
if
err
:=
models
.
AddTrusteeshipCoin
(
coinTrusteeship
);
err
!=
nil
{
return
err
}
return
nil
}
func
(
c
*
TrusteeshipCoin
)
Edit
()
error
{
return
models
.
EditTrusteeshipCoin
(
c
.
Id
,
map
[
string
]
interface
{}{
"sort"
:
c
.
Sort
,
})
}
func
(
c
*
TrusteeshipCoin
)
ExistById
()
(
bool
,
error
)
{
return
models
.
ExistTrusteeshipCoinById
(
c
.
Id
)
}
func
(
c
*
TrusteeshipCoin
)
Count
()
(
int
,
error
)
{
return
models
.
GetTrusteeshipCoinTotal
(
c
.
getMaps
())
}
func
(
c
*
TrusteeshipCoin
)
Delete
()
error
{
return
models
.
DeleteTrusteeshipCoin
(
c
.
Id
)
}
func
(
c
*
TrusteeshipCoin
)
DeleteTrusteeshipByCondition
()
error
{
return
models
.
DeleteTrusteeshipByCondition
(
c
.
getMaps
())
}
func
(
c
*
TrusteeshipCoin
)
getMaps
()
(
map
[
string
]
interface
{})
{
maps
:=
make
(
map
[
string
]
interface
{})
if
c
.
PlatformId
!=
0
{
maps
[
"platform_id"
]
=
c
.
PlatformId
}
if
c
.
Cid
!=
0
{
maps
[
"cid"
]
=
c
.
Cid
}
return
maps
}
validate_service/trusteeship_coin.go
deleted
100644 → 0
View file @
78917fd5
package
validate_service
type
TrusteeshipCoin
struct
{
Cid
string
`json:"cid" validate:"required"`
Sort
int
`json:"sort" validate:"required"`
PlatformId
int
`json:"platform_id" validate:"required"`
}
type
EditTrusteeshipCoin
struct
{
Id
int
`json:"id" validate:"required"`
Sort
int
`json:"sort" validate:"required"`
}
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