From 0411e76f29a5fa596e37e783e28e5995671c766a Mon Sep 17 00:00:00 2001 From: hujiebin Date: Thu, 16 Mar 2023 14:41:21 +0800 Subject: [PATCH] =?UTF-8?q?fix:=E7=A7=BB=E5=8A=A8=E4=B8=80=E4=B8=8B?= =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E7=94=A8=E6=88=B7=E5=A4=A9=E4=B8=8A=E9=BA=A6?= =?UTF-8?q?=E6=97=B6=E9=95=BF=E4=BD=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- domain/service/event_s/event_init.go | 16 +++++++++++++++- domain/service/group_mic_s/group_mic.go | 5 ----- 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/domain/service/event_s/event_init.go b/domain/service/event_s/event_init.go index a1009d7..c5b1009 100644 --- a/domain/service/event_s/event_init.go +++ b/domain/service/event_s/event_init.go @@ -17,6 +17,7 @@ import ( "hilo-group/domain/model/diamond_m" "hilo-group/domain/model/groupPower_m" "hilo-group/domain/model/group_m" + "hilo-group/domain/model/mic_m" "hilo-group/domain/model/msg_m" "hilo-group/domain/model/task_m" "hilo-group/domain/model/user_m" @@ -521,5 +522,18 @@ func OnMic() { } return nil }) - + // 用户上麦时长 + mic_ev.AddOnMicEventAsync(func(model *domain.Model, e interface{}) error { + event, ok := e.(*mic_ev.OnMicEvent) + if !ok { + model.Log.Errorf("AddOnMicEventSync event type err") + return nil + } + if err := mic_m.IncrUserOnMic(model, event.UserId, event.Timestamp); err != nil { + model.Log.Errorf("cron micIn IncrUserOnMic err:%v", err) + } else { + model.Log.Infof("cron micIn IncrUserOnMic success,userId:%v", event.UserId) + } + return nil + }) } diff --git a/domain/service/group_mic_s/group_mic.go b/domain/service/group_mic_s/group_mic.go index 44d043f..0b8f25c 100644 --- a/domain/service/group_mic_s/group_mic.go +++ b/domain/service/group_mic_s/group_mic.go @@ -12,7 +12,6 @@ import ( "hilo-group/domain/event/group_ev" "hilo-group/domain/model/groupPower_m" "hilo-group/domain/model/group_m" - "hilo-group/domain/model/mic_m" "hilo-group/domain/service/signal_s" "hilo-group/myerr" "hilo-group/myerr/bizerr" @@ -323,9 +322,5 @@ func (s *GroupMicService) IncrGroupPowerOnMicExpAndTime(groupId string, userId u if err := groupPower_m.IncrGroupPowerStarOnMic(model, groupPowerId, userId, joinMicTimestamp); err != nil { model.Log.Errorf("IncrGroupPowerOnMicTime fail:%v", err) } - // 增加用户天上麦时长 - if err := mic_m.IncrUserOnMic(model, userId, joinMicTimestamp); err != nil { - model.Log.Errorf("IncrUserOnMic fail:%v", err) - } return nil } -- 2.22.0