55 lines
1.1 KiB
PHP
55 lines
1.1 KiB
PHP
<?php
|
|
|
|
namespace metatable;
|
|
|
|
use phpcommon;
|
|
|
|
/*
|
|
配置表规范
|
|
getXXXConf:获取表所有数据
|
|
getXxxById():通过id获取单个数据
|
|
_internalGetXXXConf:获取表所有数据内部实现不对外开放
|
|
|
|
使用方式
|
|
require_once 'metatable/XXXX.php';
|
|
|
|
!!!注意必须使用require_once
|
|
*/
|
|
|
|
function getActPlusConf()
|
|
{
|
|
return _internalGetActPlusConf();
|
|
}
|
|
|
|
function getActPlusById($act_id)
|
|
{
|
|
$conf = getActPlusConf();
|
|
$act_id = (int)$act_id;
|
|
return array_key_exists($act_id, $conf) ? $conf[$act_id] : null;
|
|
}
|
|
|
|
function _internalGetActPlusConf()
|
|
{
|
|
global $g_act_table;
|
|
if (!$g_act_table) {
|
|
$g_act_table = require(getConfigBaseDir() . 'activityplus@activityplus.php');
|
|
}
|
|
return $g_act_table;
|
|
}
|
|
|
|
function getActPlusInfo($type)
|
|
{
|
|
$conf = getActPlusConf();
|
|
$info_list = array();
|
|
for ($i = 1; $i <= count($conf); $i++) {
|
|
$act = getActPlusById($i);
|
|
if ($act['type'] != $type) {
|
|
continue;
|
|
}
|
|
array_push($info_list, array(
|
|
'id' => $act['id'],
|
|
));
|
|
}
|
|
return $info_list;
|
|
}
|