feat 删除-拦截器取usn

This commit is contained in:
2026-01-14 18:09:22 +08:00
parent a2025e8901
commit 695f5e7b04
2 changed files with 121 additions and 100 deletions

View File

@@ -5,7 +5,6 @@ import (
"fmt"
"git.hlsq.asia/mmorpg/service-common/discover"
"git.hlsq.asia/mmorpg/service-common/log"
"git.hlsq.asia/mmorpg/service-common/net/http/http_resp"
"git.hlsq.asia/mmorpg/service-common/utils"
"google.golang.org/grpc"
"google.golang.org/grpc/codes"
@@ -53,16 +52,10 @@ func (s *Base) Init(addr string, port int32) {
func(ctx context.Context, req interface{}, info *grpc.UnaryServerInfo, handler grpc.UnaryHandler) (resp interface{}, err error) {
defer func() {
if r := recover(); r != nil {
log.Errorf("server Panic: %v", r)
log.Errorf("service Panic: %v", r)
err = status.Error(codes.Internal, fmt.Sprintf("%v", r))
}
}()
if usnReq, ok := req.(interface{ GetUSN() string }); ok {
usn := usnReq.GetUSN()
if !utils.ShouldBindUsn(ctx, &usn) {
return nil, http_resp.ParamError
}
}
return handler(ctx, req)
},
),