Commit 4db784cf authored by hujiebin's avatar hujiebin

Merge branch 'feature/family' into feature/3.5

parents 37399b00 99ef0fec
......@@ -11,7 +11,7 @@ import (
// 用户上麦
type UserOnMic struct {
Day string
Date string
UserId mysql.ID
Seconds mysql.Num
LastCalTs int64
......@@ -24,7 +24,7 @@ type UserOnMic struct {
func GetUserOnMic(model *domain.Model, userId mysql.ID) (*UserOnMic, error) {
res := new(UserOnMic)
day := time.Now().Format("2006-01-02")
if err := model.DB().Where("day = ? AND user_id = ?", day, userId).First(res).Error; err != nil {
if err := model.DB().Where("date = ? AND user_id = ?", day, userId).First(res).Error; err != nil {
return nil, err
}
return res, nil
......@@ -51,7 +51,7 @@ func IncrUserOnMic(model *domain.Model, userId mysql.ID, joinMicTimestamp int64)
score := nowTs - curTs
day := time.Now().Format("2006-01-02")
onMicNew := &UserOnMic{
Day: day,
Date: day,
UserId: userId,
Seconds: mysql.Num(score),
}
......@@ -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) {
var rows []UserOnMic
res := make(map[mysql.ID]mysql.Num)
if err := model.DB().Model(UserOnMic{}).Where("`day`= ? AND user_id in ?", day, userIds).Find(&rows).Error; err != nil {
if err := model.DB().Model(UserOnMic{}).Where("`date`= ? AND user_id in ?", day, userIds).Find(&rows).Error; err != nil {
model.Log.Errorf("MGetUserOnMic fail:%v", err)
return res, err
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment