diff --git a/rpc/rpchandler.go b/rpc/rpchandler.go index 0798f08..99d4801 100644 --- a/rpc/rpchandler.go +++ b/rpc/rpchandler.go @@ -134,25 +134,28 @@ func (slf *RpcHandler) suitableMethods(method reflect.Method) error { return fmt.Errorf("%s The return parameter must be of type error!",method.Name) } - if typ.NumIn() > 4 { - return fmt.Errorf("%s The number of input arguments must be 1!",method.Name) + if typ.NumIn() <3 || typ.NumIn() > 4 { + return fmt.Errorf("%s Unsupported parameter format!",method.Name) } - if slf.isExportedOrBuiltinType(typ.In(1)) == false || slf.isExportedOrBuiltinType(typ.In(2)) == false{ - return fmt.Errorf("%s Unsupported parameter types!",method.Name) + //1.判断第一个参数 + var parIdx int = 1 + if typ.In(parIdx).String() == "rpc.IRawAdditionParam" { + parIdx += 1 + rpcMethodInfo.hashAdditionParam = true } - parIdx := 1 - if typ.NumIn() == 4 { - if slf.isExportedOrBuiltinType(typ.In(3)) == false { + for i:= parIdx ;i