feat 删除-拦截器取usn
This commit is contained in:
@@ -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)
|
||||
},
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user