1
This commit is contained in:
parent
74e93a6016
commit
0e59a42078
@ -189,8 +189,8 @@ class Season {
|
||||
['ranking', ranking],
|
||||
['season', seasonId],
|
||||
['ranking_point', ponit],
|
||||
['createtime', element.createtime],
|
||||
['modifytime', element.score_modifytime],
|
||||
['createtime', nowTime],
|
||||
['modifytime', nowTime],
|
||||
]
|
||||
)
|
||||
}
|
||||
|
@ -1,10 +1,12 @@
|
||||
<?php
|
||||
|
||||
require_once('models/Hero.php');
|
||||
require_once('models/Nft.php');
|
||||
require_once('mt/NftDesc.php');
|
||||
require_once('mt/Hero.php');
|
||||
|
||||
use models\Hero;
|
||||
use models\Nft;
|
||||
|
||||
class RestApiController extends BaseController {
|
||||
|
||||
@ -25,7 +27,7 @@ class RestApiController extends BaseController {
|
||||
/*
|
||||
https://game2006api.cebggame.com/api/nft/$netId/$nftType/$tokenId
|
||||
$netId: 链id(网络id)
|
||||
$nftType: 目前就hero
|
||||
$nftType: 目前就hero,planet
|
||||
$tokenId:tokenid
|
||||
*/
|
||||
private function nftInfo($path)
|
||||
@ -36,26 +38,25 @@ class RestApiController extends BaseController {
|
||||
$netId = $path[3];
|
||||
$nftType = $path[4];
|
||||
$tokenId = $path[5];
|
||||
$heroDb = Hero::findByTokenId2($tokenId);
|
||||
|
||||
if (!$heroDb){
|
||||
echo json_encode(array(
|
||||
$info = array(
|
||||
"name" => "",
|
||||
"description" => "",
|
||||
"image" => "",
|
||||
"attributes" => array(),
|
||||
));
|
||||
);
|
||||
switch ($nftType){
|
||||
case "hero" :{
|
||||
$heroDb = Hero::findByTokenId2($tokenId);
|
||||
if (!$heroDb){
|
||||
echo json_encode($info);
|
||||
die;
|
||||
}
|
||||
$heroMeta = \mt\Hero::get($heroDb['hero_id']);
|
||||
$NftMeta = \mt\NftDesc::getByItemId($heroDb['hero_id']);
|
||||
//https://www.cebg.games/res/nfts/30100.png
|
||||
$info = array(
|
||||
"name" => $heroMeta['name'],
|
||||
"description" => $NftMeta['desc'],
|
||||
"image" => "https://www.cebg.games/res/nfts/".$heroDb['hero_id'].".png",
|
||||
"attributes" => array(),
|
||||
);
|
||||
$info['name'] = $heroMeta['name'];
|
||||
$info['description'] = $NftMeta['desc'];
|
||||
$info['image'] = "https://www.cebg.games/res/nfts/".$heroDb['hero_id'].".png";
|
||||
array_push($info['attributes'],array(
|
||||
"trait_type" => "level",
|
||||
"value" => intval($heroDb['hero_lv']),
|
||||
@ -75,7 +76,6 @@ class RestApiController extends BaseController {
|
||||
case kHAT_Hp : {
|
||||
array_push($info['attributes'],array(
|
||||
"trait_type" => "Hp",
|
||||
// "value" => intval($attr['val']),
|
||||
"value" => $quality,
|
||||
));
|
||||
}
|
||||
@ -83,7 +83,6 @@ class RestApiController extends BaseController {
|
||||
case kHAT_Atk : {
|
||||
array_push($info['attributes'],array(
|
||||
"trait_type" => "Atk",
|
||||
// "value" => intval($attr['val']),
|
||||
"value" => $quality,
|
||||
));
|
||||
}
|
||||
@ -91,12 +90,26 @@ class RestApiController extends BaseController {
|
||||
case kHAT_Def : {
|
||||
array_push($info['attributes'],array(
|
||||
"trait_type" => "Def",
|
||||
// "value" => intval($attr['val']),
|
||||
"value" => $quality,
|
||||
));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
case "planet" : {
|
||||
$planetDb = Nft::getNft($tokenId);
|
||||
if (!$planetDb){
|
||||
echo json_encode($info);
|
||||
die;
|
||||
}
|
||||
$NftMeta = \mt\NftDesc::getByItemId($planetDb['item_id']);
|
||||
$info['name'] = $NftMeta['name'] ? : "planet";
|
||||
$info['description'] = $NftMeta['desc'] ? : "planet";
|
||||
$info['image'] = "https://www.cebg.games/res/nfts/".$planetDb['item_id'].".png";
|
||||
}
|
||||
}
|
||||
|
||||
echo json_encode($info);
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user