From 19e15d568e0455ce32d65bccc4ae0781ab7d39c3 Mon Sep 17 00:00:00 2001 From: aozhiwei Date: Wed, 3 Jul 2024 15:56:32 +0800 Subject: [PATCH] 1 --- .../controller/OutAppNftController.class.php | 6 ++++++ webapp/models/Nft.php | 18 ++++++++++++++++++ webapp/services/NftService.php | 19 +++++++++++++------ 3 files changed, 37 insertions(+), 6 deletions(-) diff --git a/webapp/controller/OutAppNftController.class.php b/webapp/controller/OutAppNftController.class.php index 05cf5932..4d424291 100644 --- a/webapp/controller/OutAppNftController.class.php +++ b/webapp/controller/OutAppNftController.class.php @@ -3,6 +3,7 @@ use phpcommon\SqlHelper; require_once('models/Nft.php'); require_once('models/User.php'); require_once('models/Hero.php'); +require_once('services/NftService.php'); require_once('mt/NftDesc.php'); require_once('mt/Hero.php'); require_once('mt/EconomyAttribute.php'); @@ -129,6 +130,11 @@ class OutAppNftController extends BaseController { )); } + public function hasLockedNft() + { + $accountAddress = strtolower(getReqVal('account_address', '')); + } + public function nftMetaView() { $netId = getReqVal('net_id', ''); diff --git a/webapp/models/Nft.php b/webapp/models/Nft.php index ca89fcf6..533836c8 100644 --- a/webapp/models/Nft.php +++ b/webapp/models/Nft.php @@ -131,6 +131,24 @@ class Nft extends BaseModel return $nftList; } + public static function getOwnerNftListByType($account, $type) + { + $nftList = array(); + SqlHelper::ormSelect( + myself()->_getMarketMysql(), + 't_nft', + array( + 'owner_address' => $account, + 'token_type' => $type, + 'deleted' => 0, + ), + function ($row) use (&$nftList) { + array_push($nftList, $row); + } + ); + return $nftList; + } + public static function getNft1155List($account, $type) { diff --git a/webapp/services/NftService.php b/webapp/services/NftService.php index d42498e1..526992e2 100644 --- a/webapp/services/NftService.php +++ b/webapp/services/NftService.php @@ -164,14 +164,21 @@ class NftService extends BaseService { } } - public static function hasLockedNft($accountAddress) + public static function hasAnyNft($accountAddress) { - $nftList = Nft::getNftListByType($accountAddress, Nft::HERO_TYPE); - if (empty($nftList) || count($nftList) <= 0) { - return false; - } else { - return true; + { + $nftList = Nft::getNftListByType($accountAddress, Nft::HERO_TYPE); + if (!empty($nftList) || count($nftList) > 0) { + return true; + } } + { + $nftList = Nft::getOwnerNftListByType($accountAddress, Nft::HERO_TYPE); + if (!empty($nftList) || count($nftList) > 0) { + return true; + } + } + return false; } }