From 1934debdb21b5fbe5500f14d8db4d3e5d08f423f Mon Sep 17 00:00:00 2001 From: aozhiwei Date: Mon, 17 Aug 2020 13:45:30 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E9=85=8D=E7=BD=AE?= =?UTF-8?q?=E8=A1=A8=E8=AF=BB=E5=8F=96=E7=A4=BA=E4=BE=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- webapp/bootstrap/init.php | 5 +-- .../controller/UnitTestController.class.php | 25 +++++++++++ webapp/metatable/equip.php | 42 +++++++++++++++++++ 3 files changed, 69 insertions(+), 3 deletions(-) create mode 100644 webapp/controller/UnitTestController.class.php create mode 100644 webapp/metatable/equip.php diff --git a/webapp/bootstrap/init.php b/webapp/bootstrap/init.php index dd88b9d..1e02ee2 100644 --- a/webapp/bootstrap/init.php +++ b/webapp/bootstrap/init.php @@ -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/'; } - diff --git a/webapp/controller/UnitTestController.class.php b/webapp/controller/UnitTestController.class.php new file mode 100644 index 0000000..0f28385 --- /dev/null +++ b/webapp/controller/UnitTestController.class.php @@ -0,0 +1,25 @@ + Date: Mon, 17 Aug 2020 14:09:39 +0800 Subject: [PATCH 2/2] 1 --- .../controller/UnitTestController.class.php | 12 ++++++ webapp/metatable/equip.php | 8 +--- webapp/metatable/parameter.php | 37 +++++++++++++++++++ 3 files changed, 51 insertions(+), 6 deletions(-) create mode 100644 webapp/metatable/parameter.php diff --git a/webapp/controller/UnitTestController.class.php b/webapp/controller/UnitTestController.class.php index 0f28385..5f14315 100644 --- a/webapp/controller/UnitTestController.class.php +++ b/webapp/controller/UnitTestController.class.php @@ -22,4 +22,16 @@ class UnitTestController 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'])); + } + } diff --git a/webapp/metatable/equip.php b/webapp/metatable/equip.php index 84c5555..a6822a8 100644 --- a/webapp/metatable/equip.php +++ b/webapp/metatable/equip.php @@ -23,13 +23,9 @@ function getEquipConf() function getEquipById($equip_id) { - return getEquipByIdEx(getEquipConf(), $equip_id); -} - -function getEquipByIdEx($equip_table, $equip_id) -{ + $conf = getEquipConf(); $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() diff --git a/webapp/metatable/parameter.php b/webapp/metatable/parameter.php new file mode 100644 index 0000000..f730816 --- /dev/null +++ b/webapp/metatable/parameter.php @@ -0,0 +1,37 @@ + $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; +}