Исправил ошибки по АПИ

This commit is contained in:
Krivchikov Dmitry 2016-04-24 10:41:52 +03:00
parent 6830695887
commit 280f0eb35c
1 changed files with 8 additions and 1 deletions

View File

@ -6,6 +6,12 @@ class ApiController extends Controller
static function actionIndex() static function actionIndex()
{ {
$request = json_decode(file_get_contents('php://input'), 1); $request = json_decode(file_get_contents('php://input'), 1);
// Отладка:
// $request = array('method' => 'categories');
// $request = array('method' => 'points');
// $request = array('method' => 'point', 'data' => array('id' => 124));
if (!is_array($request)) { if (!is_array($request)) {
self::error('Bad request!'); self::error('Bad request!');
} }
@ -74,7 +80,7 @@ class ApiController extends Controller
$point = Point::model()->getByPK($id); $point = Point::model()->getByPK($id);
if (!$point) { if (!$point->id) {
self::error('Unknown point!'); self::error('Unknown point!');
} }
@ -147,5 +153,6 @@ class ApiController extends Controller
} }
self::renderPartial('json.php', array('data' => $answer)); self::renderPartial('json.php', array('data' => $answer));
die;
} }
} }