Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
H
hilo-group
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
hujiebin
hilo-group
Commits
4db784cf
Commit
4db784cf
authored
Mar 16, 2023
by
hujiebin
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'feature/family' into feature/3.5
parents
37399b00
99ef0fec
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
4 deletions
+4
-4
mic.go
domain/model/mic_m/mic.go
+4
-4
No files found.
domain/model/mic_m/mic.go
View file @
4db784cf
...
@@ -11,7 +11,7 @@ import (
...
@@ -11,7 +11,7 @@ import (
// 用户上麦
// 用户上麦
type
UserOnMic
struct
{
type
UserOnMic
struct
{
Da
y
string
Da
te
string
UserId
mysql
.
ID
UserId
mysql
.
ID
Seconds
mysql
.
Num
Seconds
mysql
.
Num
LastCalTs
int64
LastCalTs
int64
...
@@ -24,7 +24,7 @@ type UserOnMic struct {
...
@@ -24,7 +24,7 @@ type UserOnMic struct {
func
GetUserOnMic
(
model
*
domain
.
Model
,
userId
mysql
.
ID
)
(
*
UserOnMic
,
error
)
{
func
GetUserOnMic
(
model
*
domain
.
Model
,
userId
mysql
.
ID
)
(
*
UserOnMic
,
error
)
{
res
:=
new
(
UserOnMic
)
res
:=
new
(
UserOnMic
)
day
:=
time
.
Now
()
.
Format
(
"2006-01-02"
)
day
:=
time
.
Now
()
.
Format
(
"2006-01-02"
)
if
err
:=
model
.
DB
()
.
Where
(
"da
y
= ? AND user_id = ?"
,
day
,
userId
)
.
First
(
res
)
.
Error
;
err
!=
nil
{
if
err
:=
model
.
DB
()
.
Where
(
"da
te
= ? AND user_id = ?"
,
day
,
userId
)
.
First
(
res
)
.
Error
;
err
!=
nil
{
return
nil
,
err
return
nil
,
err
}
}
return
res
,
nil
return
res
,
nil
...
@@ -51,7 +51,7 @@ func IncrUserOnMic(model *domain.Model, userId mysql.ID, joinMicTimestamp int64)
...
@@ -51,7 +51,7 @@ func IncrUserOnMic(model *domain.Model, userId mysql.ID, joinMicTimestamp int64)
score
:=
nowTs
-
curTs
score
:=
nowTs
-
curTs
day
:=
time
.
Now
()
.
Format
(
"2006-01-02"
)
day
:=
time
.
Now
()
.
Format
(
"2006-01-02"
)
onMicNew
:=
&
UserOnMic
{
onMicNew
:=
&
UserOnMic
{
Da
y
:
day
,
Da
te
:
day
,
UserId
:
userId
,
UserId
:
userId
,
Seconds
:
mysql
.
Num
(
score
),
Seconds
:
mysql
.
Num
(
score
),
}
}
...
@@ -74,7 +74,7 @@ func IncrUserOnMic(model *domain.Model, userId mysql.ID, joinMicTimestamp int64)
...
@@ -74,7 +74,7 @@ func IncrUserOnMic(model *domain.Model, userId mysql.ID, joinMicTimestamp int64)
func
MGetUserOnMicSeconds
(
model
*
domain
.
Model
,
day
string
,
userIds
[]
uint64
)
(
map
[
mysql
.
ID
]
mysql
.
Num
,
error
)
{
func
MGetUserOnMicSeconds
(
model
*
domain
.
Model
,
day
string
,
userIds
[]
uint64
)
(
map
[
mysql
.
ID
]
mysql
.
Num
,
error
)
{
var
rows
[]
UserOnMic
var
rows
[]
UserOnMic
res
:=
make
(
map
[
mysql
.
ID
]
mysql
.
Num
)
res
:=
make
(
map
[
mysql
.
ID
]
mysql
.
Num
)
if
err
:=
model
.
DB
()
.
Model
(
UserOnMic
{})
.
Where
(
"`da
y
`= ? AND user_id in ?"
,
day
,
userIds
)
.
Find
(
&
rows
)
.
Error
;
err
!=
nil
{
if
err
:=
model
.
DB
()
.
Model
(
UserOnMic
{})
.
Where
(
"`da
te
`= ? AND user_id in ?"
,
day
,
userIds
)
.
Find
(
&
rows
)
.
Error
;
err
!=
nil
{
model
.
Log
.
Errorf
(
"MGetUserOnMic fail:%v"
,
err
)
model
.
Log
.
Errorf
(
"MGetUserOnMic fail:%v"
,
err
)
return
res
,
err
return
res
,
err
}
}
...
...
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