+ Add configurations of api.
This commit is contained in:
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
/**
|
||||
* 禅道API的config资源类
|
||||
* 版本V1
|
||||
*
|
||||
* The config entry point of zentaopms
|
||||
* Version 1
|
||||
*/
|
||||
class configEntry extends entry
|
||||
{
|
||||
public function get($name)
|
||||
{
|
||||
$config = array('name' => $name);
|
||||
|
||||
switch($name)
|
||||
{
|
||||
case 'language':
|
||||
$config['value'] = $this->config->default->lang;
|
||||
break;
|
||||
case 'version':
|
||||
$config['value'] = $this->config->version;
|
||||
break;
|
||||
case 'charset':
|
||||
$config['value'] = $this->config->charset;
|
||||
break;
|
||||
case 'timezone':
|
||||
$config['value'] = $this->config->timezone;
|
||||
break;
|
||||
default:
|
||||
$this->sendError(400, 'No configuration.');
|
||||
return;
|
||||
}
|
||||
|
||||
$this->send(200, $config);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
/**
|
||||
* 禅道API的configs资源类
|
||||
* 版本V1
|
||||
*
|
||||
* The configs entry point of zentaopms
|
||||
* Version 1
|
||||
*/
|
||||
class configsEntry extends entry
|
||||
{
|
||||
public function get()
|
||||
{
|
||||
$configs = array();
|
||||
|
||||
$configs[] = array('key' => 'language', 'value' => $this->config->default->lang);
|
||||
$configs[] = array('key' => 'version', 'value' => $this->config->version);
|
||||
$configs[] = array('key' => 'charset', 'value' => $this->config->charset);
|
||||
$configs[] = array('key' => 'timezone', 'value' => $this->config->timezone);
|
||||
|
||||
$this->send(200, $configs);
|
||||
}
|
||||
}
|
||||
@@ -6,6 +6,9 @@ $routes = array();
|
||||
|
||||
$routes['/tokens'] = 'tokens';
|
||||
|
||||
$routes['/configurations'] = 'configs';
|
||||
$routes['/configurations/:name'] = 'config';
|
||||
|
||||
$routes['/products'] = 'products';
|
||||
$routes['/products/:id'] = 'product';
|
||||
$routes['/productlines'] = 'productLines';
|
||||
|
||||
Reference in New Issue
Block a user