1
This commit is contained in:
parent
1ff2c337fa
commit
2c9c6378ab
@ -124,7 +124,26 @@ class BlockChainController extends BaseAuthedController {
|
|||||||
|
|
||||||
public function evolve721Nft()
|
public function evolve721Nft()
|
||||||
{
|
{
|
||||||
|
$type = getReqVal('type', '');
|
||||||
|
$tokenId1 = getReqVal('token_id1', '');
|
||||||
|
$tokenId2 = getReqVal('token_id2', '');
|
||||||
|
switch ($type) {
|
||||||
|
case 1:
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
{
|
||||||
|
myself()->_rspErr(1, 'type param error');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function evolveChip()
|
public function evolveChip()
|
||||||
@ -458,6 +477,40 @@ class BlockChainController extends BaseAuthedController {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private function internalBcCall($params, $transParams) {
|
||||||
|
$url = self::getWeb3ServiceUrl();
|
||||||
|
$response = '';
|
||||||
|
if (!phpcommon\HttpClient::get
|
||||||
|
($url,
|
||||||
|
$params,
|
||||||
|
$response)) {
|
||||||
|
myself()->_rspErr(500, 'server internal error');
|
||||||
|
die();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
error_log($response);
|
||||||
|
$rspObj = json_decode($response, true);
|
||||||
|
if ($rspObj['errcode'] == 0) {
|
||||||
|
$transId = $rspObj['trans_id'];
|
||||||
|
Transaction::add(
|
||||||
|
$transId,
|
||||||
|
$transParams['action'],
|
||||||
|
$transParams['tokenId'],
|
||||||
|
$transParams['tokenType'],
|
||||||
|
$transParams['itemUniId'],
|
||||||
|
$transParams['itemId']
|
||||||
|
);
|
||||||
|
myself()->_rspData(array(
|
||||||
|
'trans_id' => $transId,
|
||||||
|
'params' => $rspObj['params']
|
||||||
|
));
|
||||||
|
} else {
|
||||||
|
myself()->_rspErr(500, 'server internal error');
|
||||||
|
die();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private static function getWeb3ServiceUrl()
|
private static function getWeb3ServiceUrl()
|
||||||
{
|
{
|
||||||
if (SERVER_ENV == _TEST) {
|
if (SERVER_ENV == _TEST) {
|
||||||
|
@ -47,6 +47,24 @@ class Gun extends BaseModel {
|
|||||||
return $row;
|
return $row;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static function findByTokenId($tokenId)
|
||||||
|
{
|
||||||
|
$row = SqlHelper::ormSelectOne(
|
||||||
|
myself()->_getMysql($tokenId),
|
||||||
|
't_gun',
|
||||||
|
array(
|
||||||
|
'token_id' => $tokenId,
|
||||||
|
)
|
||||||
|
);
|
||||||
|
if ($row) {
|
||||||
|
$row['gun_uniid'] = $row['idx'];
|
||||||
|
if (!NftService::isEquipOwner(myself()->_getOpenId(), $row['token_id'])) {
|
||||||
|
$row = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return $row;
|
||||||
|
}
|
||||||
|
|
||||||
public static function findByAccountId($accountId, $gunUniId)
|
public static function findByAccountId($accountId, $gunUniId)
|
||||||
{
|
{
|
||||||
return self::internalFind($accountId, $gunUniId);
|
return self::internalFind($accountId, $gunUniId);
|
||||||
|
@ -44,6 +44,24 @@ class Hero extends BaseModel {
|
|||||||
return self::internalFind($accountId, $heroUniId);
|
return self::internalFind($accountId, $heroUniId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static function findByTokenId($tokenId)
|
||||||
|
{
|
||||||
|
$row = SqlHelper::ormSelectOne(
|
||||||
|
myself()->_getMysql($tokenId),
|
||||||
|
't_hero',
|
||||||
|
array(
|
||||||
|
'token_id' => $tokenId,
|
||||||
|
)
|
||||||
|
);
|
||||||
|
if ($row) {
|
||||||
|
$row['hero_uniid'] = $row['idx'];
|
||||||
|
if (!NftService::isHeroOwner(myself()->_getOpenId(), $row['token_id'])) {
|
||||||
|
$row = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return $row;
|
||||||
|
}
|
||||||
|
|
||||||
private static function internalFind($accountId, $heroUniId)
|
private static function internalFind($accountId, $heroUniId)
|
||||||
{
|
{
|
||||||
$row = SqlHelper::ormSelectOne(
|
$row = SqlHelper::ormSelectOne(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user