Files
bd2/go/internal/server/session/observer.go
T
Flechazo aec053f7d2 fix(server): restore achievements, progress, claims and experience
Load ordinary achievements and send transactional gameplay progress notifications.
Restore main-story clears and recorded gacha history without duplicate credit.
Validate claim thresholds and prior tiers, credit wallet rewards and persist
achievement experience in login responses.
2026-10-04 19:54:26 +08:00

25 lines
722 B
Go

package session
import "fmt"
func (s *Server) dispatchObserved(path string, request []byte) (int, []byte, []byte, error) {
for _, observer := range s.observers {
if err := observer.BeforeDispatch(path, request); err != nil {
return 0, nil, nil, fmt.Errorf("%s before response observation: %w", path, err)
}
}
code, response, err := s.dispatch(path, request)
if err != nil {
return 0, nil, nil, err
}
var notify []byte
for _, observer := range s.observers {
fields, err := observer.AfterDispatch(path, request, response)
if err != nil {
return 0, nil, nil, fmt.Errorf("%s after response observation: %w", path, err)
}
notify = append(notify, fields...)
}
return code, response, notify, nil
}