This commit is contained in:
aozhiwei 2022-01-26 13:16:08 +08:00
parent 1085b4fba5
commit eddf90f214
2 changed files with 30 additions and 4 deletions

View File

@ -10,7 +10,7 @@ class BoxOrder extends BaseModel {
public function getSoldNum($batchId) public function getSoldNum($batchId)
{ {
$row = myself()->_getMarketMysql()->execQueryOne $row = myself()->_getMarketMysql()->execQueryOne
('SELECT COUNT(*) AS sold_num FROM t_box_order', ('SELECT COUNT(*) AS sold_num FROM t_box_order WHERE batch_id=:batch_id;',
array( array(
':batch_id' => $batchId ':batch_id' => $batchId
)); ));
@ -19,7 +19,13 @@ class BoxOrder extends BaseModel {
public function isBuyed($buyerAddress, $batchId) public function isBuyed($buyerAddress, $batchId)
{ {
return 0; $row = myself()->_getMarketMysql()->execQueryOne
('SELECT COUNT(*) AS buy_count FROM t_box_order WHERE batch_id=:batch_id AND buyer_address=:buyer_address;',
array(
':buyer_address' => $buyerAddress,
':batch_id' => $batchId
));
return $row && $row['buy_count'] ? $row['buy_count'] > 0 : false;
} }
} }

View File

@ -9,12 +9,32 @@ class Nft extends BaseModel {
public function getNftList($account) public function getNftList($account)
{ {
return 0; $nftList = array();
SqlHelper::ormSelect(
myself()->_getSelfMysql(),
't_nft',
array(
'owner_address' => $account
),
function ($row) use(&$nftList) {
if ($row['item_num'] > 0) {
array_push($nftList, $row);
}
}
);
return $nftList;
} }
public function getNft($tokenId) public function getNft($tokenId)
{ {
return 0; $row = SqlHelper::ormSelectOne(
myself()->_getSelfMysql(),
't_nft',
array(
'token_id' => $tokenId,
)
);
return $row;
} }
} }