1
This commit is contained in:
parent
1934debdb2
commit
c68917dc35
@ -22,4 +22,16 @@ class UnitTestController
|
|||||||
echo json_encode(metatable\getEquipById($_REQUEST['equip_id']));
|
echo json_encode(metatable\getEquipById($_REQUEST['equip_id']));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getParameterConf()
|
||||||
|
{
|
||||||
|
require_once 'metatable/parameter.php';
|
||||||
|
echo json_encode(metatable\getParameterConf());
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getParameterByName()
|
||||||
|
{
|
||||||
|
require_once 'metatable/parameter.php';
|
||||||
|
echo json_encode(metatable\getParameterByName($_REQUEST['param_name']));
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -23,13 +23,9 @@ function getEquipConf()
|
|||||||
|
|
||||||
function getEquipById($equip_id)
|
function getEquipById($equip_id)
|
||||||
{
|
{
|
||||||
return getEquipByIdEx(getEquipConf(), $equip_id);
|
$conf = getEquipConf();
|
||||||
}
|
|
||||||
|
|
||||||
function getEquipByIdEx($equip_table, $equip_id)
|
|
||||||
{
|
|
||||||
$equip_id = (int)$equip_id;
|
$equip_id = (int)$equip_id;
|
||||||
return array_key_exists($equip_id, $equip_table) ? $equip_table[$equip_id] : null;
|
return array_key_exists($equip_id, $conf) ? $conf[$equip_id] : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
function _internalGetEquipConf()
|
function _internalGetEquipConf()
|
||||||
|
37
webapp/metatable/parameter.php
Normal file
37
webapp/metatable/parameter.php
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace metatable;
|
||||||
|
|
||||||
|
use phpcommon;
|
||||||
|
|
||||||
|
function getParameterConf()
|
||||||
|
{
|
||||||
|
return _internalGetParameterConf();
|
||||||
|
}
|
||||||
|
|
||||||
|
function getParameterById($param_id)
|
||||||
|
{
|
||||||
|
$conf = getParameterConf();
|
||||||
|
$parameter_id = (int)$parameter_id;
|
||||||
|
return array_key_exists($parameter_id, $conf) ? $conf[$parameter_id] : null;
|
||||||
|
}
|
||||||
|
|
||||||
|
function getParameterByName($param_name)
|
||||||
|
{
|
||||||
|
$conf = getParameterConf();
|
||||||
|
foreach ($conf as $key => $val) {
|
||||||
|
if ($val['param_name'] == $param_name) {
|
||||||
|
return $val;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
function _internalGetParameterConf()
|
||||||
|
{
|
||||||
|
global $g_parameter_table;
|
||||||
|
if (!$g_parameter_table) {
|
||||||
|
$g_parameter_table = require(getConfigBaseDir() . 'parameter@parameter.php');
|
||||||
|
}
|
||||||
|
return $g_parameter_table;
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user