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
8ea05fb5
Commit
8ea05fb5
authored
Dec 30, 2020
by
shajiaiming
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix
parent
5c27e401
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
41 additions
and
15 deletions
+41
-15
live_info.go
models/live_info.go
+29
-13
time.go
pkg/util/time.go
+4
-0
live.go
routers/api/app/live.go
+3
-2
live_info.go
service/live_info_service/live_info.go
+5
-0
No files found.
models/live_info.go
View file @
8ea05fb5
...
...
@@ -3,28 +3,41 @@ package models
import
(
"bwallet/pkg/setting"
"github.com/jinzhu/gorm"
"time"
)
type
LiveInfo
struct
{
Model
Title
string
`gorm:"not null;default:''" json:"title"`
Cover
string
`gorm:"not null;default:''" json:"cover"`
CategoryId
uint8
`gorm:"not null;default:0" json:"category_id"`
Duration
uint32
`gorm:"not null;default:0" json:"duration"`
Attendance
uint32
`gorm:"not null;default:0" json:"attendance"`
Mode
uint8
`gorm:"not null;default:1" json:"mode"`
ApplyId
uint32
`gorm:"not null;default:0" json:"apply_id"`
ApplyName
string
`gorm:"not null;default:''" json:"apply_id"`
Status
uint8
`gorm:"not null;default:0" json:"status"`
Sort
uint8
`gorm:"not null;default:0" json:"sort"`
PlatformId
int64
`gorm:"not null;default:0" json:"platform_id"`
OrderSn
int64
`gorm:"not null;default:0" json:"order_sn"`
Price
float64
`gorm:"not null;default:0.00" json:"price"`
Title
string
`json:"title"`
Cover
string
`json:"cover"`
CategoryId
uint8
`json:"category_id"`
Duration
uint32
`json:"duration"`
Attendance
uint32
`json:"attendance"`
Mode
uint8
`json:"mode"`
ApplyId
uint32
`json:"apply_id"`
ApplyName
string
`json:"apply_id"`
Status
uint8
`json:"status"`
LiveStatus
uint8
`json:"live_status"`
Sort
uint8
`json:"sort"`
PlatformId
int64
`json:"platform_id"`
OrderSn
int64
`json:"order_sn"`
Price
float64
`json:"price"`
CreateTime
int64
`json:"create_time,omitempty"`
Category
*
LiveCategory
`gorm:"foreignkey:CategoryId" json:"category"`
}
const
(
PROCESSING
=
0
//待审核
PEDDING_PAYMENT
=
1
//审核通过(待支付)
VOIDED
=
2
//无效
PEDDING_LIVE
=
2
//等待开播
LIVEING
=
3
//直播中
LIVEED
=
4
//直播结束
)
func
(
w
LiveInfo
)
TableName
()
string
{
return
setting
.
DatabaseSetting
.
Name_Sources
+
".wallet_live_info"
}
...
...
@@ -92,6 +105,9 @@ func AddLiveInfo(data map[string]interface{}) (error) {
PlatformId
:
data
[
"platform_id"
]
.
(
int64
),
OrderSn
:
data
[
"order_sn"
]
.
(
int64
),
Price
:
data
[
"price"
]
.
(
float64
),
Status
:
PROCESSING
,
LiveStatus
:
PROCESSING
,
CreateTime
:
time
.
Now
()
.
UTC
()
.
Unix
(),
}
if
err
:=
db
.
Create
(
&
live
)
.
Error
;
err
!=
nil
{
...
...
pkg/util/time.go
View file @
8ea05fb5
...
...
@@ -17,3 +17,7 @@ func GetCurrentMilliUnix() int64 {
func
GetCurrentNanoUnix
()
int64
{
return
time
.
Now
()
.
UnixNano
()
}
func
FormatUnix
(
time_tmp
int64
)
string
{
return
time
.
Unix
(
time_tmp
,
0
)
.
Format
(
"2006-01-02 15:04:05"
)
}
routers/api/app/live.go
View file @
8ea05fb5
...
...
@@ -40,7 +40,7 @@ func AddLive(c *gin.Context) {
}
if
err
:=
infoService
.
Add
();
err
!=
nil
{
handler
.
SendResponse
(
c
,
errno
.
ErrAddLive
Banner
,
nil
)
handler
.
SendResponse
(
c
,
errno
.
ErrAddLive
Info
,
nil
)
return
}
...
...
@@ -57,9 +57,10 @@ func GetLiveInfos(c *gin.Context) {
}
status
:=
com
.
StrTo
(
c
.
DefaultQuery
(
"status"
,
"0"
))
.
MustUint8
()
live_status
:=
com
.
StrTo
(
c
.
DefaultQuery
(
"live_status"
,
"0"
))
.
MustUint8
()
infoService
:=
live_info_service
.
LiveInfo
{
Status
:
status
,
LiveStatus
:
live_status
,
PlatformId
:
int64
(
platform_id
),
PageNum
:
util
.
GetPage
(
c
),
PageSize
:
util
.
GetLimit
(
c
),
...
...
service/live_info_service/live_info.go
View file @
8ea05fb5
...
...
@@ -16,6 +16,7 @@ type LiveInfo struct {
ApplyId
uint32
ApplyName
string
Status
uint8
LiveStatus
uint8
Sort
uint8
PlatformId
int64
OrderSn
int64
...
...
@@ -140,5 +141,9 @@ func (l *LiveInfo) getMaps() (map[string]interface{}) {
maps
[
"status"
]
=
l
.
Status
}
if
l
.
LiveStatus
!=
0
{
maps
[
"live_status"
]
=
l
.
LiveStatus
}
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