1
This commit is contained in:
parent
cdb8e9206e
commit
e6ff8b6031
@ -22,6 +22,12 @@ function autoload_controller__($classname)
|
|||||||
}
|
}
|
||||||
spl_autoload_register('autoload_controller__');
|
spl_autoload_register('autoload_controller__');
|
||||||
|
|
||||||
|
function isValidActionAction($a, $method) {
|
||||||
|
return $method && $method->isPublic() &&
|
||||||
|
$a[0] != '_' &&
|
||||||
|
(!$method->isConstructor() && !$method->isDestructor());
|
||||||
|
}
|
||||||
|
|
||||||
try{
|
try{
|
||||||
$c = $_REQUEST['c'];
|
$c = $_REQUEST['c'];
|
||||||
$a = $_REQUEST['a'];
|
$a = $_REQUEST['a'];
|
||||||
@ -37,12 +43,19 @@ try{
|
|||||||
$beginTick = phpcommon\getTickCount();
|
$beginTick = phpcommon\getTickCount();
|
||||||
$obj = eval('return new $classname();');
|
$obj = eval('return new $classname();');
|
||||||
$method = new ReflectionMethod($classname, $a);
|
$method = new ReflectionMethod($classname, $a);
|
||||||
if ($method && $method->isPublic() &&
|
$methodS = new ReflectionMethod($classname, $a . 'S');
|
||||||
$a[0] != '_' &&
|
if (isValidActionAction($a, $method)) {
|
||||||
(!$method->isConstructor() && !$method->isDestructor())) {
|
|
||||||
$obj->_handlePre();
|
$obj->_handlePre();
|
||||||
$method->invoke($obj);
|
$method->invoke($obj);
|
||||||
$obj->_handlePost();
|
$obj->_handlePost();
|
||||||
|
} else if (isValidActionAction($a, $methodS)) {
|
||||||
|
//如果原版函数不存在并且S版函数存在,则自动切换为S版
|
||||||
|
echo json_encode(array(
|
||||||
|
'errcode' => 1006,
|
||||||
|
'errmsg' => 'already upgrade to safe api',
|
||||||
|
'payload' => 1,
|
||||||
|
));
|
||||||
|
die();
|
||||||
}
|
}
|
||||||
} catch (Exception $e){
|
} catch (Exception $e){
|
||||||
error_log($e);
|
error_log($e);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user