Skip to content

Commit

Permalink
delete authVerifyFunc params
Browse files Browse the repository at this point in the history
  • Loading branch information
lobtao committed Jan 14, 2022
1 parent 479b12f commit 5caf480
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions src/BaseRpc.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,12 @@ class BaseRpc
* @param $namespace
* @param $func
* @param $args
* @param null $authVerify
* @param null $outMakeInstance
* @param null $authVerifyFunc
* @param null $outMakeInstanceFunc
* @return mixed
* @throws RpcException
*/
public function handle($namespace, $func, $args, $authVerify = null, $outMakeInstance = null)
public function handle($namespace, $func, $args, $authVerifyFunc = null, $outMakeInstanceFunc = null)
{
$this->namespace = $namespace;
$this->func = $func;
Expand All @@ -43,23 +43,23 @@ public function handle($namespace, $func, $args, $authVerify = null, $outMakeIns
}

// 权限等验证过滤处理
if (isset($authVerify)) {
call_user_func_array($authVerify, [$this->func, $this->args]);
if (isset($authVerifyFunc)) {
$authVerifyFunc();
}

return $this->invokeFunc($this->func, $this->args, $outMakeInstance);
return $this->invokeFunc($this->func, $this->args, $outMakeInstanceFunc);
}

/**
* 以‘_’来分割ajax传递过来的类名和方法名,调用该方法,并返回值
*
* @param $func
* @param $args
* @param null $outMakeInstance
* @param null $outMakeInstanceFunc
* @return mixed
* @throws RpcException
*/
protected function invokeFunc($func, $args, $outMakeInstance = null)
protected function invokeFunc($func, $args, $outMakeInstanceFunc = null)
{
$params = explode('_', $func, 2);
if (count($params) != 2) throw new RpcException($this->ERR_MSG_METHOD_FORMAT_ERROR);
Expand All @@ -69,8 +69,8 @@ protected function invokeFunc($func, $args, $outMakeInstance = null)
$funcName = $params[1];
if (!class_exists($className)) throw new RpcException(sprintf($this->ERR_MSG_CLASS_NOT_FOUND, $className));

if (isset($outMakeInstance)) {
$object = $outMakeInstance($className);
if (isset($outMakeInstanceFunc)) {
$object = $outMakeInstanceFunc($className);
} else {
$object = new $className();
}
Expand Down

0 comments on commit 5caf480

Please sign in to comment.