Merge branch 'hjb' of git.kingsome.cn:server/game2006api into hjb
This commit is contained in:
commit
8826dab683
@ -230,7 +230,6 @@ class AAMarket(object):
|
|||||||
'params': [
|
'params': [
|
||||||
['net_id', 0, '链id'],
|
['net_id', 0, '链id'],
|
||||||
['contract_address', '', 'contract_address'],
|
['contract_address', '', 'contract_address'],
|
||||||
['to', '', '目標address'],
|
|
||||||
['!tokens', [
|
['!tokens', [
|
||||||
['token_id', '', 'token_id'],
|
['token_id', '', 'token_id'],
|
||||||
], 'nft list(目前只支持英雄并且只支持一个)']
|
], 'nft list(目前只支持英雄并且只支持一个)']
|
||||||
@ -291,4 +290,31 @@ class AAMarket(object):
|
|||||||
['trans_req', _common.MFTransactionRequest(), '调用合约参数'],
|
['trans_req', _common.MFTransactionRequest(), '调用合约参数'],
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
'method': 'GET',
|
||||||
|
'name': '/api/user/:account_address',
|
||||||
|
'desc': '获取用户信息',
|
||||||
|
'group': '!AAMarket',
|
||||||
|
'url': 'https://market-test.kingsome.cn/api/user/:account_address',
|
||||||
|
'params': [
|
||||||
|
],
|
||||||
|
'response': [
|
||||||
|
_common.RspHead(),
|
||||||
|
['contribution_point', 0, '贡献点'],
|
||||||
|
['gold', 0, '金币数'],
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'method': 'GET',
|
||||||
|
'name': '/api/activity/stacking/expected_daily/:account_address',
|
||||||
|
'desc': '质押活动-获取每日预期所得',
|
||||||
|
'group': '!AAMarket',
|
||||||
|
'url': '/api/activity/stacking/expected_daily/:account_address',
|
||||||
|
'params': [
|
||||||
|
],
|
||||||
|
'response': [
|
||||||
|
_common.RspHead(),
|
||||||
|
['contribution_point', 0, '贡献点'],
|
||||||
|
]
|
||||||
|
},
|
||||||
]
|
]
|
||||||
|
@ -32,6 +32,7 @@ CREATE TABLE `t_nft` (
|
|||||||
`last_owner_address` varchar(60) COMMENT 'last_owner_address',
|
`last_owner_address` varchar(60) COMMENT 'last_owner_address',
|
||||||
`last_lock_idx` bigint NOT NULL DEFAULT '0' COMMENT 'last_lock_idx',
|
`last_lock_idx` bigint NOT NULL DEFAULT '0' COMMENT 'last_lock_idx',
|
||||||
`last_lock_address` varchar(60) COMMENT 'last_lock_address',
|
`last_lock_address` varchar(60) COMMENT 'last_lock_address',
|
||||||
|
`last_lock_sender` varchar(60) COMMENT 'last_lock_sender',
|
||||||
`last_lock_time` int(11) NOT NULL DEFAULT '0' COMMENT 'last_lock_time',
|
`last_lock_time` int(11) NOT NULL DEFAULT '0' COMMENT 'last_lock_time',
|
||||||
`creator_address` varchar(60) NOT NULL DEFAULT '' COMMENT 'creator_address',
|
`creator_address` varchar(60) NOT NULL DEFAULT '' COMMENT 'creator_address',
|
||||||
`token_id` varchar(60) NOT NULL DEFAULT '' COMMENT 'token_id',
|
`token_id` varchar(60) NOT NULL DEFAULT '' COMMENT 'token_id',
|
||||||
@ -55,6 +56,8 @@ CREATE TABLE `t_nft` (
|
|||||||
KEY `idx_net_id_token_type_owner_address_last_owner_address` (`net_id`, `token_type`, `owner_address`, `last_owner_address`),
|
KEY `idx_net_id_token_type_owner_address_last_owner_address` (`net_id`, `token_type`, `owner_address`, `last_owner_address`),
|
||||||
KEY `idx_net_id_token_type_token_id` (`net_id`, `token_type`, `token_id`),
|
KEY `idx_net_id_token_type_token_id` (`net_id`, `token_type`, `token_id`),
|
||||||
KEY `idx_last_owner_address` (`last_owner_address`),
|
KEY `idx_last_owner_address` (`last_owner_address`),
|
||||||
|
KEY `idx_last_lock_address` (`last_lock_address`),
|
||||||
|
KEY `idx_last_lock_sender` (`last_lock_sender`),
|
||||||
KEY `idx_item_id` (`item_id`),
|
KEY `idx_item_id` (`item_id`),
|
||||||
KEY `idx_quality` (`quality`),
|
KEY `idx_quality` (`quality`),
|
||||||
KEY `idx_last_refresh_meta_time` (`last_refresh_meta_time`),
|
KEY `idx_last_refresh_meta_time` (`last_refresh_meta_time`),
|
||||||
|
@ -1889,3 +1889,20 @@ CREATE TABLE `t_server_task_battle_count` (
|
|||||||
`modifytime` int(11) NOT NULL DEFAULT '0' COMMENT '修改时间',
|
`modifytime` int(11) NOT NULL DEFAULT '0' COMMENT '修改时间',
|
||||||
PRIMARY KEY (`idx`)
|
PRIMARY KEY (`idx`)
|
||||||
) ENGINE=InnoDB AUTO_INCREMENT=10000 DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
|
) ENGINE=InnoDB AUTO_INCREMENT=10000 DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
|
||||||
|
/*!40101 SET character_set_client = @saved_cs_client */;
|
||||||
|
|
||||||
|
DROP TABLE IF EXISTS `t_server_task_battle_count`;
|
||||||
|
/*!40101 SET @saved_cs_client = @@character_set_client */;
|
||||||
|
/*!40101 SET character_set_client = utf8 */;
|
||||||
|
CREATE TABLE `t_server_task_battle_count` (
|
||||||
|
`idx` bigint NOT NULL AUTO_INCREMENT COMMENT '自增id',
|
||||||
|
`account_id` varchar(60) CHARACTER SET utf8 NOT NULL COMMENT 'account_id',
|
||||||
|
`period` int(11) NOT NULL DEFAULT '0' COMMENT '周期',
|
||||||
|
`loot_index` int(11) NOT NULL DEFAULT '0' COMMENT '掉落包索引',
|
||||||
|
`state` int(11) NOT NULL DEFAULT '0' COMMENT '1:总计数 2:循环计数',
|
||||||
|
`val` bigint(20) NOT NULL DEFAULT '0' COMMENT 'val',
|
||||||
|
`createtime` int(11) NOT NULL DEFAULT '0' COMMENT '创建时间',
|
||||||
|
`modifytime` int(11) NOT NULL DEFAULT '0' COMMENT '修改时间',
|
||||||
|
PRIMARY KEY (`idx`)
|
||||||
|
) ENGINE=InnoDB AUTO_INCREMENT=10000 DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
|
||||||
|
/*!40101 SET character_set_client = @saved_cs_client */;
|
||||||
|
@ -88,8 +88,9 @@ class BaseAuthedController extends BaseController {
|
|||||||
// }
|
// }
|
||||||
// }
|
// }
|
||||||
if (SERVER_ENV == _ONLINE) {
|
if (SERVER_ENV == _ONLINE) {
|
||||||
//phpcommon\sendError(1001, 'session expiration');
|
phpcommon\sendError(1001, 'session expiration');
|
||||||
//die();
|
die();
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
$this->accountId = getReqVal('account_id', '');
|
$this->accountId = getReqVal('account_id', '');
|
||||||
$this->sessionId = getReqVal('session_id', '');
|
$this->sessionId = getReqVal('session_id', '');
|
||||||
|
@ -124,6 +124,8 @@ class BlockChainController extends BaseAuthedController {
|
|||||||
switch ($type) {
|
switch ($type) {
|
||||||
case 1:
|
case 1:
|
||||||
{
|
{
|
||||||
|
myself()->_rspErr(1, 'server internal error');
|
||||||
|
return;
|
||||||
$heroDb = Hero::find($uniid);
|
$heroDb = Hero::find($uniid);
|
||||||
if (!$heroDb) {
|
if (!$heroDb) {
|
||||||
myself()->_rspErr(1, 'hero not found');
|
myself()->_rspErr(1, 'hero not found');
|
||||||
@ -145,7 +147,7 @@ class BlockChainController extends BaseAuthedController {
|
|||||||
myself()->_getNowTime(),
|
myself()->_getNowTime(),
|
||||||
myself()->_getAddress()
|
myself()->_getAddress()
|
||||||
);
|
);
|
||||||
Hero::safeUpdateTokenId($heroDb['hero_uniid'], $tokenId);
|
Hero::safeUpdateTokenId(myself()->_getAccountId(), $heroDb['hero_uniid'], $tokenId);
|
||||||
$heroDb = Hero::find($uniid);
|
$heroDb = Hero::find($uniid);
|
||||||
if (!$heroDb) {
|
if (!$heroDb) {
|
||||||
myself()->_rspErr(1, 'hero not found');
|
myself()->_rspErr(1, 'hero not found');
|
||||||
|
114
webapp/controller/OutAppMintController.class.php
Normal file
114
webapp/controller/OutAppMintController.class.php
Normal file
@ -0,0 +1,114 @@
|
|||||||
|
<?php
|
||||||
|
use phpcommon\SqlHelper;
|
||||||
|
require_once('models/Nft.php');
|
||||||
|
require_once('models/User.php');
|
||||||
|
require_once('models/Hero.php');
|
||||||
|
require_once('models/BuyRecord.php');
|
||||||
|
require_once('services/NftService.php');
|
||||||
|
require_once('mt/NftDesc.php');
|
||||||
|
require_once('mt/Hero.php');
|
||||||
|
require_once('mt/EconomyAttribute.php');
|
||||||
|
|
||||||
|
use models\Nft;
|
||||||
|
use models\User;
|
||||||
|
use models\Hero;
|
||||||
|
use models\BuyRecord;
|
||||||
|
|
||||||
|
class OutAppMintController extends BaseController {
|
||||||
|
|
||||||
|
public function mintHero()
|
||||||
|
{
|
||||||
|
error_log(json_encode($_REQUEST));
|
||||||
|
$accountId = getReqVal('account_id', '');
|
||||||
|
//$accountAddress = User::findUserAddress($accountId);
|
||||||
|
//$accountAddress = '0x0c6c7399f1b6b19e96950ef294685bfd0dc46434';
|
||||||
|
$accountAddress = getReqVal('account_address', '');
|
||||||
|
$toAddress = getReqVal('to_address', '');
|
||||||
|
$uniid = getReqVal('uniid', 0);
|
||||||
|
error_log(json_encode(array(
|
||||||
|
'accoutn_id' => $accountId,
|
||||||
|
'uuid' => $uniid
|
||||||
|
)));
|
||||||
|
$heroDb = Hero::findByAccountIdEx($accountId, $uniid);
|
||||||
|
if (!$heroDb) {
|
||||||
|
myself()->_rspErr(1, 'hero not found');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if ($heroDb['quality'] <= 1) {
|
||||||
|
myself()->_rspErr(1, 'hero is N quality');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
/*
|
||||||
|
if (!$heroDb['seal_type']) {
|
||||||
|
myself()->_rspErr(1, 'hero no seal');
|
||||||
|
return;
|
||||||
|
}*/
|
||||||
|
$isMint = true;
|
||||||
|
$tokenId = $heroDb['token_id'];
|
||||||
|
if ($heroDb['token_id'] && $heroDb['activate']) {
|
||||||
|
myself()->_rspErr(1, 'hero already on chain');
|
||||||
|
return;
|
||||||
|
$isMint = false;
|
||||||
|
} else if (empty($tokenId) ){
|
||||||
|
$tokenId = BuyRecord::genOrderId
|
||||||
|
(
|
||||||
|
GAME_ID,
|
||||||
|
phpcommon\BC_FUNC_CREATION,
|
||||||
|
myself()->_getNowTime(),
|
||||||
|
$accountAddress
|
||||||
|
);
|
||||||
|
Hero::safeUpdateTokenId($accountId, $heroDb['idx'], $tokenId);
|
||||||
|
$heroDb = Hero::findByAccountIdEx($accountId, $uniid);
|
||||||
|
if (!$heroDb) {
|
||||||
|
myself()->_rspErr(1, 'hero not found');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if ($heroDb['token_id'] != $tokenId) {
|
||||||
|
myself()->_rspErr(500, 'server internal error');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$params = array(
|
||||||
|
'c' => 'BcService',
|
||||||
|
'a' => 'mintHero',
|
||||||
|
'account_id' => $accountId,
|
||||||
|
'account_address' => $accountAddress,
|
||||||
|
'token_ids' => $tokenId,
|
||||||
|
'nft_address' => NORMAL_HERO_CONTRACT_ADDRESS,
|
||||||
|
'to_address' => $toAddress,
|
||||||
|
'net_id' => NET_ID
|
||||||
|
);
|
||||||
|
error_log(json_encode($params));
|
||||||
|
{
|
||||||
|
$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) {
|
||||||
|
myself()->_rspData(array(
|
||||||
|
'trans_id' => '',
|
||||||
|
'trans_req' => $rspObj['trans_req']
|
||||||
|
));
|
||||||
|
} else {
|
||||||
|
myself()->_rspErr(500, 'server internal error');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static function getWeb3ServiceUrl()
|
||||||
|
{
|
||||||
|
$web3ServiceCluster = require_once('../config/web3service.cluster.php');
|
||||||
|
return $web3ServiceCluster[rand() % count($web3ServiceCluster)];
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -156,6 +156,7 @@ class OutAppNftController extends BaseController {
|
|||||||
$nftDb = Nft::getNftByNetIdTokenTypeTokenId($netId, $tokenType, $tokenId);
|
$nftDb = Nft::getNftByNetIdTokenTypeTokenId($netId, $tokenType, $tokenId);
|
||||||
switch ($tokenType) {
|
switch ($tokenType) {
|
||||||
case Nft::HERO_TYPE:
|
case Nft::HERO_TYPE:
|
||||||
|
case Nft::GCARD_HERO_TYPE:
|
||||||
{
|
{
|
||||||
$heroDb = Hero::findByTokenId2($tokenId);
|
$heroDb = Hero::findByTokenId2($tokenId);
|
||||||
if (!$heroDb){
|
if (!$heroDb){
|
||||||
@ -300,6 +301,7 @@ class OutAppNftController extends BaseController {
|
|||||||
$info['owner_address'] = $nftDb['owner_address'];
|
$info['owner_address'] = $nftDb['owner_address'];
|
||||||
switch ($nftDb['token_type']) {
|
switch ($nftDb['token_type']) {
|
||||||
case Nft::HERO_TYPE:
|
case Nft::HERO_TYPE:
|
||||||
|
case Nft::GCARD_HERO_TYPE:
|
||||||
{
|
{
|
||||||
$heroDb = Hero::findByTokenId2($nftDb['token_id']);
|
$heroDb = Hero::findByTokenId2($nftDb['token_id']);
|
||||||
if ($heroDb) {
|
if ($heroDb) {
|
||||||
@ -351,6 +353,15 @@ class OutAppNftController extends BaseController {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case Nft::FOUNDER_TAG_TYPE:
|
||||||
|
{
|
||||||
|
$info['meta_url'] = 'https://nftmint.counterfire.games/nft/202403/' . $nftDb['token_id'];
|
||||||
|
$info['name'] = 'Founder’s Tag #1';
|
||||||
|
$info['item_id'] = 0;
|
||||||
|
$info['type'] = $nftDb['token_type'];
|
||||||
|
$info['image'] = 'https://gateway.pinata.cloud/ipfs/QmNcUxWcNF85mx6aQp7PVNWJ89d9PqMpaHUT9vQTSTatGq';
|
||||||
|
}
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -432,14 +443,75 @@ class OutAppNftController extends BaseController {
|
|||||||
private function getRealHeroQuality($heroDb)
|
private function getRealHeroQuality($heroDb)
|
||||||
{
|
{
|
||||||
$quality = $heroDb['quality'];;
|
$quality = $heroDb['quality'];;
|
||||||
if ($heroDb['createtime'] <= 1719985966) {
|
$quality = $quality - 1;
|
||||||
} else {
|
if ($quality <= 0) {
|
||||||
$quality = $quality - 1;
|
$quality = 1;
|
||||||
if ($quality <= 0) {
|
|
||||||
$quality = 1;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return $quality;
|
return $quality;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getHeroList()
|
||||||
|
{
|
||||||
|
$accountId = getReqVal('account_id', '');
|
||||||
|
$rows = SqlHelper::ormSelect(
|
||||||
|
myself()->_getMysql($accountId),
|
||||||
|
't_hero',
|
||||||
|
array(
|
||||||
|
'account_id' => $accountId,
|
||||||
|
)
|
||||||
|
);
|
||||||
|
$rspData = array(
|
||||||
|
'rows' => array()
|
||||||
|
);
|
||||||
|
foreach ($rows as $row) {
|
||||||
|
if ($row['quality'] <= 1) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
$info = array(
|
||||||
|
'uniid' => '',
|
||||||
|
'net_id' => 0,
|
||||||
|
'contract_address' => '',
|
||||||
|
'token_id' => '',
|
||||||
|
'owner_address' => '',
|
||||||
|
'meta_url' => '',
|
||||||
|
'name' => '',
|
||||||
|
'item_id' => 0,
|
||||||
|
'type' => 0,
|
||||||
|
'image' => '',
|
||||||
|
'on_sale' => 0,
|
||||||
|
'detail' => array()
|
||||||
|
);
|
||||||
|
$heroDb = $row;
|
||||||
|
$info['uniid'] = $heroDb['idx'];
|
||||||
|
$heroAttrs = emptyReplace(json_decode($heroDb['wealth_attr'], true), array());
|
||||||
|
$heroResult = \mt\EconomyAttribute::getAttrValue($heroAttrs);
|
||||||
|
$wealth = $heroResult['wealth'];
|
||||||
|
$wealth_rate = $heroResult['wealth_rate'];
|
||||||
|
$lucky = $heroResult['lucky'];
|
||||||
|
$lucky_rate = $heroResult['lucky_rate'];
|
||||||
|
$heroAbility = Hero::abilityInfo($heroDb);
|
||||||
|
$heroMeta = \mt\Hero::get($heroDb['hero_id']);
|
||||||
|
if ($heroMeta) {
|
||||||
|
$itemMeta = \mt\Item::get($heroDb['hero_id']);
|
||||||
|
$heroAtteMeta = \mt\EconomyAttribute::findByGrade($itemMeta['relationship'],$heroDb['quality']);
|
||||||
|
//$info['meta_url'] = NFT_META_URL . '/hero/meta/' . $nftDb['net_id'] . '/' . $nftDb['token_id'];
|
||||||
|
$info['name'] = $heroMeta['name'];
|
||||||
|
$info['item_id'] = $heroMeta['id'];
|
||||||
|
$info['type'] = Nft::HERO_TYPE;
|
||||||
|
$info['image'] = 'https://res2.counterfire.games/nft/meta/' . $heroMeta['id'] . '_' . $this->getRealHeroQuality($heroDb) . '.gif';
|
||||||
|
$info['detail']['quality'] = $this->getRealHeroQuality($heroDb);
|
||||||
|
$info['detail']['max_mining_days'] = $heroAtteMeta['validTime'];
|
||||||
|
$info['detail']['wealth'] = floor($wealth * (1+$wealth_rate));
|
||||||
|
$info['detail']['lucky'] = floor($lucky * (1+$lucky_rate));
|
||||||
|
$info['detail']['hp'] = $heroAbility['hp'];
|
||||||
|
$info['detail']['atk'] = $heroAbility['attack'];
|
||||||
|
$info['detail']['def'] = $heroAbility['defence'];
|
||||||
|
$info['detail']['block'] = $heroAbility['block'];
|
||||||
|
$info['detail']['crit'] = $heroAbility['critical'];
|
||||||
|
}
|
||||||
|
array_push($rspData['rows'], $info);
|
||||||
|
}
|
||||||
|
myself()->_rspData($rspData);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -72,6 +72,22 @@ class Hero extends BaseModel {
|
|||||||
return self::internalFind($accountId, User::findUserAddress($accountId), $heroUniId);
|
return self::internalFind($accountId, User::findUserAddress($accountId), $heroUniId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static function findByAccountIdEx($accountId, $heroUniId)
|
||||||
|
{
|
||||||
|
$row = SqlHelper::ormSelectOne(
|
||||||
|
myself()->_getMysql($accountId),
|
||||||
|
't_hero',
|
||||||
|
array(
|
||||||
|
'idx' => $heroUniId,
|
||||||
|
'account_id' => $accountId,
|
||||||
|
)
|
||||||
|
);
|
||||||
|
if ($row) {
|
||||||
|
$row['hero_uniid'] = $row['idx'];
|
||||||
|
}
|
||||||
|
return $row;
|
||||||
|
}
|
||||||
|
|
||||||
public static function findByTokenId($tokenId)
|
public static function findByTokenId($tokenId)
|
||||||
{
|
{
|
||||||
$row = SqlHelper::ormSelectOne(
|
$row = SqlHelper::ormSelectOne(
|
||||||
@ -673,18 +689,17 @@ class Hero extends BaseModel {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function safeUpdateTokenId($heroUniId, $tokenId)
|
public static function safeUpdateTokenId($accountId, $heroUniId, $tokenId)
|
||||||
{
|
{
|
||||||
if (self::find($heroUniId)) {
|
myself()->_getMysql($accountId)->execScript(
|
||||||
myself()->_getSelfMysql()->execScript(
|
'UPDATE t_hero SET token_id=:token_id ' .
|
||||||
'UPDATE t_hero SET token_id=:token_id ' .
|
'WHERE idx=:idx AND account_id=:account_id AND token_id IS NULL;',
|
||||||
'WHERE idx=:idx AND token_id IS NULL;',
|
array(
|
||||||
array(
|
':idx' => $heroUniId,
|
||||||
':idx' => $heroUniId,
|
':account_id' => $accountId,
|
||||||
':token_id' => $tokenId,
|
':token_id' => $tokenId,
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function updateByTokenId($tokenId, $fieldsKv)
|
public static function updateByTokenId($tokenId, $fieldsKv)
|
||||||
|
@ -28,6 +28,8 @@ class Nft extends BaseModel
|
|||||||
const EXPLORER_TYPE = 9; //Explorer
|
const EXPLORER_TYPE = 9; //Explorer
|
||||||
const CANDY_TYPE = 10; //CANDY
|
const CANDY_TYPE = 10; //CANDY
|
||||||
const GOLD_BULLION_TYPE = 11; //金砖
|
const GOLD_BULLION_TYPE = 11; //金砖
|
||||||
|
const GCARD_HERO_TYPE = 12; //游戏内合成的nft英雄
|
||||||
|
const FOUNDER_TAG_TYPE = 13; //游戏内合成的nft英雄
|
||||||
const RING_TYPE = 19; //戒指
|
const RING_TYPE = 19; //戒指
|
||||||
const AVATAR_TYPE = 30; //装饰
|
const AVATAR_TYPE = 30; //装饰
|
||||||
|
|
||||||
|
@ -18,6 +18,7 @@ class NftService extends BaseService {
|
|||||||
private static $userData = array();
|
private static $userData = array();
|
||||||
private static $nftCfg = array(
|
private static $nftCfg = array(
|
||||||
'hero' => Nft::HERO_TYPE,
|
'hero' => Nft::HERO_TYPE,
|
||||||
|
'normal_hero' => Nft::GCARD_HERO_TYPE,
|
||||||
'equip' => Nft::EQUIP_TYPE,
|
'equip' => Nft::EQUIP_TYPE,
|
||||||
'chip' => Nft::CHIP_TYPE,
|
'chip' => Nft::CHIP_TYPE,
|
||||||
'ring' => Nft::RING_TYPE,
|
'ring' => Nft::RING_TYPE,
|
||||||
@ -36,7 +37,8 @@ class NftService extends BaseService {
|
|||||||
|
|
||||||
public static function isHeroOwner($openId, $tokenId)
|
public static function isHeroOwner($openId, $tokenId)
|
||||||
{
|
{
|
||||||
return self::internalIsOwner($openId, 'hero', $tokenId);
|
return self::internalIsOwner($openId, 'hero', $tokenId) ||
|
||||||
|
self::internalIsOwner($openId, 'normal_hero', $tokenId);;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function isEquipOwner($openId, $tokenId)
|
public static function isEquipOwner($openId, $tokenId)
|
||||||
@ -51,7 +53,9 @@ class NftService extends BaseService {
|
|||||||
|
|
||||||
public static function getHeros($openId)
|
public static function getHeros($openId)
|
||||||
{
|
{
|
||||||
return self::internalGetList($openId, 'hero');
|
$heros = self::internalGetList($openId, 'hero');
|
||||||
|
$normalHeros = self::internalGetList($openId, 'normal_hero');
|
||||||
|
return array_merge($heros, $normalHeros);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function getEquips($openId)
|
public static function getEquips($openId)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user