This commit is contained in:
aozhiwei 2024-07-25 16:20:42 +08:00
parent 4632b3d3f3
commit d52e97551c
2 changed files with 47 additions and 0 deletions

View File

@ -0,0 +1,21 @@
<?php
require_once('mt/Recharge.php');
class RechargeController extends BaseAuthedController {
public function goodsList()
{
$goods = array();
mt\Recharge::traverseMeta(function ($meta) use(&$goods) {
array_push($goods, array(
'goods_id' => $meta['id'],
'goods_meta' => $meta,
));
});
myself()->_rspData(array(
'goods' => $goods
));
}
}

26
webapp/mt/Recharge.php Normal file
View File

@ -0,0 +1,26 @@
<?php
namespace mt;
use phpcommon;
class Recharge {
public static function traverseMeta($cb)
{
foreach (self::getMetaList() as $meta) {
$cb($meta);
}
}
protected static function getMetaList()
{
if (!self::$metaList) {
self::$metaList = getMetaTable('Recharge@Recharge.php');
}
return self::$metaList;
}
protected static $metaList;
}