ADD method API-location

This commit is contained in:
Krivchikov Dmitry 2016-04-24 12:35:56 +03:00
parent eb9569b143
commit 1c9913b7c0
1 changed files with 9 additions and 0 deletions

View File

@ -9,6 +9,7 @@ class ApiController extends Controller
// Отладка: // Отладка:
// $request = array('method' => 'categories'); // $request = array('method' => 'categories');
// $request = array('method' => 'location');
// $request = array('method' => 'points'); // $request = array('method' => 'points');
// $request = array('method' => 'point', 'data' => array('id' => 124)); // $request = array('method' => 'point', 'data' => array('id' => 124));
@ -33,6 +34,9 @@ class ApiController extends Controller
case 'point': case 'point':
$answer = self::getPoint($data); $answer = self::getPoint($data);
break; break;
case 'location':
$answer = self::getLocation();
break;
default: default:
self::error('Unknown method!'); self::error('Unknown method!');
break; break;
@ -149,6 +153,11 @@ class ApiController extends Controller
return array('status' => 'success','data' => $categories); return array('status' => 'success','data' => $categories);
} }
static private function getLocation()
{
return array('status' => 'success','data' => App::$userGeo);
}
static private function error($message = FALSE) static private function error($message = FALSE)
{ {
$answer = array('status' => 'error'); $answer = array('status' => 'error');