85 lines
2.2 KiB
PHP
85 lines
2.2 KiB
PHP
|
|
<?php
|
||
|
|
|
||
|
|
class FrameController extends BaseController {
|
||
|
|
|
||
|
|
public $model = null;
|
||
|
|
|
||
|
|
public function __construct() {
|
||
|
|
parent::__construct();
|
||
|
|
$this->model = new FrameModel();
|
||
|
|
}
|
||
|
|
|
||
|
|
public function addFrame() {
|
||
|
|
$insert_data = (array)$this->post;
|
||
|
|
$result = $this->model->addFrame($insert_data);
|
||
|
|
|
||
|
|
if ($result) {
|
||
|
|
return $this->response(['message' => 'success']);
|
||
|
|
} else {
|
||
|
|
return $this->response(['message' => 'error']);
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
public function getFrame($id) {
|
||
|
|
$params = $id;
|
||
|
|
|
||
|
|
$frame = $this->model->getFrame($params, $this->query);
|
||
|
|
if ($frame == 'ended') {
|
||
|
|
return $this->response(['message' => 'Время истекло'], false);
|
||
|
|
}
|
||
|
|
// var_dump($frame);die;
|
||
|
|
return $this->response($frame);
|
||
|
|
}
|
||
|
|
|
||
|
|
public function getMainColor($params) {
|
||
|
|
$result = $this->model->getMainColor($params);
|
||
|
|
|
||
|
|
if ($result) {
|
||
|
|
return $this->response($result);
|
||
|
|
} else {
|
||
|
|
return $this->response(['message' => 'error']);
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
public function addRequest() {
|
||
|
|
$insert_data = (array)$this->post;
|
||
|
|
$result = $this->model->addRequest($insert_data);
|
||
|
|
|
||
|
|
if ($result) {
|
||
|
|
return $this->response(['message' => 'success']);
|
||
|
|
} else {
|
||
|
|
return $this->response(['message' => 'error']);
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
public function getBlock($params) {
|
||
|
|
$query = (array)$this->query;
|
||
|
|
$result = $this->model->getBlock($params, $query);
|
||
|
|
|
||
|
|
if ($result) {
|
||
|
|
return $this->response($result);
|
||
|
|
} else {
|
||
|
|
return $this->response(['message' => 'error']);
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
public function getDeadlines($params) {
|
||
|
|
$blockId = isset($params['blockId']) ? intval(self::clearInput($params['blockId'])) : null;
|
||
|
|
$result = $this->model->getDeadlines(self::clearInput($params['token']), $blockId);
|
||
|
|
|
||
|
|
if ($result) {
|
||
|
|
return $this->response($result);
|
||
|
|
} else {
|
||
|
|
return $this->response(['message' => 'error']);
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
public function getMapBlocks($id) {
|
||
|
|
$params = $id;
|
||
|
|
|
||
|
|
$frame = $this->model->getMapBlocks($params, $this->query);
|
||
|
|
|
||
|
|
return $this->response($frame);
|
||
|
|
}
|
||
|
|
}
|