+ Add configurations of api.

This commit is contained in:
zhujinyong
2021-08-23 17:03:00 +08:00
parent 2e2af2560b
commit 1e019a9e25
3 changed files with 61 additions and 0 deletions
+36
View File
@@ -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);
}
}
+22
View File
@@ -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);
}
}
+3
View File
@@ -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';