game2006api/webapp/models/Fragment.php
hujiabin d950686864 1
2022-11-11 11:27:57 +08:00

56 lines
1.5 KiB
PHP

<?php
namespace models;
require_once('services/NftService.php');
require_once('mt/Item.php');
use mt;
use phpcommon\SqlHelper;
use services\NftService;
class Fragment extends BaseModel
{
public static function getFragmentList() {
$sql = "select * from t_nft1155 where owner_address=:owner_address and token_id<10000000 and balance>0";
$whereKv =array(
'owner_address' => myself()->_getOpenId(),
);
$fragmentNft = myself()->_getMarketMysql()->execQuery($sql,$whereKv);
return $fragmentNft;
}
public static function ToDto($row){
$dto = array(
// 'owner_address' => $row['owner_address'],
'token_id' => $row['token_id'],
'item_id' => $row['token_id'],
'balance' => $row['balance'],
'createtime' => $row['createtime'],
'modifytime' => $row['modifytime'],
);
return $dto;
}
public static function oldToDto($row){
$itemMeta = mt\Item::get($row['token_id']);
$dto = array();
if ($itemMeta){
$dto = array(
'token_id' => $row['token_id'],
'item_id' => $row['token_id'],
'type' => $itemMeta['sub_type'],
'parts' => substr($itemMeta['id'],-2,1),
'balance' => $row['balance'],
'createtime' => $row['createtime'],
'modifytime' => $row['modifytime'],
);
}
return $dto;
}
}