aozhiwei f49f3ef9f9 1
2022-03-31 08:51:34 +08:00

60 lines
1.2 KiB
PHP

<?php
namespace models;
use mt;
use phpcommon\SqlHelper;
class Nft extends BaseModel {
const HERO_TYPE = 0;
const EQUIP_TYPE = 1;
const CHIP_TYPE = 2;
public function getNftList($account)
{
$nftList = array();
SqlHelper::ormSelect(
myself()->_getMarketMysql(),
't_nft',
array(
'owner_address' => $account
),
function ($row) use(&$nftList) {
array_push($nftList, $row);
}
);
return $nftList;
}
public function getNftListByType($account, $type)
{
$nftList = array();
SqlHelper::ormSelect(
myself()->_getMarketMysql(),
't_nft',
array(
'owner_address' => $account,
'token_type' => $type,
),
function ($row) use(&$nftList) {
array_push($nftList, $row);
}
);
return $nftList;
}
public function getNft($tokenId)
{
$row = SqlHelper::ormSelectOne(
myself()->_getMarketMysql(),
't_nft',
array(
'token_id' => $tokenId,
)
);
return $row;
}
}