1
This commit is contained in:
parent
f49f3ef9f9
commit
c7cd736412
@ -18,71 +18,71 @@ class NftService extends BaseService {
|
|||||||
public static function isHeroOwner($tokenId)
|
public static function isHeroOwner($tokenId)
|
||||||
{
|
{
|
||||||
self::mustBeHeros();
|
self::mustBeHeros();
|
||||||
$nftDB = getXVal(self::heroHash, $tokenId);
|
$nftDB = getXVal(self::$heroHash, $tokenId);
|
||||||
return $nftDb && $nftDB['owner_address'] == myself()->_getOpenId();
|
return $nftDb && $nftDB['owner_address'] == myself()->_getOpenId();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function isEquipOwner($tokenId)
|
public static function isEquipOwner($tokenId)
|
||||||
{
|
{
|
||||||
self::mustBeEquips();
|
self::mustBeEquips();
|
||||||
$nftDb = getXVal(self::equipHash, $tokenId);
|
$nftDb = getXVal(self::$equipHash, $tokenId);
|
||||||
return $nftDb && $nftDB['owner_address'] == myself()->_getOpenId();
|
return $nftDb && $nftDB['owner_address'] == myself()->_getOpenId();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function isChipOwner($tokenId)
|
public static function isChipOwner($tokenId)
|
||||||
{
|
{
|
||||||
self::mustBeChips();
|
self::mustBeChips();
|
||||||
$nftDb = getXVal(self::chipHash, $tokenId);
|
$nftDb = getXVal(self::$chipHash, $tokenId);
|
||||||
return $nftDb && $nftDB['owner_address'] == myself()->_getOpenId();
|
return $nftDb && $nftDB['owner_address'] == myself()->_getOpenId();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function getHeros()
|
public static function getHeros()
|
||||||
{
|
{
|
||||||
self::mustBeHeros();
|
self::mustBeHeros();
|
||||||
return self::heroList;
|
return self::$heroList;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function getEquips()
|
public static function getEquips()
|
||||||
{
|
{
|
||||||
self::mustBeEquips();
|
self::mustBeEquips();
|
||||||
return self::equipList;
|
return self::$equipList;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function getChips()
|
public static function getChips()
|
||||||
{
|
{
|
||||||
self::mustBeChips();
|
self::mustBeChips();
|
||||||
return self::chipList;
|
return self::$chipList;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static function mustBeHeros()
|
private static function mustBeHeros()
|
||||||
{
|
{
|
||||||
if (is_null(self::heroList)) {
|
if (is_null(self::$heroList)) {
|
||||||
self::heroList = Nft::GetNftListByType(myself()->_getOpenId(), Nft::HERO_TYPE);
|
self::$heroList = Nft::GetNftListByType(myself()->_getOpenId(), Nft::HERO_TYPE);
|
||||||
self::heroHash = array();
|
self::$heroHash = array();
|
||||||
foreach (self::heroList as $nftDb) {
|
foreach (self::$heroList as $nftDb) {
|
||||||
self::heroHash[$nftDb['token_id']] = $nftDb;
|
self::$heroHash[$nftDb['token_id']] = $nftDb;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static function mustBeEquips()
|
private static function mustBeEquips()
|
||||||
{
|
{
|
||||||
if (is_null(self::equipList)) {
|
if (is_null(self::$equipList)) {
|
||||||
self::equipList = Nft::GetNftListByType(myself()->_getOpenId(), Nft::EQUIP_TYPE);
|
self::$equipList = Nft::GetNftListByType(myself()->_getOpenId(), Nft::EQUIP_TYPE);
|
||||||
self::equipHash = array();
|
self::$equipHash = array();
|
||||||
foreach (self::equipList as $nftDb) {
|
foreach (self::$equipList as $nftDb) {
|
||||||
self::equipHash[$nftDb['token_id']] = $nftDb;
|
self::$equipHash[$nftDb['token_id']] = $nftDb;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static function mustBeChips()
|
private static function mustBeChips()
|
||||||
{
|
{
|
||||||
if (is_null(self::chipList)) {
|
if (is_null(self::$chipList)) {
|
||||||
self::chipList = Nft::GetNftListByType(myself()->_getOpenId(), Nft::CHIP_TYPE);
|
self::$chipList = Nft::GetNftListByType(myself()->_getOpenId(), Nft::CHIP_TYPE);
|
||||||
self::chipHash = array();
|
self::$chipHash = array();
|
||||||
foreach (self::chipList as $nftDb) {
|
foreach (self::$chipList as $nftDb) {
|
||||||
self::chipHash[$nftDb['token_id']] = $nftDb;
|
self::$chipHash[$nftDb['token_id']] = $nftDb;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user