_getOpenId(); } public static function isEquipOwner($tokenId) { self::mustBeEquips(); $nftDb = getXVal(self::$equipHash, $tokenId); return $nftDb && $nftDB['owner_address'] == myself()->_getOpenId(); } public static function isChipOwner($tokenId) { self::mustBeChips(); $nftDb = getXVal(self::$chipHash, $tokenId); return $nftDb && $nftDB['owner_address'] == myself()->_getOpenId(); } public static function getHeros() { self::mustBeHeros(); return self::$heroList; } public static function getEquips() { self::mustBeEquips(); return self::$equipList; } public static function getChips() { self::mustBeChips(); return self::$chipList; } private static function mustBeHeros() { if (is_null(self::$heroList)) { self::$heroList = Nft::GetNftListByType(myself()->_getOpenId(), Nft::HERO_TYPE); self::$heroHash = array(); foreach (self::$heroList as $nftDb) { self::$heroHash[$nftDb['token_id']] = $nftDb; } //error_log(json_encode(self::$heroList)); } } private static function mustBeEquips() { if (is_null(self::$equipList)) { self::$equipList = Nft::GetNftListByType(myself()->_getOpenId(), Nft::EQUIP_TYPE); self::$equipHash = array(); foreach (self::$equipList as $nftDb) { self::$equipHash[$nftDb['token_id']] = $nftDb; } //error_log(json_encode(self::$equipList)); } } private static function mustBeChips() { if (is_null(self::$chipList)) { self::$chipList = Nft::GetNftListByType(myself()->_getOpenId(), Nft::CHIP_TYPE); self::$chipHash = array(); foreach (self::$chipList as $nftDb) { self::$chipHash[$nftDb['token_id']] = $nftDb; } //error_log(json_encode(self::$chipList)); } } }