支持自定义日志,优化数据返回

This commit is contained in:
duanhf2012
2020-03-31 18:29:00 +08:00
parent 9e74d2bf2a
commit 5344da1276
5 changed files with 50 additions and 33 deletions

View File

@@ -179,13 +179,16 @@ func (slf *RpcHandler) HandlerRpcRequest(request *RpcRequest) {
v.iparam = request.localParam
}
var oParam reflect.Value
paramList = append(paramList,reflect.ValueOf(slf.GetRpcHandler())) //接受者
if request.localReply!=nil {
v.oParam = reflect.ValueOf(request.localReply)
oParam = reflect.ValueOf(request.localReply)
}else{
oParam = reflect.New(v.oParam.Type().Elem())
}
paramList = append(paramList,reflect.ValueOf(v.iparam))
paramList = append(paramList,v.oParam) //输出参数
paramList = append(paramList,oParam) //输出参数
returnValues := v.method.Func.Call(paramList)
errInter := returnValues[0].Interface()
@@ -194,7 +197,7 @@ func (slf *RpcHandler) HandlerRpcRequest(request *RpcRequest) {
}
if request.requestHandle!=nil {
request.requestHandle(v.oParam.Interface(), err)
request.requestHandle(oParam.Interface(), err)
}
}