...
This commit is contained in:
parent
d00e49a3e1
commit
21c4162538
@ -153,7 +153,7 @@ class Shop(object):
|
|||||||
],
|
],
|
||||||
'response': [
|
'response': [
|
||||||
_common.RspHead(),
|
_common.RspHead(),
|
||||||
['pay_methods', [_common.PayMethod()], '支付方式列表'],
|
['!pay_methods', [_common.PayMethod()], '支付方式列表'],
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
|
@ -1,22 +1,43 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace mt;
|
namespace mt;
|
||||||
|
|
||||||
use phpcommon;
|
use phpcommon;
|
||||||
|
|
||||||
class PayMethod {
|
class PayMethod
|
||||||
|
{
|
||||||
|
|
||||||
public static function get($id)
|
public static function getPayMethods($token_type)
|
||||||
{
|
{
|
||||||
return getXVal(self::getMetaList(), $id);
|
self::cachePayMethodsInTokenType();
|
||||||
|
$methods = getXVal(self::$cachePayMethodsInTokenTypeList, $token_type, null);
|
||||||
|
return $methods;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
protected static function cachePayMethodsInTokenType()
|
||||||
|
{
|
||||||
|
if (!self::$cachePayMethodsInTokenTypeList) {
|
||||||
|
self::$cachePayMethodsInTokenTypeList = array();
|
||||||
|
foreach (self::getMetaList() as $meta) {
|
||||||
|
if (!getXVal(self::$cachePayMethodsInTokenTypeList, $meta['shop_token_type'], null)) {
|
||||||
|
self::$cachePayMethodsInTokenTypeList[$meta['shop_token_type']] = array();
|
||||||
|
}
|
||||||
|
array_push(self::$cachePayMethodsInTokenTypeList[$meta['shop_token_type']], $meta);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return self::$cachePayMethodsInTokenTypeList;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected static function getMetaList()
|
protected static function getMetaList()
|
||||||
{
|
{
|
||||||
if (!self::$metaList) {
|
if (!self::$metaList) {
|
||||||
self::$metaList = getMetaTable('payMethod@payMethod.php');
|
self::$metaList = getMetaTable('payMethod@payMethod.php');
|
||||||
}
|
}
|
||||||
return self::$metaList;
|
return self::$metaList;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected static $cachePayMethodsInTokenTypeList;
|
||||||
protected static $metaList;
|
protected static $metaList;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user