Browse Source

fix: 修复调用参数绑定问题

base-server
lorik 3 years ago
parent
commit
568628de11
  1. 5
      src/Controller.php
  2. 2
      src/RpcServer.php

5
src/Controller.php

@ -3,6 +3,11 @@ namespace blobt\airpc;
class Controller extends \yii\base\Controller class Controller extends \yii\base\Controller
{ {
public function bindActionParams($action, $params)
{
return $params;
}
public function afterAction($action, $result) public function afterAction($action, $result)
{ {
$result = parent::afterAction($action, $result); $result = parent::afterAction($action, $result);

2
src/RpcServer.php

@ -63,7 +63,7 @@ class RpcServer extends BaseService {
$className = 'rpc\\controllers\\'.ucfirst($data['controller']).'Controller'; $className = 'rpc\\controllers\\'.ucfirst($data['controller']).'Controller';
if( class_exists($className) && method_exists($className,'action'.ucfirst($data['method'])) ) { if( class_exists($className) && method_exists($className,'action'.ucfirst($data['method'])) ) {
$obj = new $className($data['controller'],Yii::$app); $obj = new $className($data['controller'],Yii::$app);
return $obj->runAction($data['method'],$data['data']);
return $obj->runAction($data['method'],['params'=>$data['params']]);
}else }else
throw new NotFoundRpcException('the rpc handler undefined or can not callout the method'); throw new NotFoundRpcException('the rpc handler undefined or can not callout the method');
}else }else

Loading…
Cancel
Save