From 99ef0fecfca5b4225170867fcfe7ba453c144a81 Mon Sep 17 00:00:00 2001 From: hujiebin Date: Thu, 16 Mar 2023 13:48:13 +0800 Subject: [PATCH] =?UTF-8?q?fix=EF=BC=9Aday->date?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- domain/model/mic_m/mic.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/domain/model/mic_m/mic.go b/domain/model/mic_m/mic.go index 9289e98..8f6d143 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 } -- 2.22.0