merge resmgr
This commit is contained in:
commit
269a83cc5a
@ -94,8 +94,7 @@ define('EQUIPREWARD_PARAMETER', 152); //结算比例
|
||||
define('DIAMONDTOCOIN_NUM', 153); //钻石换金币
|
||||
require 'config_loader.php';
|
||||
|
||||
function needSpecConfig($channel)
|
||||
function getConfigBaseDir()
|
||||
{
|
||||
return $channel == 6001;
|
||||
return '../res/';
|
||||
}
|
||||
|
||||
|
37
webapp/controller/UnitTestController.class.php
Normal file
37
webapp/controller/UnitTestController.class.php
Normal file
@ -0,0 +1,37 @@
|
||||
<?php
|
||||
|
||||
class UnitTestController
|
||||
{
|
||||
function __construct()
|
||||
{
|
||||
if (SERVER_ENV == _ONLINE) {
|
||||
die("can't create UnitTestController");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
public function getEquipConf()
|
||||
{
|
||||
require_once 'metatable/equip.php';
|
||||
echo json_encode(metatable\getEquipConf());
|
||||
}
|
||||
|
||||
public function getEquipById()
|
||||
{
|
||||
require_once 'metatable/equip.php';
|
||||
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']));
|
||||
}
|
||||
|
||||
}
|
38
webapp/metatable/equip.php
Normal file
38
webapp/metatable/equip.php
Normal file
@ -0,0 +1,38 @@
|
||||
<?php
|
||||
|
||||
namespace metatable;
|
||||
|
||||
use phpcommon;
|
||||
|
||||
/*
|
||||
配置表规范
|
||||
getXXXConf:获取表所有数据
|
||||
getXxxById():通过id获取单个数据
|
||||
_internalGetXXXConf:获取表所有数据内部实现不对外开放
|
||||
|
||||
使用方式
|
||||
require_once 'metatable/XXXX.php';
|
||||
|
||||
!!!注意必须使用require_once
|
||||
*/
|
||||
|
||||
function getEquipConf()
|
||||
{
|
||||
return _internalGetEquipConf();
|
||||
}
|
||||
|
||||
function getEquipById($equip_id)
|
||||
{
|
||||
$conf = getEquipConf();
|
||||
$equip_id = (int)$equip_id;
|
||||
return array_key_exists($equip_id, $conf) ? $conf[$equip_id] : null;
|
||||
}
|
||||
|
||||
function _internalGetEquipConf()
|
||||
{
|
||||
global $g_equip_table;
|
||||
if (!$g_equip_table) {
|
||||
$g_equip_table = require(getConfigBaseDir() . 'equip@equip.php');
|
||||
}
|
||||
return $g_equip_table;
|
||||
}
|
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