Initial import from local backup (Documents-Playground/pakerpale)
This commit is contained in:
54
application/controllers/api/radio.php
Normal file
54
application/controllers/api/radio.php
Normal file
@@ -0,0 +1,54 @@
|
||||
<?php defined('BASEPATH') or exit('No direct script access allowed');
|
||||
|
||||
require APPPATH . '/libraries/REST_Controller.php';
|
||||
|
||||
class Radio extends REST_Controller
|
||||
{
|
||||
private $tokenChecked;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->load->library('RadioService', array(), 'radioService');
|
||||
$this->tokenChecked = $this->radioService->checkToken();
|
||||
}
|
||||
|
||||
public function index_get()
|
||||
{
|
||||
echo 'Invalid Access';
|
||||
}
|
||||
|
||||
public function schedule_get()
|
||||
{
|
||||
if (is_null($this->tokenChecked)) {
|
||||
$this->res(200, 'Success', $this->radioService->getSchedule($this->get('categoryId'), $this->get('day')));
|
||||
} else if ($this->tokenChecked == 402) {
|
||||
$this->res(402, 'Token expired');
|
||||
} else if ($this->tokenChecked == 401){
|
||||
$this->res(401, 'error');
|
||||
}
|
||||
}
|
||||
|
||||
public function category_get()
|
||||
{
|
||||
if (is_null($this->tokenChecked)) {
|
||||
$this->res(200, 'Success', $this->radioService->getCategory($this->radioService->getAppId($this->get('appId'))));
|
||||
} else if ($this->tokenChecked == 402) {
|
||||
$this->res(402, 'Token expired');
|
||||
} else if ($this->tokenChecked == 401){
|
||||
$this->res(401, 'error');
|
||||
}
|
||||
}
|
||||
|
||||
public function app_get()
|
||||
{
|
||||
if (is_null($this->tokenChecked)) {
|
||||
$this->res(200, 'Success', $this->radioService->getApp($this->radioService->getAppId($this->get('appId'))));
|
||||
} else if ($this->tokenChecked == 402) {
|
||||
$this->res(402, 'Token expired');
|
||||
} else if ($this->tokenChecked == 401){
|
||||
$this->res(401, 'error');
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user