diff --git a/domain/service/event_s/event_init.go b/domain/service/event_s/event_init.go index a1009d71d01582114620c896e1acce7ab421336e..c5b10091733217a9411a3a50c4d7fba3b9cb8c78 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 44d043f8dbec96a63044f2879a0b9ce31c4d60c3..0b8f25c8192fe387210184eab723315338d13d21 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 }