@@ -17,12 +17,12 @@ class BaseRpc
17
17
* @param $namespace
18
18
* @param $func
19
19
* @param $args
20
- * @param null $authVerify
21
- * @param null $outMakeInstance
20
+ * @param null $authVerifyFunc
21
+ * @param null $outMakeInstanceFunc
22
22
* @return mixed
23
23
* @throws RpcException
24
24
*/
25
- public function handle ($ namespace , $ func , $ args , $ authVerify = null , $ outMakeInstance = null )
25
+ public function handle ($ namespace , $ func , $ args , $ authVerifyFunc = null , $ outMakeInstanceFunc = null )
26
26
{
27
27
$ this ->namespace = $ namespace ;
28
28
$ this ->func = $ func ;
@@ -43,23 +43,23 @@ public function handle($namespace, $func, $args, $authVerify = null, $outMakeIns
43
43
}
44
44
45
45
// 权限等验证过滤处理
46
- if (isset ($ authVerify )) {
47
- call_user_func_array ( $ authVerify , [ $ this -> func , $ this -> args ] );
46
+ if (isset ($ authVerifyFunc )) {
47
+ $ authVerifyFunc ( );
48
48
}
49
49
50
- return $ this ->invokeFunc ($ this ->func , $ this ->args , $ outMakeInstance );
50
+ return $ this ->invokeFunc ($ this ->func , $ this ->args , $ outMakeInstanceFunc );
51
51
}
52
52
53
53
/**
54
54
* 以‘_’来分割ajax传递过来的类名和方法名,调用该方法,并返回值
55
55
*
56
56
* @param $func
57
57
* @param $args
58
- * @param null $outMakeInstance
58
+ * @param null $outMakeInstanceFunc
59
59
* @return mixed
60
60
* @throws RpcException
61
61
*/
62
- protected function invokeFunc ($ func , $ args , $ outMakeInstance = null )
62
+ protected function invokeFunc ($ func , $ args , $ outMakeInstanceFunc = null )
63
63
{
64
64
$ params = explode ('_ ' , $ func , 2 );
65
65
if (count ($ params ) != 2 ) throw new RpcException ($ this ->ERR_MSG_METHOD_FORMAT_ERROR );
@@ -69,8 +69,8 @@ protected function invokeFunc($func, $args, $outMakeInstance = null)
69
69
$ funcName = $ params [1 ];
70
70
if (!class_exists ($ className )) throw new RpcException (sprintf ($ this ->ERR_MSG_CLASS_NOT_FOUND , $ className ));
71
71
72
- if (isset ($ outMakeInstance )) {
73
- $ object = $ outMakeInstance ($ className );
72
+ if (isset ($ outMakeInstanceFunc )) {
73
+ $ object = $ outMakeInstanceFunc ($ className );
74
74
} else {
75
75
$ object = new $ className ();
76
76
}
0 commit comments