1
This commit is contained in:
parent
2f33867b53
commit
a537ad0b2e
@ -1,43 +1,13 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
require_once('mt/MarketGoods.php');
|
|
||||||
require_once('mt/MarketBatch.php');
|
|
||||||
require_once('mt/Item.php');
|
|
||||||
require_once('mt/WhiteList.php');
|
|
||||||
require_once('mt/Currency.php');
|
|
||||||
require_once('mt/Hero.php');
|
|
||||||
require_once('mt/Parameter.php');
|
|
||||||
|
|
||||||
require_once('models/BoxOrder.php');
|
|
||||||
require_once('models/Nft.php');
|
|
||||||
require_once('models/BuyRecord.php');
|
|
||||||
|
|
||||||
require_once('phpcommon/bchelper.php');
|
|
||||||
|
|
||||||
use phpcommon\SqlHelper;
|
|
||||||
use models\BoxOrder;
|
|
||||||
use models\Nft;
|
|
||||||
use models\BuyRecord;
|
|
||||||
|
|
||||||
class RestApiController extends BaseController {
|
class RestApiController extends BaseController {
|
||||||
|
|
||||||
public function dispatch()
|
public function dispatch()
|
||||||
{
|
{
|
||||||
//REQUEST_URI /api/nft?dafsf=1%26=
|
//REQUEST_URI /api/nft/$netId/$nftType/$tokenId
|
||||||
$requestUri = $_SERVER['REQUEST_URI'];
|
$requestUri = $_SERVER['REQUEST_URI'];
|
||||||
if (!empty($requestUri)) {
|
if (!empty($requestUri)) {
|
||||||
$idx = strpos($requestUri, '/api/nft/info/');
|
$idx = strpos($requestUri, '/api/nft/');
|
||||||
if ($idx === false) {
|
|
||||||
$idx = strpos($requestUri, '/api/client');
|
|
||||||
if (!($idx === false)) {
|
|
||||||
$url = 'https://test.cebg.games/client/web-mobile/';
|
|
||||||
header("Cache-control:no-cache,no-store,must-revalidate");
|
|
||||||
header("Pragma:no-cache");
|
|
||||||
header("Expires:0");
|
|
||||||
Header("Location:$url");
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if ($idx == 0) {
|
if ($idx == 0) {
|
||||||
$tmpStrs = explode('?', $requestUri);
|
$tmpStrs = explode('?', $requestUri);
|
||||||
$requestUri = count($tmpStrs) > 0 ? $tmpStrs[0] : '';
|
$requestUri = count($tmpStrs) > 0 ? $tmpStrs[0] : '';
|
||||||
@ -46,25 +16,25 @@ class RestApiController extends BaseController {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
https://game2006api.cebggame.com/api/nft/$netId/$nftType/$tokenId
|
||||||
|
$netId: 链id(网络id)
|
||||||
|
$nftType: 目前就hero
|
||||||
|
$tokenId:tokenid
|
||||||
|
*/
|
||||||
private function nftInfo($path)
|
private function nftInfo($path)
|
||||||
{
|
{
|
||||||
$nftView = array(
|
if (count($path) < 5) {
|
||||||
'name' => '',
|
return;
|
||||||
'description' => '',
|
}
|
||||||
'image' => ''
|
$netId = $path[2];
|
||||||
);
|
$nftType = $path[3];
|
||||||
$tokenId = $path[4];
|
$tokenId = $path[4];
|
||||||
if (empty($tokenId)) {
|
echo json_encode(array(
|
||||||
myself()->_rspRawData($nftView);
|
'netId' => $netId,
|
||||||
return;
|
'nftType' => $nftType,
|
||||||
}
|
'tokenId' => $tokenId
|
||||||
$nftDb = Nft::getNft($tokenId);
|
));
|
||||||
if (empty($nftDb)) {
|
|
||||||
myself()->_rspRawData($nftView);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
Nft::toNftView($nftDb, $nftView);
|
|
||||||
myself()->_rspRawData($nftView);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user