From 3f10ab9330c423253eda3b742a3efdecd1d2d62d Mon Sep 17 00:00:00 2001 From: Leufolium Date: Tue, 15 Oct 2024 18:07:47 +0800 Subject: [PATCH] by Robin at 20241015 --- app/mix/cmd_offline/main.go | 1 + app/mix/service/logic/notif_bcst_center.go | 1 + app/mix/service/notification_center.go | 51 ++++++++++++++++++++++ 3 files changed, 53 insertions(+) create mode 100644 app/mix/service/logic/notif_bcst_center.go create mode 100644 app/mix/service/notification_center.go diff --git a/app/mix/cmd_offline/main.go b/app/mix/cmd_offline/main.go index efb4a8c0..9fd50691 100644 --- a/app/mix/cmd_offline/main.go +++ b/app/mix/cmd_offline/main.go @@ -79,6 +79,7 @@ func main() { service.DefaultTextAuditTaskResultHandler = service.NewTextAuditTaskResultHandler() service.DefaultVideoModerationTaskResultHandler = service.NewVideoModerationTaskResultHandler() service.DefaultStreamerRecommService = service.NewStreamerRecommService() + service.DefaultNotifBcstCenter = service.NewNotifBcstCenter() err = service.DefaultService.Init(cfg) if err != nil { msg := fmt.Sprintf("Service init fail, err: %v", err) diff --git a/app/mix/service/logic/notif_bcst_center.go b/app/mix/service/logic/notif_bcst_center.go new file mode 100644 index 00000000..4c79103d --- /dev/null +++ b/app/mix/service/logic/notif_bcst_center.go @@ -0,0 +1 @@ +package logic diff --git a/app/mix/service/notification_center.go b/app/mix/service/notification_center.go new file mode 100644 index 00000000..0bf9b216 --- /dev/null +++ b/app/mix/service/notification_center.go @@ -0,0 +1,51 @@ +package service + +var DefaultNotifBcstCenter *NotifBcstCenter + +// 全局广播消息中心 +type NotifBcstCenter struct{} + +func NewNotifBcstCenter() *NotifBcstCenter { + return new(NotifBcstCenter) +} + +// 获取主播全局广播消息中心版本号 +func (s *NotifBcstCenter) GetStreamerNotifBcstCenterVers() (int64, error) { + +} + +// 获取用户全局消息中心版本号 +func (s *NotifBcstCenter) GetUserNotifBcstCenterVers() (int64, error) { + +} + +// 写入一条主播全局广播消息 +func (s *NotifBcstCenter) BcstANotifToAllStreamers() error { + +} + +// 写入一条用户全局广播消息 +func (s *NotifBcstCenter) BcstANotifToAllUsers() error { + +} + +// 写入一条主播和用户全局广播消息 +func (s *NotifBcstCenter) BcstANotifToAllStreamersAndUsers() error { + +} + +// 主播获取全局广播消息 +func (s *NotifBcstCenter) ReceiveAllBcstedNotifsAsStreamer(mid int64) error { + // 获取该主播已接收的全局广播版本号 + + // 获取当前主播全局广播的版本号 + + // 如果版本号一致,则认为无需再接收新的广播 + + // 如果版本号不一致看,则接收新广播的消息 +} + +// 用户获取全局广播消息 +func (s *NotifBcstCenter) ReceiveAllBcstedNotifsAsUser(mid int64) error { + +}