diff --git a/domain/model/mic_m/mic.go b/domain/model/mic_m/mic.go index 9289e98dc82a63da9185e3bee5b4945bd342f934..8f6d143a7813f8b865c9d239e7c9c5c9a7d02eca 100644 --- a/domain/model/mic_m/mic.go +++ b/domain/model/mic_m/mic.go @@ -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 }