This commit is contained in:
aozhiwei 2022-01-26 13:32:06 +08:00
parent eddf90f214
commit 3f47a3eaca
2 changed files with 8 additions and 9 deletions

View File

@ -115,7 +115,7 @@ class NewMarketController extends BaseController {
return; return;
} }
if (!$this->isTestMode() || BoxOrder::isBuyed($account, $currBatchMeta['batch_id'])) { if (!$this->isTestMode() && BoxOrder::isBuyed($buyerAddress, $currBatchMeta['batch_id'])) {
myself()->_rspErr(1, 'account can only choose 1 hero to purchase'); myself()->_rspErr(1, 'account can only choose 1 hero to purchase');
return; return;
} }
@ -126,9 +126,10 @@ class NewMarketController extends BaseController {
$itemId = $type; $itemId = $type;
SqlHelper::insert SqlHelper::insert
(myself()->_getMarketMysql(), (myself()->_getMarketMysql(),
't_box_order_bag', 't_box_order',
array( array(
'batch_id' => $currBatchMeta['batch_id'], 'batch_id' => $currBatchMeta['batch_id'],
'order_id' => $orderId,
'item_id' => $itemId, 'item_id' => $itemId,
'state' => 1, 'state' => 1,
'buyer_address' => $buyerAddress, 'buyer_address' => $buyerAddress,
@ -163,7 +164,7 @@ class NewMarketController extends BaseController {
public function getNftList() public function getNftList()
{ {
$account = getReqVal('account', ''); $account = getReqVal('account', '');
$nftDbList = Nft::getNftList($accont); $nftDbList = Nft::getNftList($account);
$nftList = array(); $nftList = array();
foreach ($nftDbList as $nftDb) { foreach ($nftDbList as $nftDb) {
$nft = $this->toNftDto($nftDb); $nft = $this->toNftDto($nftDb);
@ -192,7 +193,7 @@ class NewMarketController extends BaseController {
private function toNftDto($nftDb) private function toNftDto($nftDb)
{ {
$nft = array( $nft = array(
'token_id' => $nftDb['tokenId'], 'token_id' => $nftDb['token_id'],
'owner_address' => $nftDb['owner_address'], 'owner_address' => $nftDb['owner_address'],
'owner_name' => $nftDb['owner_name'], 'owner_name' => $nftDb['owner_name'],
'item_id' => $nftDb['item_id'], 'item_id' => $nftDb['item_id'],

View File

@ -11,15 +11,13 @@ class Nft extends BaseModel {
{ {
$nftList = array(); $nftList = array();
SqlHelper::ormSelect( SqlHelper::ormSelect(
myself()->_getSelfMysql(), myself()->_getMarketMysql(),
't_nft', 't_nft',
array( array(
'owner_address' => $account 'owner_address' => $account
), ),
function ($row) use(&$nftList) { function ($row) use(&$nftList) {
if ($row['item_num'] > 0) { array_push($nftList, $row);
array_push($nftList, $row);
}
} }
); );
return $nftList; return $nftList;
@ -28,7 +26,7 @@ class Nft extends BaseModel {
public function getNft($tokenId) public function getNft($tokenId)
{ {
$row = SqlHelper::ormSelectOne( $row = SqlHelper::ormSelectOne(
myself()->_getSelfMysql(), myself()->_getMarketMysql(),
't_nft', 't_nft',
array( array(
'token_id' => $tokenId, 'token_id' => $tokenId,