Merge branch 'hjb' of git.kingsome.cn:server/game2006api into hjb

This commit is contained in:
hujiabin 2024-06-27 19:36:44 +08:00
commit 0379f28378
4 changed files with 74 additions and 6 deletions

View File

@ -157,11 +157,16 @@ CREATE TABLE `t_order` (
`token_id` varchar(60) NOT NULL DEFAULT '' COMMENT 'token_id',
`contract_address` varchar(60) NOT NULL DEFAULT '' COMMENT 'contract_address',
`item_id` int(11) NOT NULL DEFAULT '0' COMMENT 'item_id',
`hero_quality` int(11) NOT NULL DEFAULT '0' COMMENT 'hero_quality',
`price` varchar(60) NOT NULL DEFAULT '' COMMENT 'price',
`src_price_exchange_rate` bigint(11) NOT NULL DEFAULT '0' COMMENT 'src_price_exchange_rate',
`src_price_amount` varchar(60) NOT NULL DEFAULT '' COMMENT 'src_price_amount',
`src_price_contract_address` varchar(60) NOT NULL DEFAULT '' COMMENT 'src_price_contract_address',
`src_price_item_type` varchar(60) NOT NULL DEFAULT '' COMMENT 'src_price_item_type',
`start_time` int(11) NOT NULL DEFAULT '0' COMMENT 'start_time',
`end_time` int(11) NOT NULL DEFAULT '0' COMMENT 'end_time',
`created_at` int(11) NOT NULL DEFAULT '0' COMMENT 'created_at',
`update_at` int(11) NOT NULL DEFAULT '0' COMMENT 'update_at',
`updated_at` int(11) NOT NULL DEFAULT '0' COMMENT 'updated_at',
`event_id` varchar(60) NOT NULL DEFAULT '' COMMENT '事件id',
`event_data` mediumblob COMMENT '事件内容',
`createtime` int(11) NOT NULL DEFAULT '0' COMMENT '创建时间',
@ -169,6 +174,12 @@ CREATE TABLE `t_order` (
PRIMARY KEY (`idx`),
UNIQUE KEY `idx_net_id_contract_address_token_id` (`net_id`, `contract_address`, `token_id`),
KEY `idx_status` (`status`),
KEY `idx_item_id` (`item_id`),
KEY `idx_hero_quality` (`hero_quality`),
KEY `idx_price` (`price`),
KEY `idx_event_id` (`event_id`),
KEY `idx_contract_address` (`contract_address`),
KEY `idx_token_id` (`token_id`),
KEY `idx_order_id` (`order_id`)
) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
/*!40101 SET character_set_client = @saved_cs_client */;
@ -189,6 +200,10 @@ CREATE TABLE `t_sale` (
`contract_address` varchar(60) NOT NULL DEFAULT '' COMMENT 'contract_address',
`buyer` varchar(60) NOT NULL DEFAULT '' COMMENT 'buyer',
`seller` varchar(60) NOT NULL DEFAULT '' COMMENT 'seller',
`item_id` int(11) NOT NULL DEFAULT '0' COMMENT 'item_id',
`hero_quality` int(11) NOT NULL DEFAULT '0' COMMENT 'hero_quality',
`price` varchar(60) NOT NULL DEFAULT '' COMMENT 'price',
`indexed_at` int(11) NOT NULL DEFAULT '0' COMMENT 'indexed_at',
`event_id` varchar(60) NOT NULL DEFAULT '' COMMENT '事件id',
`event_data` mediumblob COMMENT '事件内容',
`createtime` int(11) NOT NULL DEFAULT '0' COMMENT '创建时间',

View File

@ -171,6 +171,7 @@ CREATE TABLE `t_hero` (
`active_count` int(11) NOT NULL DEFAULT '0' COMMENT 'active_count',
`activate` int(11) NOT NULL DEFAULT '0' COMMENT '是否激活 1已初始激活',
`activate_time` int(11) NOT NULL DEFAULT '0' COMMENT '激活时间',
`on_chain_time` int(11) NOT NULL DEFAULT '0' COMMENT '上链时间',
`wealth_attr` mediumblob COMMENT '财富值属性',
`seal_type` int(11) NOT NULL DEFAULT '0' COMMENT '0:未封存 1已封存',
`unseal_time` int(11) NOT NULL DEFAULT '0' COMMENT '解开封时间',
@ -1796,11 +1797,12 @@ CREATE TABLE `t_gold_bullion` (
`item_id` int(11) NOT NULL DEFAULT '0' COMMENT '道具id',
`gold` bigint NOT NULL DEFAULT '0' COMMENT '金币',
`status` int(11) NOT NULL DEFAULT '0' COMMENT '状态 0:初始 1:已开',
`open_status` int(11) NOT NULL DEFAULT '0' COMMENT '1: 已发送 2:未发送 3:已领取',
`open_status` int(11) NOT NULL DEFAULT '0' COMMENT '1: 已发送 2:已领取',
`open_address` varchar(60) COMMENT 'open_address',
`open_time` int(11) NOT NULL DEFAULT '0' COMMENT 'open_time',
`open_account_id` varchar(60) NOT NULL DEFAULT '' COMMENT '账号id(channel + "_" + gameid + "_" + openid)',
`open_uniqid` varchar(60) NOT NULL DEFAULT '' COMMENT '开启的本次唯一id',
`return_status` int(11) NOT NULL DEFAULT '0' COMMENT '1: 已发送 2:已领取',
`returned` int(11) NOT NULL DEFAULT '0' COMMENT '是否已超时返还',
`return_time` int(11) NOT NULL DEFAULT '0' COMMENT '返还时间',
`activated` int(11) NOT NULL DEFAULT '0' COMMENT '是否已上连',

View File

@ -129,6 +129,10 @@ class BlockChainController extends BaseAuthedController {
myself()->_rspErr(1, 'hero not found');
return;
}
if (!$heroDb['seal_type']) {
myself()->_rspErr(1, 'hero no seal');
return;
}
$isMint = true;
$tokenId = $heroDb['token_id'];
if ($heroDb['token_id'] && $heroDb['activate']) {

View File

@ -153,12 +153,15 @@ class OutAppNftController extends BaseController {
$NftMeta = \mt\NftDesc::getByItemId($heroDb['hero_id']);
$info['name'] = $heroMeta['name'];
$info['description'] = $NftMeta['desc'];
$info['image'] = "https://res2.cebggame.com/nft/meta/".$heroDb['hero_id'].'_'.$heroDb['quality'].".gif";
$info['image'] = "https://res2.counterfire.games/nft/meta/".$heroDb['hero_id'].'_'.$heroDb['quality'].".gif";
array_push($info['attributes'],array(
"trait_type" => "level",
"value" => intval($heroDb['hero_lv']),
"max_value" => 15,
));
if ($this->isCloseBox()) {
$this->fillBoxMeta($info);
}
}
break;
case Nft::GOLD_BULLION_TYPE:
@ -166,7 +169,10 @@ class OutAppNftController extends BaseController {
$NftMeta = \mt\NftDesc::getByItemId($nftDb['item_id']);
//$info['name'] = $heroMeta['name'];
$info['description'] = $NftMeta['desc'];
$info['image'] = "https://res2.cebggame.com/nft/meta/".$nftDb['item_id'].".png";
$info['image'] = "https://res2.counterfire.games/nft/meta/".$nftDb['item_id'].".png";
if ($this->isCloseBox()) {
$this->fillBoxMeta($info);
}
}
break;
}
@ -268,7 +274,7 @@ class OutAppNftController extends BaseController {
$info['name'] = $heroMeta['name'];
$info['item_id'] = $heroMeta['id'];
$info['type'] = $nftDb['token_type'];
$info['image'] = 'https://res2.cebggame.com/nft/meta/' . $heroMeta['id'] . '_' . $heroDb['quality'] . '.gif';
$info['image'] = 'https://res2.counterfire.games/nft/meta/' . $heroMeta['id'] . '_' . $heroDb['quality'] . '.gif';
$info['detail']['quality'] = $heroDb['quality'];
$info['detail']['max_mining_days'] = $heroAtteMeta['validTime'];
$info['detail']['wealth'] = floor($wealth * (1+$wealth_rate));
@ -280,6 +286,9 @@ class OutAppNftController extends BaseController {
$info['detail']['crit'] = $heroAbility['critical'];
}
}
if ($this->isCloseBox()) {
$this->fillBoxDetail($info);
}
}
break;
case Nft::GOLD_BULLION_TYPE:
@ -290,9 +299,12 @@ class OutAppNftController extends BaseController {
$info['name'] = $itemMeta['name'];
$info['item_id'] = $itemMeta['id'];
$info['type'] = $nftDb['token_type'];
$info['image'] = 'https://res2.cebggame.com/nft/meta/' . $itemMeta['id'] . '.png';
$info['image'] = 'https://res2.counterfire.games/nft/meta/' . $itemMeta['id'] . '.png';
$info['detail']['gold_coins'] = $this->getGoldBullionGoldNum($nftDb['item_id']);
}
if ($this->isCloseBox()) {
$this->fillBoxDetail($info);
}
}
break;
}
@ -318,4 +330,39 @@ class OutAppNftController extends BaseController {
}
}
private function isCloseBox()
{
$openTime = 1719828000;
if (myself()->_getNowTime() < $openTime) {
if (SERVER_ENV == _ONLINE) {
return true;
}
}
return false;
}
private function fillBoxMeta(&$info)
{
$info['name'] = 'box';
$info['description'] = 'box';
$info['image'] = "https://res2.counterfire.games/nft/box/Gen2_raw.gif";
$info['attributes'] = array();
}
private function fillBoxDetail(&$info)
{
$info = array(
'net_id' => $info['net_id'],
'contract_address' => $info['contract_address'],
'token_id' => $info['token_id'],
'owner_address' => $info['owner_address'],
'meta_url' => $info['meta_url'],
'name' => 'box',
'item_id' => 0,
'type' => $info['type'],
'image' => "https://res2.counterfire.games/nft/box/Gen2_raw.gif",
'detail' => array()
);
}
}