This commit is contained in:
2026-10-18 05:28:57 +07:00
parent bfd6841d7d
commit e96199afba
18 changed files with 2331 additions and 1193 deletions
+6 -3
View File
@@ -123,14 +123,17 @@ func (s *server) BindScreen(ctx context.Context, req *proto.BindScreenReq) (*pro
return nil, status.Error(codes.NotFound, "игра не найдена")
}
hash := hashScreenToken(req.AccessToken)
if err = s.screenService.Bind(ctx, id, int(req.GameID), hash); err != nil {
isNewBinding, err := s.screenService.Bind(ctx, id, int(req.GameID), hash, req.GetInitializeAudio())
if err != nil {
if errors.Is(err, screen_service.ErrScreenNotFound) {
return nil, status.Error(codes.Unauthenticated, "недействительная сессия экрана")
}
return nil, status.Error(codes.Internal, "не удалось привязать экран")
}
if err := s.screenPlanService.ApplyCurrent(ctx, int(req.GameID)); err != nil {
return nil, status.Error(codes.Internal, "не удалось применить план экранов")
if isNewBinding {
if err := s.screenPlanService.ApplyCurrent(ctx, int(req.GameID), id); err != nil {
return nil, status.Error(codes.Internal, "не удалось применить план экранов")
}
}
session, err := s.screenService.Get(ctx, id, hash)
if err != nil {