This commit is contained in:
songliang 2022-12-15 16:42:56 +08:00
parent 4220cbdcc1
commit b499d6c66d

View File

@ -757,26 +757,8 @@ class MarketController extends BaseController {
return;
}
$nft = Nft::toDto($nftDb);
$t = $row['token_type'];
switch($t) {
case Nft::HERO_TYPE: {
$row['detail'] = Hero::toDtoInfo(Hero::findByTokenId2($row['token_id']));
} break;
case Nft::EQUIP_TYPE: {
$row['detail'] = Gun::toDtoInfo(Gun::findByTokenId2($row['token_id']));
} break;
case Nft::CHIP_TYPE: {
$row['detail'] = Chip::toDto(Chip::getChipByTokenId($row['token_id']));
} break;
case Nft::FRAGMENT_TYPE: {
} break;
default: {
} break;
}
$row['info'] = $nft;
$row['detail'] = $this->getNftGameData($nftDb);
array_push($nfts, $row);
}
@ -851,8 +833,9 @@ class MarketController extends BaseController {
$conn = myself()->_getMysql('');
$nft = Nft::findNftByOwner($account, $nft_token);
$nftDetail = Nft::toDto($nft);
$nftDb = Nft::findNftByOwner($account, $nft_token);
$nftDetail = Nft::toDto($nftDb);
$detail = $this->getNftGameData($nftDb);
$r = SqlHelper::insert(
$conn,
't_market_store',
@ -867,11 +850,29 @@ class MarketController extends BaseController {
'c_job' => isset($nftDetail['info']['job']) ? $nftDetail['info']['job'] : 0,
'c_lv' => isset($nftDetail['info']['level']) ? $nftDetail['info']['level'] : 0,
'c_quality' => isset($nftDetail['info']['quality']) ? $nftDetail['info']['quality'] : 0,
'c_durability' => isset($nftDetail['info']['durability']) ? $nftDetail['info']['durability'] : 0,
'c_durability' => isset($nftDetail['info']['durability']) ? $nftDetail['info']['durability'] : isset($detail['hero_tili']) ? $detail['hero_tili'] : 0,
'c_type' => isset($detail['type']) ? $detail['type'] : 0,
'c_id' => $nftDetail['item_id'],
)
);
$this->_rspOk();
// 1027099990010021
// 1027099971010019
// 1026675410010003
// 1026668659010002
// 1027098176010009
// 1027098182010010
// 1027099974010020
// 1027099993010022
// 1027100012010023
// 1027100015010024
// 1027100017010025
// 1027100019010026
// 110100
// 1027101078010027
// 1027099993010022
// 110100
// 1027099971010019
}
public function buyNft() {
@ -889,4 +890,26 @@ class MarketController extends BaseController {
$this->_rspOk();
}
private function getNftGameData($nftRowInfo) {
$t = $nftRowInfo['token_type'];
$token_id = $nftRowInfo['token_id'];
switch($t) {
case Nft::HERO_TYPE: {
return Hero::toDtoInfo(Hero::findByTokenId2($token_id));
} break;
case Nft::EQUIP_TYPE: {
return Gun::toDtoInfo(Gun::findByTokenId2($token_id));
} break;
case Nft::CHIP_TYPE: {
return Chip::toDto(Chip::getChipByTokenId($token_id));
} break;
case Nft::FRAGMENT_TYPE: {
return Fragment::ToDto($nftRowInfo);
} break;
default: {
} break;
}
return array('unknown' => 'unknown game data type, cannot find data');
}
}