Исправил ошибки по АПИ
This commit is contained in:
parent
6830695887
commit
280f0eb35c
|
|
@ -6,6 +6,12 @@ class ApiController extends Controller
|
|||
static function actionIndex()
|
||||
{
|
||||
$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)) {
|
||||
self::error('Bad request!');
|
||||
}
|
||||
|
|
@ -74,7 +80,7 @@ class ApiController extends Controller
|
|||
|
||||
$point = Point::model()->getByPK($id);
|
||||
|
||||
if (!$point) {
|
||||
if (!$point->id) {
|
||||
self::error('Unknown point!');
|
||||
}
|
||||
|
||||
|
|
@ -147,5 +153,6 @@ class ApiController extends Controller
|
|||
}
|
||||
|
||||
self::renderPartial('json.php', array('data' => $answer));
|
||||
die;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue