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
ab97447a
Commit
ab97447a
authored
Dec 29, 2020
by
shajiaiming
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'develop' into feature/live
parents
951860aa
2db9a8dd
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
31 additions
and
11 deletions
+31
-11
live_title_record.go
models/live_title_record.go
+0
-2
manager.go
models/manager.go
+10
-2
operation_log.go
models/operation_log.go
+4
-0
errno.go
pkg/errno/errno.go
+1
-0
cache.go
pkg/gredis/cache.go
+0
-2
manager.go
routers/api/backend/manager.go
+12
-4
article.go
service/article_service/article.go
+0
-1
operation_log.go
service/operation_log_service/operation_log.go
+4
-0
No files found.
models/live_title_record.go
View file @
ab97447a
...
@@ -2,7 +2,6 @@ package models
...
@@ -2,7 +2,6 @@ package models
import
(
import
(
"bwallet/pkg/setting"
"bwallet/pkg/setting"
"fmt"
"github.com/jinzhu/gorm"
"github.com/jinzhu/gorm"
)
)
...
@@ -65,7 +64,6 @@ func GetRecord(id int) (*LiveTitleRecord, error) {
...
@@ -65,7 +64,6 @@ func GetRecord(id int) (*LiveTitleRecord, error) {
func
GetLiveTitleRecord
(
pageNum
,
pageSize
int
,
maps
interface
{})
([]
*
LiveTitleRecord
,
error
)
{
func
GetLiveTitleRecord
(
pageNum
,
pageSize
int
,
maps
interface
{})
([]
*
LiveTitleRecord
,
error
)
{
var
live
[]
*
LiveTitleRecord
var
live
[]
*
LiveTitleRecord
fmt
.
Println
(
maps
)
err
:=
db
.
Debug
()
.
Where
(
maps
)
.
Preload
(
"LiveInfo"
)
.
Order
(
"create_time desc"
)
.
Offset
(
pageNum
)
.
Limit
(
pageSize
)
.
Find
(
&
live
)
.
Error
err
:=
db
.
Debug
()
.
Where
(
maps
)
.
Preload
(
"LiveInfo"
)
.
Order
(
"create_time desc"
)
.
Offset
(
pageNum
)
.
Limit
(
pageSize
)
.
Find
(
&
live
)
.
Error
if
err
!=
nil
&&
err
!=
gorm
.
ErrRecordNotFound
{
if
err
!=
nil
&&
err
!=
gorm
.
ErrRecordNotFound
{
return
nil
,
err
return
nil
,
err
...
...
models/manager.go
View file @
ab97447a
...
@@ -2,6 +2,7 @@ package models
...
@@ -2,6 +2,7 @@ package models
import
(
import
(
"bwallet/pkg/setting"
"bwallet/pkg/setting"
"fmt"
"github.com/jinzhu/gorm"
"github.com/jinzhu/gorm"
"time"
"time"
)
)
...
@@ -77,8 +78,15 @@ func GetManagerTotal(maps interface{}) (int, error) {
...
@@ -77,8 +78,15 @@ func GetManagerTotal(maps interface{}) (int, error) {
func
GetManagers
(
pageNum
,
pageSize
int
,
maps
interface
{})
([]
*
Manager
,
error
)
{
func
GetManagers
(
pageNum
,
pageSize
int
,
maps
interface
{})
([]
*
Manager
,
error
)
{
var
manager
[]
*
Manager
var
manager
[]
*
Manager
var
uid
int32
err
:=
db
.
Where
(
maps
)
.
Order
(
"uid desc"
)
.
Offset
(
pageNum
)
.
Limit
(
pageSize
)
.
Find
(
&
manager
)
.
Error
for
key
,
val
:=
range
maps
.
(
map
[
string
]
interface
{})
{
if
(
"uid"
==
key
)
{
uid
=
val
.
(
int32
)
delete
(
maps
.
(
map
[
string
]
interface
{}),
"uid"
)
}
}
fmt
.
Println
(
maps
)
err
:=
db
.
Debug
()
.
Where
(
maps
)
.
Where
(
"uid <> ?"
,
uid
)
.
Order
(
"uid desc"
)
.
Offset
(
pageNum
)
.
Limit
(
pageSize
)
.
Find
(
&
manager
)
.
Error
if
err
!=
nil
&&
err
!=
gorm
.
ErrRecordNotFound
{
if
err
!=
nil
&&
err
!=
gorm
.
ErrRecordNotFound
{
return
nil
,
err
return
nil
,
err
}
}
...
...
models/operation_log.go
View file @
ab97447a
...
@@ -3,6 +3,7 @@ package models
...
@@ -3,6 +3,7 @@ package models
import
(
import
(
"bwallet/pkg/setting"
"bwallet/pkg/setting"
"bwallet/pkg/util"
"bwallet/pkg/util"
"time"
)
)
type
OperationLog
struct
{
type
OperationLog
struct
{
...
@@ -16,6 +17,7 @@ type OperationLog struct {
...
@@ -16,6 +17,7 @@ type OperationLog struct {
Operation
string
`json:"operation"`
Operation
string
`json:"operation"`
Business
string
`json:"business"`
Business
string
`json:"business"`
Table
string
`json:"table"`
Table
string
`json:"table"`
CreateTime
string
`json:"create_time"`
}
}
type
OperationLogs
struct
{
type
OperationLogs
struct
{
...
@@ -26,6 +28,7 @@ type OperationLogs struct {
...
@@ -26,6 +28,7 @@ type OperationLogs struct {
Operation
string
`json:"operation"`
Operation
string
`json:"operation"`
Business
string
`json:"business"`
Business
string
`json:"business"`
Table
string
`json:"table"`
Table
string
`json:"table"`
CreateTime
string
`json:"create_time"`
}
}
func
(
a
OperationLog
)
TableName
()
string
{
func
(
a
OperationLog
)
TableName
()
string
{
...
@@ -61,6 +64,7 @@ func AddOperationLog(data map[string]interface{}) error {
...
@@ -61,6 +64,7 @@ func AddOperationLog(data map[string]interface{}) error {
Operation
:
data
[
"operation"
]
.
(
string
),
Operation
:
data
[
"operation"
]
.
(
string
),
Business
:
data
[
"business"
]
.
(
string
),
Business
:
data
[
"business"
]
.
(
string
),
Table
:
data
[
"table"
]
.
(
string
),
Table
:
data
[
"table"
]
.
(
string
),
CreateTime
:
time
.
Now
()
.
Format
(
"2006-01-02 15:04:05"
),
}
}
if
err
:=
db
.
Create
(
&
operationLog
)
.
Error
;
err
!=
nil
{
if
err
:=
db
.
Create
(
&
operationLog
)
.
Error
;
err
!=
nil
{
...
...
pkg/errno/errno.go
View file @
ab97447a
...
@@ -133,6 +133,7 @@ var (
...
@@ -133,6 +133,7 @@ var (
ErrDeleteUser
=
&
Errno
{
Code
:
20105
,
Message
:
"The user delete error."
}
ErrDeleteUser
=
&
Errno
{
Code
:
20105
,
Message
:
"The user delete error."
}
ErrExistUser
=
&
Errno
{
Code
:
20106
,
Message
:
"The user already exists."
}
ErrExistUser
=
&
Errno
{
Code
:
20106
,
Message
:
"The user already exists."
}
ErrDeleteSelf
=
&
Errno
{
Code
:
20105
,
Message
:
"The user can not delete yourself."
}
ErrDeleteSelf
=
&
Errno
{
Code
:
20105
,
Message
:
"The user can not delete yourself."
}
ErrUpdateSelf
=
&
Errno
{
Code
:
20105
,
Message
:
"The user can not modify yourself."
}
ErrPasswordIncorrect
=
&
Errno
{
Code
:
20107
,
Message
:
"The password was incorrect."
}
ErrPasswordIncorrect
=
&
Errno
{
Code
:
20107
,
Message
:
"The password was incorrect."
}
ErrUserAuthIncorrect
=
&
Errno
{
Code
:
40001
,
Message
:
"The user auth was incorrect."
}
ErrUserAuthIncorrect
=
&
Errno
{
Code
:
40001
,
Message
:
"The user auth was incorrect."
}
ErrUserTokenIncorrect
=
&
Errno
{
Code
:
40001
,
Message
:
"The user token was incorrect."
}
ErrUserTokenIncorrect
=
&
Errno
{
Code
:
40001
,
Message
:
"The user token was incorrect."
}
...
...
pkg/gredis/cache.go
View file @
ab97447a
...
@@ -2,7 +2,6 @@ package gredis
...
@@ -2,7 +2,6 @@ package gredis
import
(
import
(
"bwallet/pkg/util"
"bwallet/pkg/util"
"fmt"
"github.com/gomodule/redigo/redis"
"github.com/gomodule/redigo/redis"
"time"
"time"
)
)
...
@@ -27,7 +26,6 @@ func NewRedisCache(db int, host string, defaultExpiration time.Duration) Cache {
...
@@ -27,7 +26,6 @@ func NewRedisCache(db int, host string, defaultExpiration time.Duration) Cache {
Dial
:
func
()
(
redis
.
Conn
,
error
)
{
Dial
:
func
()
(
redis
.
Conn
,
error
)
{
conn
,
err
:=
redis
.
Dial
(
"tcp"
,
host
,
redis
.
DialDatabase
(
db
))
conn
,
err
:=
redis
.
Dial
(
"tcp"
,
host
,
redis
.
DialDatabase
(
db
))
if
err
!=
nil
{
if
err
!=
nil
{
fmt
.
Println
(
err
)
return
nil
,
err
return
nil
,
err
}
}
return
conn
,
nil
return
conn
,
nil
...
...
routers/api/backend/manager.go
View file @
ab97447a
...
@@ -7,7 +7,6 @@ import (
...
@@ -7,7 +7,6 @@ import (
"bwallet/pkg/util"
"bwallet/pkg/util"
"bwallet/service/manager_service"
"bwallet/service/manager_service"
"bwallet/validate_service"
"bwallet/validate_service"
"fmt"
"github.com/Unknwon/com"
"github.com/Unknwon/com"
"github.com/astaxie/beego/validation"
"github.com/astaxie/beego/validation"
"github.com/gin-gonic/gin"
"github.com/gin-gonic/gin"
...
@@ -43,7 +42,6 @@ func AddManager(c *gin.Context) {
...
@@ -43,7 +42,6 @@ func AddManager(c *gin.Context) {
manager_service
.
UserName
=
manager
.
UserName
manager_service
.
UserName
=
manager
.
UserName
count
,
err
:=
manager_service
.
Count
()
count
,
err
:=
manager_service
.
Count
()
if
count
>
0
||
err
!=
nil
{
if
count
>
0
||
err
!=
nil
{
fmt
.
Println
(
count
,
err
)
handler
.
SendResponse
(
c
,
errno
.
ErrExistUser
,
nil
)
handler
.
SendResponse
(
c
,
errno
.
ErrExistUser
,
nil
)
return
return
}
}
...
@@ -93,6 +91,7 @@ func GetManagers(c *gin.Context) {
...
@@ -93,6 +91,7 @@ func GetManagers(c *gin.Context) {
manager_service
:=
manager_service
.
Manager
{
manager_service
:=
manager_service
.
Manager
{
UserName
:
username
,
UserName
:
username
,
Status
:
status
,
Status
:
status
,
Uid
:
int32
(
user
.
UserInfo
.
Uid
),
PlatformId
:
platform_id
,
PlatformId
:
platform_id
,
PageNum
:
util
.
GetPage
(
c
),
PageNum
:
util
.
GetPage
(
c
),
PageSize
:
util
.
GetLimit
(
c
),
PageSize
:
util
.
GetLimit
(
c
),
...
@@ -151,6 +150,10 @@ func EditManager(c *gin.Context) {
...
@@ -151,6 +150,10 @@ func EditManager(c *gin.Context) {
var
platform_id
int32
var
platform_id
int32
platform_id
=
int32
(
user
.
UserInfo
.
PlatformId
)
platform_id
=
int32
(
user
.
UserInfo
.
PlatformId
)
if
user
.
UserInfo
.
Group
==
manager
.
Group
{
handler
.
SendResponse
(
c
,
errno
.
ErrUserAuthIncorrect
,
nil
)
return
}
if
"admin"
==
group
&&
platform_id
!=
manager
.
PlatformId
{
if
"admin"
==
group
&&
platform_id
!=
manager
.
PlatformId
{
handler
.
SendResponse
(
c
,
errno
.
ErrUserAuthIncorrect
,
nil
)
handler
.
SendResponse
(
c
,
errno
.
ErrUserAuthIncorrect
,
nil
)
...
@@ -165,7 +168,7 @@ func EditManager(c *gin.Context) {
...
@@ -165,7 +168,7 @@ func EditManager(c *gin.Context) {
manager_service
.
Status
=
manager_params
.
Status
manager_service
.
Status
=
manager_params
.
Status
err
=
manager_service
.
Edit
()
err
=
manager_service
.
Edit
()
if
err
!=
nil
{
if
err
!=
nil
{
handler
.
SendResponse
(
c
,
errno
.
Err
DeleteUser
,
nil
)
handler
.
SendResponse
(
c
,
errno
.
Err
UpdateSelf
,
nil
)
return
return
}
}
...
@@ -205,7 +208,7 @@ func DeleteManager(c *gin.Context) {
...
@@ -205,7 +208,7 @@ func DeleteManager(c *gin.Context) {
var
platform_id
int32
var
platform_id
int32
platform_id
=
int32
(
user
.
UserInfo
.
PlatformId
)
platform_id
=
int32
(
user
.
UserInfo
.
PlatformId
)
if
"administrator"
==
manager
.
Group
{
if
user
.
UserInfo
.
Group
==
manager
.
Group
{
handler
.
SendResponse
(
c
,
errno
.
ErrUserAuthIncorrect
,
nil
)
handler
.
SendResponse
(
c
,
errno
.
ErrUserAuthIncorrect
,
nil
)
return
return
}
}
...
@@ -215,6 +218,11 @@ func DeleteManager(c *gin.Context) {
...
@@ -215,6 +218,11 @@ func DeleteManager(c *gin.Context) {
return
return
}
}
if
"administrator"
==
manager
.
Group
{
handler
.
SendResponse
(
c
,
errno
.
ErrUserAuthIncorrect
,
nil
)
return
}
err
=
manager_service
.
Delete
()
err
=
manager_service
.
Delete
()
if
err
!=
nil
{
if
err
!=
nil
{
handler
.
SendResponse
(
c
,
errno
.
ErrDeleteUser
,
nil
)
handler
.
SendResponse
(
c
,
errno
.
ErrDeleteUser
,
nil
)
...
...
service/article_service/article.go
View file @
ab97447a
...
@@ -59,7 +59,6 @@ func (a *Article) Get() (*models.Article, error) {
...
@@ -59,7 +59,6 @@ func (a *Article) Get() (*models.Article, error) {
condition
.
Add
(
"sign"
,
sign
)
condition
.
Add
(
"sign"
,
sign
)
req
.
URL
.
RawQuery
=
condition
.
Encode
()
req
.
URL
.
RawQuery
=
condition
.
Encode
()
//fmt.Println(req.URL.String())
r
,
err
:=
http
.
DefaultClient
.
Do
(
req
)
r
,
err
:=
http
.
DefaultClient
.
Do
(
req
)
if
err
!=
nil
{
if
err
!=
nil
{
return
nil
,
err
return
nil
,
err
...
...
service/operation_log_service/operation_log.go
View file @
ab97447a
...
@@ -3,6 +3,7 @@ package operation_log_service
...
@@ -3,6 +3,7 @@ package operation_log_service
import
(
import
(
"bwallet/models"
"bwallet/models"
"bwallet/pkg/util"
"bwallet/pkg/util"
"strings"
)
)
type
OperationLog
struct
{
type
OperationLog
struct
{
...
@@ -56,6 +57,9 @@ func (ol *OperationLog) GetAll() ([]*models.OperationLogs, error) {
...
@@ -56,6 +57,9 @@ func (ol *OperationLog) GetAll() ([]*models.OperationLogs, error) {
op
.
Operation
=
value
.
Operation
op
.
Operation
=
value
.
Operation
op
.
Business
=
value
.
Business
op
.
Business
=
value
.
Business
op
.
Table
=
value
.
Table
op
.
Table
=
value
.
Table
op
.
CreateTime
=
strings
.
Replace
(
value
.
CreateTime
,
"+08:00"
,
""
,
-
1
)
op
.
CreateTime
=
strings
.
Replace
(
op
.
CreateTime
,
"T"
,
" "
,
-
1
)
operationLogs
=
append
(
operationLogs
,
op
)
operationLogs
=
append
(
operationLogs
,
op
)
}
}
...
...
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