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
f076c5b0
Commit
f076c5b0
authored
Dec 15, 2020
by
shajiaiming
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
客户端app权限
parent
5d033468
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
404 additions
and
148 deletions
+404
-148
client_app.go
models/client_app.go
+108
-0
user.go
models/user.go
+0
-0
errno.go
pkg/errno/errno.go
+59
-48
client-app.go
routers/api/app/client-app.go
+42
-0
router.go
routers/router.go
+3
-1
client_app.go
service/client_app_service/client_app.go
+93
-0
live_info.go
service/streamer_service/live_info.go
+0
-99
user.go
service/user_service/user.go
+99
-0
No files found.
models/client_app.go
0 → 100644
View file @
f076c5b0
package
models
import
(
"bwallet/pkg/setting"
"github.com/jinzhu/gorm"
"time"
)
type
ClientApp
struct
{
Model
Type
uint8
`gorm:"not null;default:0" json:"type"`
BundleId
string
`gorm:"type:varchar(128)" json:"bundle_id,omitempty"`
AppSignature
string
`gorm:"type:varchar(128)" json:"app_signature,omitempty"`
AppPackage
string
`gorm:"type:varchar(128)" json:"app_package,omitempty"`
AppSecret
string
`gorm:"type:varchar(128)" json:"app_secret,omitempty"`
CreatedAt
int64
`gorm:"type:datetime" json:"created_at,omitempty"`
Deadline
int64
`gorm:"type:datetime" json:"deadline,omitempty"`
}
func
(
a
ClientApp
)
TableName
()
string
{
return
setting
.
DatabaseSetting
.
Name_Sources
+
".wallet_client_app"
}
func
GetClientApp
(
id
int32
)
(
*
ClientApp
,
error
)
{
var
app
ClientApp
err
:=
db
.
Where
(
"id = ?"
,
id
)
.
First
(
&
app
)
.
Error
if
err
!=
nil
&&
err
!=
gorm
.
ErrRecordNotFound
{
return
nil
,
err
}
err
=
db
.
Model
(
&
app
)
.
Error
if
err
!=
nil
&&
err
!=
gorm
.
ErrRecordNotFound
{
return
nil
,
err
}
return
&
app
,
nil
}
func
ExistClientAppById
(
id
int32
)
(
bool
,
error
)
{
var
app
ClientApp
err
:=
db
.
Select
(
"id"
)
.
Where
(
"id = ?"
,
id
)
.
First
(
&
app
)
.
Error
if
err
!=
nil
&&
err
!=
gorm
.
ErrRecordNotFound
{
return
false
,
err
}
if
app
.
ID
>
0
{
return
true
,
nil
}
return
false
,
nil
}
func
GetClientAppTotal
(
maps
interface
{})
(
int
,
error
)
{
var
count
int
if
err
:=
db
.
Model
(
&
ClientApp
{})
.
Where
(
maps
)
.
Count
(
&
count
)
.
Error
;
err
!=
nil
{
return
0
,
err
}
return
count
,
nil
}
func
GetClientApps
(
pageNum
,
pageSize
int
,
maps
interface
{})
([]
*
ClientApp
,
error
)
{
var
app
[]
*
ClientApp
err
:=
db
.
Where
(
maps
)
.
Order
(
"created_at desc"
)
.
Offset
(
pageNum
)
.
Limit
(
pageSize
)
.
Find
(
&
app
)
.
Error
if
err
!=
nil
&&
err
!=
gorm
.
ErrRecordNotFound
{
return
nil
,
err
}
return
app
,
nil
}
func
AddClientApp
(
data
map
[
string
]
interface
{})
(
error
)
{
app
:=
ClientApp
{
Type
:
data
[
"type"
]
.
(
uint8
),
BundleId
:
data
[
"bundle_id"
]
.
(
string
),
AppSignature
:
data
[
"app_signature"
]
.
(
string
),
AppPackage
:
data
[
"app_package"
]
.
(
string
),
AppSecret
:
data
[
"app_secret"
]
.
(
string
),
CreatedAt
:
time
.
Now
()
.
Unix
(),
Deadline
:
data
[
"deadline"
]
.
(
int64
),
}
if
err
:=
db
.
Create
(
&
app
)
.
Error
;
err
!=
nil
{
return
err
}
return
nil
}
func
EditClientApp
(
id
int32
,
data
interface
{})
error
{
if
err
:=
db
.
Model
(
&
ClientApp
{})
.
Where
(
"id = ?"
,
id
)
.
Updates
(
data
)
.
Error
;
err
!=
nil
{
return
err
}
return
nil
}
func
DeleteClientApp
(
id
int32
)
error
{
if
err
:=
db
.
Where
(
"id = ?"
,
id
)
.
Delete
(
ClientApp
{})
.
Error
;
err
!=
nil
{
return
err
}
return
nil
}
models/
stream
er.go
→
models/
us
er.go
View file @
f076c5b0
File moved
pkg/errno/errno.go
View file @
f076c5b0
...
@@ -82,54 +82,58 @@ var (
...
@@ -82,54 +82,58 @@ var (
// recommend coin errors
// recommend coin errors
ErrRecommendCoinNotFound
=
&
Errno
{
Code
:
20101
,
Message
:
"The recommend coin was not found."
}
ErrRecommendCoinNotFound
=
&
Errno
{
Code
:
20101
,
Message
:
"The recommend coin was not found."
}
ErrCountRecommendCoin
=
&
Errno
{
Code
:
20102
,
Message
:
"The recommend coins statistic error."
}
ErrCountRecommendCoin
=
&
Errno
{
Code
:
20102
,
Message
:
"The recommend coins statistic error."
}
ErrAddRecommendCoin
=
&
Errno
{
Code
:
2010
1
,
Message
:
"The recommend coin add error."
}
ErrAddRecommendCoin
=
&
Errno
{
Code
:
2010
3
,
Message
:
"The recommend coin add error."
}
ErrUpdateRecommendCoin
=
&
Errno
{
Code
:
2010
2
,
Message
:
"The recommend coin update error."
}
ErrUpdateRecommendCoin
=
&
Errno
{
Code
:
2010
4
,
Message
:
"The recommend coin update error."
}
ErrDeleteRecommendCoin
=
&
Errno
{
Code
:
2010
2
,
Message
:
"The recommend coin delete error."
}
ErrDeleteRecommendCoin
=
&
Errno
{
Code
:
2010
5
,
Message
:
"The recommend coin delete error."
}
ErrExistRecommendCoin
=
&
Errno
{
Code
:
2010
3
,
Message
:
"The recommend coin already exists."
}
ErrExistRecommendCoin
=
&
Errno
{
Code
:
2010
6
,
Message
:
"The recommend coin already exists."
}
// wallet errors
// wallet errors
ErrWalletNotFound
=
&
Errno
{
Code
:
20101
,
Message
:
"The wallet was not found."
}
ErrWalletNotFound
=
&
Errno
{
Code
:
20101
,
Message
:
"The wallet was not found."
}
ErrCountWallet
=
&
Errno
{
Code
:
20102
,
Message
:
"The wallets statistic error."
}
ErrCountWallet
=
&
Errno
{
Code
:
20102
,
Message
:
"The wallets statistic error."
}
ErrAddWallet
=
&
Errno
{
Code
:
2010
1
,
Message
:
"The wallet add error."
}
ErrAddWallet
=
&
Errno
{
Code
:
2010
3
,
Message
:
"The wallet add error."
}
ErrUpdateWallet
=
&
Errno
{
Code
:
2010
2
,
Message
:
"The wallet update error."
}
ErrUpdateWallet
=
&
Errno
{
Code
:
2010
4
,
Message
:
"The wallet update error."
}
ErrDeleteWallet
=
&
Errno
{
Code
:
2010
2
,
Message
:
"The wallet delete error."
}
ErrDeleteWallet
=
&
Errno
{
Code
:
2010
5
,
Message
:
"The wallet delete error."
}
// chain errors
// chain errors
ErrChainNotFound
=
&
Errno
{
Code
:
20101
,
Message
:
"The chain was not found."
}
ErrChainNotFound
=
&
Errno
{
Code
:
20101
,
Message
:
"The chain was not found."
}
ErrCountChain
=
&
Errno
{
Code
:
20102
,
Message
:
"The chain statistic error."
}
ErrCountChain
=
&
Errno
{
Code
:
20102
,
Message
:
"The chain statistic error."
}
ErrAddChain
=
&
Errno
{
Code
:
2010
1
,
Message
:
"The chain add error."
}
ErrAddChain
=
&
Errno
{
Code
:
2010
3
,
Message
:
"The chain add error."
}
ErrUpdateChain
=
&
Errno
{
Code
:
2010
2
,
Message
:
"The chain update error."
}
ErrUpdateChain
=
&
Errno
{
Code
:
2010
4
,
Message
:
"The chain update error."
}
ErrDeleteChain
=
&
Errno
{
Code
:
2010
2
,
Message
:
"The chain delete error."
}
ErrDeleteChain
=
&
Errno
{
Code
:
2010
5
,
Message
:
"The chain delete error."
}
ErrExistChain
=
&
Errno
{
Code
:
2010
3
,
Message
:
"The chain already exists."
}
ErrExistChain
=
&
Errno
{
Code
:
2010
6
,
Message
:
"The chain already exists."
}
// supported currency errors
// supported currency errors
ErrSupportedCurrencyNotFound
=
&
Errno
{
Code
:
20101
,
Message
:
"The supported currency was not found."
}
ErrSupportedCurrencyNotFound
=
&
Errno
{
Code
:
20101
,
Message
:
"The supported currency was not found."
}
ErrCountSupportedCurrency
=
&
Errno
{
Code
:
20102
,
Message
:
"The supported currency statistic error."
}
ErrCountSupportedCurrency
=
&
Errno
{
Code
:
20102
,
Message
:
"The supported currency statistic error."
}
ErrAddSupportedCurrency
=
&
Errno
{
Code
:
2010
1
,
Message
:
"The supported currency add error."
}
ErrAddSupportedCurrency
=
&
Errno
{
Code
:
2010
3
,
Message
:
"The supported currency add error."
}
ErrUpdateSupportedCurrency
=
&
Errno
{
Code
:
2010
2
,
Message
:
"The supported currency update error."
}
ErrUpdateSupportedCurrency
=
&
Errno
{
Code
:
2010
4
,
Message
:
"The supported currency update error."
}
ErrDeleteSupportedCurrency
=
&
Errno
{
Code
:
2010
2
,
Message
:
"The supported currency delete error."
}
ErrDeleteSupportedCurrency
=
&
Errno
{
Code
:
2010
5
,
Message
:
"The supported currency delete error."
}
ErrExistSupportedCurrency
=
&
Errno
{
Code
:
2010
3
,
Message
:
"The supported currency already exists."
}
ErrExistSupportedCurrency
=
&
Errno
{
Code
:
2010
6
,
Message
:
"The supported currency already exists."
}
// recommend category errors
// recommend category errors
ErrRecommendCategoryNotFound
=
&
Errno
{
Code
:
20101
,
Message
:
"The recommend category was not found."
}
ErrRecommendCategoryNotFound
=
&
Errno
{
Code
:
20101
,
Message
:
"The recommend category was not found."
}
ErrCountRecommendCategory
=
&
Errno
{
Code
:
20102
,
Message
:
"The recommend category statistic error."
}
ErrCountRecommendCategory
=
&
Errno
{
Code
:
20102
,
Message
:
"The recommend category statistic error."
}
ErrAddRecommendCategory
=
&
Errno
{
Code
:
2010
1
,
Message
:
"The recommend category add error."
}
ErrAddRecommendCategory
=
&
Errno
{
Code
:
2010
3
,
Message
:
"The recommend category add error."
}
ErrUpdateRecommendCategory
=
&
Errno
{
Code
:
2010
2
,
Message
:
"The recommend category update error."
}
ErrUpdateRecommendCategory
=
&
Errno
{
Code
:
2010
4
,
Message
:
"The recommend category update error."
}
ErrDeleteRecommendCategory
=
&
Errno
{
Code
:
2010
2
,
Message
:
"The recommend category delete error."
}
ErrDeleteRecommendCategory
=
&
Errno
{
Code
:
2010
5
,
Message
:
"The recommend category delete error."
}
ErrExistRecommendCategory
=
&
Errno
{
Code
:
2010
3
,
Message
:
"The recommend category already exists."
}
ErrExistRecommendCategory
=
&
Errno
{
Code
:
2010
6
,
Message
:
"The recommend category already exists."
}
// wallet supported chain errors
// wallet supported chain errors
ErrSupportedChainNotFound
=
&
Errno
{
Code
:
20101
,
Message
:
"The wallet supported chain was not found."
}
ErrSupportedChainNotFound
=
&
Errno
{
Code
:
20101
,
Message
:
"The wallet supported chain was not found."
}
ErrCountSupportedChain
=
&
Errno
{
Code
:
20102
,
Message
:
"The wallet supported chain statistic error."
}
ErrCountSupportedChain
=
&
Errno
{
Code
:
20102
,
Message
:
"The wallet supported chain statistic error."
}
ErrAddSupportedChain
=
&
Errno
{
Code
:
2010
1
,
Message
:
"The wallet supported chain add error."
}
ErrAddSupportedChain
=
&
Errno
{
Code
:
2010
3
,
Message
:
"The wallet supported chain add error."
}
ErrDeleteSupportedChain
=
&
Errno
{
Code
:
2010
2
,
Message
:
"The wallet supported chain delete error."
}
ErrDeleteSupportedChain
=
&
Errno
{
Code
:
2010
4
,
Message
:
"The wallet supported chain delete error."
}
ErrExistSupportedChain
=
&
Errno
{
Code
:
2010
3
,
Message
:
"The wallet supported chain already exists."
}
ErrExistSupportedChain
=
&
Errno
{
Code
:
2010
5
,
Message
:
"The wallet supported chain already exists."
}
// user errors
// user errors
ErrUserTokenIncorrect
=
&
Errno
{
Code
:
40001
,
Message
:
"The user token was incorrect."
}
ErrUserAuthIncorrect
=
&
Errno
{
Code
:
40001
,
Message
:
"The user auth was incorrect."
}
ErrUserNotFound
=
&
Errno
{
Code
:
20101
,
Message
:
"The user was not found."
}
ErrUserNotFound
=
&
Errno
{
Code
:
20101
,
Message
:
"The user was not found."
}
ErrPasswordIncorrect
=
&
Errno
{
Code
:
20102
,
Message
:
"The password was incorrect."
}
ErrAddUser
=
&
Errno
{
Code
:
20102
,
Message
:
"The user add error."
}
ErrUpdateUser
=
&
Errno
{
Code
:
20103
,
Message
:
"The user update error."
}
ErrDeleteUser
=
&
Errno
{
Code
:
20104
,
Message
:
"The user delete error."
}
ErrExistUser
=
&
Errno
{
Code
:
20105
,
Message
:
"The user already exists."
}
ErrPasswordIncorrect
=
&
Errno
{
Code
:
20106
,
Message
:
"The password was incorrect."
}
ErrUserAuthIncorrect
=
&
Errno
{
Code
:
40001
,
Message
:
"The user auth was incorrect."
}
ErrUserTokenIncorrect
=
&
Errno
{
Code
:
40001
,
Message
:
"The user token was incorrect."
}
// operation log errors
// operation log errors
ErrCountOperationLog
=
&
Errno
{
Code
:
20102
,
Message
:
"The operation log statistic error."
}
ErrCountOperationLog
=
&
Errno
{
Code
:
20102
,
Message
:
"The operation log statistic error."
}
...
@@ -138,47 +142,54 @@ var (
...
@@ -138,47 +142,54 @@ var (
// news errors
// news errors
ErrNewsNotFound
=
&
Errno
{
Code
:
20101
,
Message
:
"The news was not found."
}
ErrNewsNotFound
=
&
Errno
{
Code
:
20101
,
Message
:
"The news was not found."
}
ErrCountNews
=
&
Errno
{
Code
:
20102
,
Message
:
"The news statistic error."
}
ErrCountNews
=
&
Errno
{
Code
:
20102
,
Message
:
"The news statistic error."
}
ErrAddNews
=
&
Errno
{
Code
:
2010
1
,
Message
:
"The news add error."
}
ErrAddNews
=
&
Errno
{
Code
:
2010
3
,
Message
:
"The news add error."
}
ErrUpdateNews
=
&
Errno
{
Code
:
2010
2
,
Message
:
"The news update error."
}
ErrUpdateNews
=
&
Errno
{
Code
:
2010
4
,
Message
:
"The news update error."
}
ErrDeleteNews
=
&
Errno
{
Code
:
2010
2
,
Message
:
"The news delete error."
}
ErrDeleteNews
=
&
Errno
{
Code
:
2010
5
,
Message
:
"The news delete error."
}
ErrExistNews
=
&
Errno
{
Code
:
2010
3
,
Message
:
"The news already exists."
}
ErrExistNews
=
&
Errno
{
Code
:
2010
6
,
Message
:
"The news already exists."
}
// article errors
// article errors
ErrArticleNotFound
=
&
Errno
{
Code
:
20101
,
Message
:
"The article was not found."
}
ErrArticleNotFound
=
&
Errno
{
Code
:
20101
,
Message
:
"The article was not found."
}
ErrCountArticle
=
&
Errno
{
Code
:
20102
,
Message
:
"The article statistic error."
}
ErrCountArticle
=
&
Errno
{
Code
:
20102
,
Message
:
"The article statistic error."
}
ErrAddArticle
=
&
Errno
{
Code
:
2010
1
,
Message
:
"The article add error."
}
ErrAddArticle
=
&
Errno
{
Code
:
2010
3
,
Message
:
"The article add error."
}
ErrUpdateArticle
=
&
Errno
{
Code
:
2010
2
,
Message
:
"The article update error."
}
ErrUpdateArticle
=
&
Errno
{
Code
:
2010
4
,
Message
:
"The article update error."
}
ErrDeleteArticle
=
&
Errno
{
Code
:
2010
2
,
Message
:
"The article delete error."
}
ErrDeleteArticle
=
&
Errno
{
Code
:
2010
5
,
Message
:
"The article delete error."
}
ErrExistArticle
=
&
Errno
{
Code
:
2010
3
,
Message
:
"The article already exists."
}
ErrExistArticle
=
&
Errno
{
Code
:
2010
6
,
Message
:
"The article already exists."
}
// live category errors
// live category errors
ErrLiveCategoryNotFound
=
&
Errno
{
Code
:
20101
,
Message
:
"The live category was not found."
}
ErrLiveCategoryNotFound
=
&
Errno
{
Code
:
20101
,
Message
:
"The live category was not found."
}
ErrCountLiveCategory
=
&
Errno
{
Code
:
20102
,
Message
:
"The live category statistic error."
}
ErrCountLiveCategory
=
&
Errno
{
Code
:
20102
,
Message
:
"The live category statistic error."
}
ErrAddLiveCategory
=
&
Errno
{
Code
:
2010
1
,
Message
:
"The live category add error."
}
ErrAddLiveCategory
=
&
Errno
{
Code
:
2010
3
,
Message
:
"The live category add error."
}
ErrUpdateLiveCategory
=
&
Errno
{
Code
:
2010
2
,
Message
:
"The live category update error."
}
ErrUpdateLiveCategory
=
&
Errno
{
Code
:
2010
4
,
Message
:
"The live category update error."
}
ErrDeleteLiveCategory
=
&
Errno
{
Code
:
2010
2
,
Message
:
"The live category delete error."
}
ErrDeleteLiveCategory
=
&
Errno
{
Code
:
2010
5
,
Message
:
"The live category delete error."
}
ErrExistLiveCategory
=
&
Errno
{
Code
:
2010
3
,
Message
:
"The live category already exists."
}
ErrExistLiveCategory
=
&
Errno
{
Code
:
2010
6
,
Message
:
"The live category already exists."
}
// live info errors
// live info errors
ErrLiveInfoNotFound
=
&
Errno
{
Code
:
20101
,
Message
:
"The live info was not found."
}
ErrLiveInfoNotFound
=
&
Errno
{
Code
:
20101
,
Message
:
"The live info was not found."
}
ErrCountLiveInfo
=
&
Errno
{
Code
:
20102
,
Message
:
"The live info statistic error."
}
ErrCountLiveInfo
=
&
Errno
{
Code
:
20102
,
Message
:
"The live info statistic error."
}
ErrAddLiveInfo
=
&
Errno
{
Code
:
2010
1
,
Message
:
"The live info add error."
}
ErrAddLiveInfo
=
&
Errno
{
Code
:
2010
3
,
Message
:
"The live info add error."
}
ErrUpdateLiveInfo
=
&
Errno
{
Code
:
2010
2
,
Message
:
"The live info update error."
}
ErrUpdateLiveInfo
=
&
Errno
{
Code
:
2010
4
,
Message
:
"The live info update error."
}
ErrDeleteLiveInfo
=
&
Errno
{
Code
:
2010
2
,
Message
:
"The live info delete error."
}
ErrDeleteLiveInfo
=
&
Errno
{
Code
:
2010
5
,
Message
:
"The live info delete error."
}
ErrExistLiveInfo
=
&
Errno
{
Code
:
2010
3
,
Message
:
"The live info already exists."
}
ErrExistLiveInfo
=
&
Errno
{
Code
:
2010
6
,
Message
:
"The live info already exists."
}
// live title record errors
// live title record errors
ErrLiveTitleRecordNotFound
=
&
Errno
{
Code
:
20101
,
Message
:
"The live title record was not found."
}
ErrLiveTitleRecordNotFound
=
&
Errno
{
Code
:
20101
,
Message
:
"The live title record was not found."
}
ErrCountLiveTitleRecord
=
&
Errno
{
Code
:
20102
,
Message
:
"The live title record statistic error."
}
ErrCountLiveTitleRecord
=
&
Errno
{
Code
:
20102
,
Message
:
"The live title record statistic error."
}
ErrAddLiveTitleRecord
=
&
Errno
{
Code
:
2010
1
,
Message
:
"The live title record add error."
}
ErrAddLiveTitleRecord
=
&
Errno
{
Code
:
2010
3
,
Message
:
"The live title record add error."
}
ErrUpdateLiveTitleRecord
=
&
Errno
{
Code
:
2010
2
,
Message
:
"The live title record update error."
}
ErrUpdateLiveTitleRecord
=
&
Errno
{
Code
:
2010
4
,
Message
:
"The live title record update error."
}
ErrDeleteLiveTitleRecord
=
&
Errno
{
Code
:
2010
2
,
Message
:
"The live title record delete error."
}
ErrDeleteLiveTitleRecord
=
&
Errno
{
Code
:
2010
5
,
Message
:
"The live title record delete error."
}
ErrExistLiveTitleRecord
=
&
Errno
{
Code
:
2010
3
,
Message
:
"The live title record already exists."
}
ErrExistLiveTitleRecord
=
&
Errno
{
Code
:
2010
6
,
Message
:
"The live title record already exists."
}
// live banner errors
// live banner errors
ErrLiveBannerNotFound
=
&
Errno
{
Code
:
20101
,
Message
:
"The live banner was not found."
}
ErrLiveBannerNotFound
=
&
Errno
{
Code
:
20101
,
Message
:
"The live banner was not found."
}
ErrCountLiveBanner
=
&
Errno
{
Code
:
20102
,
Message
:
"The live banners statistic error."
}
ErrCountLiveBanner
=
&
Errno
{
Code
:
20102
,
Message
:
"The live banners statistic error."
}
ErrAddLiveBanner
=
&
Errno
{
Code
:
20101
,
Message
:
"The live banner add error."
}
ErrAddLiveBanner
=
&
Errno
{
Code
:
20103
,
Message
:
"The live banner add error."
}
ErrUpdateLiveBanner
=
&
Errno
{
Code
:
20102
,
Message
:
"The live banner update error."
}
ErrUpdateLiveBanner
=
&
Errno
{
Code
:
20104
,
Message
:
"The live banner update error."
}
ErrDeleteLiveBanner
=
&
Errno
{
Code
:
20102
,
Message
:
"The live banner delete error."
}
ErrDeleteLiveBanner
=
&
Errno
{
Code
:
20105
,
Message
:
"The live banner delete error."
}
// app errors
ErrClientAppNotFound
=
&
Errno
{
Code
:
20101
,
Message
:
"The client app was not found."
}
ErrCountClientApp
=
&
Errno
{
Code
:
20102
,
Message
:
"The client apps statistic error."
}
ErrAddClientApp
=
&
Errno
{
Code
:
20103
,
Message
:
"The client app add error."
}
ErrUpdateClientApp
=
&
Errno
{
Code
:
20104
,
Message
:
"The client app update error."
}
ErrDeleteClientApp
=
&
Errno
{
Code
:
20105
,
Message
:
"The client app delete error."
}
)
)
routers/api/app/client-app.go
0 → 100644
View file @
f076c5b0
package
app
import
(
"bwallet/pkg/errno"
"bwallet/pkg/handler"
"bwallet/pkg/util"
"bwallet/service/client_app_service"
"github.com/gin-gonic/gin"
)
func
AppSecret
(
c
*
gin
.
Context
)
{
arg
:=
c
.
Query
(
"secret"
)
if
arg
==
""
{
handler
.
SendResponse
(
c
,
errno
.
ErrValidation
,
nil
)
return
}
app_service
:=
client_app_service
.
ClientApp
{
AppSecret
:
arg
,
PageNum
:
util
.
GetPage
(
c
),
PageSize
:
util
.
GetLimit
(
c
),
}
total
,
err
:=
app_service
.
Count
()
if
err
!=
nil
{
handler
.
SendResponse
(
c
,
errno
.
ErrCountClientApp
,
nil
)
return
}
if
0
==
total
{
handler
.
SendResponse
(
c
,
errno
.
ErrClientAppNotFound
,
nil
)
return
}
app
,
err
:=
app_service
.
GetAll
()
if
err
!=
nil
{
handler
.
SendResponse
(
c
,
errno
.
InternalServerError
,
nil
)
return
}
handler
.
SendResponse
(
c
,
nil
,
app
[
0
]
.
Deadline
)
}
routers/router.go
View file @
f076c5b0
...
@@ -28,13 +28,15 @@ func InitRouter() *gin.Engine {
...
@@ -28,13 +28,15 @@ func InitRouter() *gin.Engine {
//r.POST("/upload", api.UploadImage)
//r.POST("/upload", api.UploadImage)
client
:=
r
.
Group
(
"/interface"
)
client
:=
r
.
Group
(
"/interface"
)
client
.
Use
(
aes
.
Aes
())
client
.
GET
(
"/news"
,
app
.
GetNews
)
client
.
GET
(
"/news"
,
app
.
GetNews
)
client
.
GET
(
"/one-news"
,
app
.
GetOneNews
)
client
.
GET
(
"/one-news"
,
app
.
GetOneNews
)
client
.
GET
(
"/articles"
,
app
.
GetArticle
)
client
.
GET
(
"/articles"
,
app
.
GetArticle
)
client
.
GET
(
"/article"
,
app
.
GetOneArticle
)
client
.
GET
(
"/article"
,
app
.
GetOneArticle
)
client
.
GET
(
"/live-categories"
,
app
.
GetLiveCategories
)
client
.
GET
(
"/live-categories"
,
app
.
GetLiveCategories
)
client
.
GET
(
"/transaction-fee"
,
app
.
GetTransactionFee
)
client
.
GET
(
"/transaction-fee"
,
app
.
GetTransactionFee
)
client
.
GET
(
"/secret"
,
app
.
AppSecret
)
client
.
Use
(
aes
.
Aes
())
client
.
POST
(
"/user"
,
app
.
AddUser
)
api
:=
r
.
Group
(
"/api"
)
api
:=
r
.
Group
(
"/api"
)
...
...
service/client_app_service/client_app.go
0 → 100644
View file @
f076c5b0
package
client_app_service
import
(
"bwallet/models"
)
type
ClientApp
struct
{
Id
int32
`json:"omitempty"`
Type
uint8
`json:"omitempty"`
BundleId
string
`json:"omitempty"`
AppSignature
string
`json:"omitempty"`
AppPackage
string
`json:"omitempty"`
AppSecret
string
`json:"omitempty"`
CreatedAt
int64
Deadline
int64
PageNum
int
PageSize
int
}
func
(
a
*
ClientApp
)
GetClientApp
()
(
*
models
.
ClientApp
,
error
)
{
app
,
err
:=
models
.
GetClientApp
(
a
.
Id
)
if
err
!=
nil
{
return
nil
,
err
}
return
app
,
nil
}
func
(
a
*
ClientApp
)
GetAll
()
([]
*
models
.
ClientApp
,
error
)
{
var
app
[]
*
models
.
ClientApp
app
,
err
:=
models
.
GetClientApps
(
a
.
PageNum
,
a
.
PageSize
,
a
.
getMaps
())
if
err
!=
nil
{
return
nil
,
err
}
return
app
,
nil
}
func
(
a
*
ClientApp
)
Add
()
error
{
app
:=
map
[
string
]
interface
{}{
"type"
:
a
.
Type
,
"bundle_id"
:
a
.
BundleId
,
"app_signature"
:
a
.
AppSignature
,
"app_package"
:
a
.
AppPackage
,
"app_secret"
:
a
.
AppSecret
,
"deadline"
:
a
.
Deadline
,
}
if
err
:=
models
.
AddClientApp
(
app
);
err
!=
nil
{
return
err
}
return
nil
}
func
(
a
*
ClientApp
)
Edit
()
error
{
return
models
.
EditClientApp
(
a
.
Id
,
map
[
string
]
interface
{}{
"type"
:
a
.
Type
,
"bundle_id"
:
a
.
BundleId
,
"app_signature"
:
a
.
AppSignature
,
"app_package"
:
a
.
AppPackage
,
"app_secret"
:
a
.
AppSecret
,
"deadline"
:
a
.
Deadline
,
})
}
func
(
a
*
ClientApp
)
ExistById
()
(
bool
,
error
)
{
return
models
.
ExistClientAppById
(
a
.
Id
)
}
func
(
a
*
ClientApp
)
Count
()
(
int
,
error
)
{
return
models
.
GetClientAppTotal
(
a
.
getMaps
())
}
func
(
a
*
ClientApp
)
Delete
()
error
{
return
models
.
DeleteClientApp
(
a
.
Id
)
}
func
(
a
*
ClientApp
)
getMaps
()
(
map
[
string
]
interface
{})
{
maps
:=
make
(
map
[
string
]
interface
{})
if
a
.
Id
!=
0
{
maps
[
"id"
]
=
a
.
Id
}
if
a
.
AppSecret
!=
""
{
maps
[
"app_secret"
]
=
a
.
AppSecret
}
return
maps
}
service/streamer_service/live_info.go
deleted
100644 → 0
View file @
5d033468
package
streamer_service
import
(
"bwallet/models"
)
type
Streamer
struct
{
Uid
int32
UserName
string
NickName
string
Password
string
RegTime
int64
LastLoginTime
int64
RegIp
uint32
LastLoginIp
uint32
Status
uint8
PlatformId
int64
PageNum
int
PageSize
int
}
func
(
s
*
Streamer
)
GetOneStreamer
()
(
*
models
.
Streamer
,
error
)
{
streamer
,
err
:=
models
.
GetStreamer
(
s
.
Uid
)
if
err
!=
nil
{
return
nil
,
err
}
return
streamer
,
nil
}
func
(
s
*
Streamer
)
GetAll
()
([]
*
models
.
Streamer
,
error
)
{
var
streamer
[]
*
models
.
Streamer
streamer
,
err
:=
models
.
GetStreamers
(
s
.
PageNum
,
s
.
PageSize
,
s
.
getMaps
())
if
err
!=
nil
{
return
nil
,
err
}
return
streamer
,
nil
}
func
(
s
*
Streamer
)
Add
()
error
{
streamer
:=
map
[
string
]
interface
{}{
"username"
:
s
.
UserName
,
"nickname"
:
s
.
NickName
,
"password"
:
s
.
Password
,
"reg_ip"
:
s
.
RegIp
,
"last_login_ip"
:
s
.
LastLoginIp
,
"status"
:
s
.
Status
,
"platform_id"
:
s
.
PlatformId
,
}
if
err
:=
models
.
AddStreamer
(
streamer
);
err
!=
nil
{
return
err
}
return
nil
}
func
(
s
*
Streamer
)
Edit
()
error
{
return
models
.
EditStreamer
(
s
.
Uid
,
map
[
string
]
interface
{}{
"username"
:
s
.
UserName
,
"nickname"
:
s
.
NickName
,
"password"
:
s
.
Password
,
"reg_ip"
:
s
.
RegIp
,
"last_login_ip"
:
s
.
LastLoginIp
,
"status"
:
s
.
Status
,
"platform_id"
:
s
.
PlatformId
,
})
}
func
(
s
*
Streamer
)
ExistById
()
(
bool
,
error
)
{
return
models
.
ExistStreamerById
(
s
.
Uid
)
}
func
(
s
*
Streamer
)
Count
()
(
int
,
error
)
{
return
models
.
GetStreamerTotal
(
s
.
getMaps
())
}
func
(
s
*
Streamer
)
Delete
()
error
{
return
models
.
DeleteStreamer
(
s
.
Uid
)
}
func
(
s
*
Streamer
)
getMaps
()
(
map
[
string
]
interface
{})
{
maps
:=
make
(
map
[
string
]
interface
{})
if
s
.
Uid
!=
0
{
maps
[
"id"
]
=
s
.
Uid
}
if
s
.
PlatformId
!=
0
{
maps
[
"platform_id"
]
=
s
.
PlatformId
}
maps
[
"status"
]
=
s
.
Status
return
maps
}
service/user_service/user.go
0 → 100644
View file @
f076c5b0
package
user_service
import
(
"bwallet/models"
)
type
User
struct
{
Uid
int32
UserName
string
NickName
string
Password
string
RegTime
int64
LastLoginTime
int64
RegIp
uint32
LastLoginIp
uint32
Status
uint8
PlatformId
int64
PageNum
int
PageSize
int
}
func
(
u
*
User
)
GetOneUser
()
(
*
models
.
User
,
error
)
{
user
,
err
:=
models
.
GetUser
(
u
.
Uid
)
if
err
!=
nil
{
return
nil
,
err
}
return
user
,
nil
}
func
(
u
*
User
)
GetAll
()
([]
*
models
.
User
,
error
)
{
var
user
[]
*
models
.
User
user
,
err
:=
models
.
GetUsers
(
u
.
PageNum
,
u
.
PageSize
,
u
.
getMaps
())
if
err
!=
nil
{
return
nil
,
err
}
return
user
,
nil
}
func
(
u
*
User
)
Add
()
error
{
user
:=
map
[
string
]
interface
{}{
"username"
:
u
.
UserName
,
"nickname"
:
u
.
NickName
,
"password"
:
u
.
Password
,
"reg_ip"
:
u
.
RegIp
,
"last_login_ip"
:
u
.
LastLoginIp
,
"status"
:
u
.
Status
,
"platform_id"
:
u
.
PlatformId
,
}
if
err
:=
models
.
AddUser
(
user
);
err
!=
nil
{
return
err
}
return
nil
}
func
(
u
*
User
)
Edit
()
error
{
return
models
.
EditUser
(
u
.
Uid
,
map
[
string
]
interface
{}{
"username"
:
u
.
UserName
,
"nickname"
:
u
.
NickName
,
"password"
:
u
.
Password
,
"reg_ip"
:
u
.
RegIp
,
"last_login_ip"
:
u
.
LastLoginIp
,
"status"
:
u
.
Status
,
"platform_id"
:
u
.
PlatformId
,
})
}
func
(
u
*
User
)
ExistById
()
(
bool
,
error
)
{
return
models
.
ExistUserById
(
u
.
Uid
)
}
func
(
u
*
User
)
Count
()
(
int
,
error
)
{
return
models
.
GetUserTotal
(
u
.
getMaps
())
}
func
(
u
*
User
)
Delete
()
error
{
return
models
.
DeleteUser
(
u
.
Uid
)
}
func
(
u
*
User
)
getMaps
()
(
map
[
string
]
interface
{})
{
maps
:=
make
(
map
[
string
]
interface
{})
if
u
.
Uid
!=
0
{
maps
[
"id"
]
=
u
.
Uid
}
if
u
.
PlatformId
!=
0
{
maps
[
"platform_id"
]
=
u
.
PlatformId
}
maps
[
"status"
]
=
u
.
Status
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