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

This commit is contained in:
hujiabin 2024-07-01 16:11:02 +08:00
commit 992db7830c
13 changed files with 63 additions and 53 deletions

View File

@ -102,6 +102,7 @@ class AAMarket(object):
['type', '', '0:全部 1:买进 2卖出'],
['page_size', 0, '每页大小'],
['cursor', '', '游标 第一页传空'],
['search_name', '', 'nft名字 空(所有)'],
],
'response': [
_common.RspHead(),

View File

@ -1759,6 +1759,7 @@ class NftInfo(object):
['item_id', 0, '道具id'],
['type', '', 'nft类型 1:英雄 11:金砖'],
['image', '', 'nft图片地址'],
['on_sale', 0, '是否出售中'],
['detail', Union([
[NftHeroDetailNew(), '英雄'],
[NftGoldBullionDetail(), '英雄'],

View File

@ -50,6 +50,7 @@ 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_token_id` (`net_id`, `token_type`, `token_id`),
KEY `idx_last_owner_address` (`last_owner_address`),
KEY `idx_item_id` (`item_id`),
KEY `owner_address` (`owner_address`)
) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
/*!40101 SET character_set_client = @saved_cs_client */;
@ -155,6 +156,7 @@ CREATE TABLE `t_order` (
`status` varchar(60) NOT NULL DEFAULT '' COMMENT 'status',
`net_id` bigint NOT NULL DEFAULT '0' COMMENT 'net_id',
`token_id` varchar(60) NOT NULL DEFAULT '' COMMENT 'token_id',
`seller_address` varchar(60) NOT NULL DEFAULT '' COMMENT 'seller_address',
`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',
@ -183,6 +185,7 @@ CREATE TABLE `t_order` (
KEY `idx_event_id` (`event_id`),
KEY `idx_contract_address` (`contract_address`),
KEY `idx_token_id` (`token_id`),
KEY `idx_seller_address` (`seller_address`),
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 */;
@ -214,6 +217,7 @@ CREATE TABLE `t_sale` (
PRIMARY KEY (`idx`),
UNIQUE KEY `idx_order_id` (`order_id`),
KEY `idx_buyer` (`buyer`),
KEY `idx_item_id` (`item_id`),
KEY `idx_seller` (`seller`)
) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
/*!40101 SET character_set_client = @saved_cs_client */;

View File

@ -1755,36 +1755,6 @@ CREATE TABLE `t_sub_user_bind` (
-- Table structure for table `t_gold_bullion`
--
DROP TABLE IF EXISTS `t_gold_bullion`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `t_gold_bullion` (
`idx` bigint NOT NULL AUTO_INCREMENT COMMENT '自增id',
`src_account_id` varchar(60) NOT NULL DEFAULT '' COMMENT '账号id(channel + "_" + gameid + "_" + openid)',
`src_address` varchar(60) COMMENT 'src_address',
`token_id` varchar(60) NOT NULL DEFAULT '' COMMENT 'token_id',
`net_id` int(11) NOT NULL DEFAULT '0' COMMENT '链id',
`gold` bigint NOT NULL DEFAULT '0' COMMENT '金币',
`address` varchar(60) COMMENT 'address',
`status` int(11) NOT NULL DEFAULT '0' COMMENT '状态 0:初始 1:已打开',
`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 '是否已上连',
`activate_time` int(11) NOT NULL DEFAULT '0' COMMENT '上链成功时间',
`createtime` int(11) NOT NULL DEFAULT '0' COMMENT '创建时间',
`modifytime` int(11) NOT NULL DEFAULT '0' COMMENT '修改时间',
PRIMARY KEY (`idx`),
UNIQUE KEY `idx_token_id` (`token_id`),
UNIQUE KEY `idx_token_id_net_id` (`token_id`, `net_id`),
KEY `idx_address` (`address`),
KEY `idx_address_createtime_activate_status` (`address`, `createtime`, `activate`, `status`)
) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `t_gold_bullion`
--
DROP TABLE IF EXISTS `t_gold_bullion`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;

View File

@ -1 +0,0 @@
../bcnftdb.sql

View File

@ -1 +0,0 @@
../gamedb.sql

View File

@ -1 +0,0 @@
../gamedb2006_migrate_240129_01.sql

View File

@ -90,11 +90,22 @@ class BaseAuthedController extends BaseController {
$this->accountId = getReqVal('account_id', '');
$this->sessionId = getReqVal('session_id', '');
if (SERVER_ENV != _DEBUG) {
if (!phpcommon\isValidSessionId($this->accountId,
$this->sessionId)) {
phpcommon\sendError(500, 'invalid session_id');
die();
}
if (SERVER_ENV == _TEST) {
if ($this->sessionId == "CzRXrGHxwQZJNCeXkTRA") {
} else {
if (!phpcommon\isValidSessionId($this->accountId,
$this->sessionId)) {
phpcommon\sendError(500, 'invalid session_id');
die();
}
}
} else {
if (!phpcommon\isValidSessionId($this->accountId,
$this->sessionId)) {
phpcommon\sendError(500, 'invalid session_id');
die();
}
}
}
if (!(myself()->_getChannel() == IMTBL_CHANNEL ||
myself()->_getChannel() == GUEST_CHANNEL)) {

View File

@ -166,9 +166,9 @@ class OutAppNftController extends BaseController {
break;
case Nft::GOLD_BULLION_TYPE:
{
$NftMeta = \mt\NftDesc::getByItemId($nftDb['item_id']);
//$info['name'] = $heroMeta['name'];
$info['description'] = $NftMeta['desc'];
$nftMeta = \mt\NftDesc::getByItemId($nftDb['item_id']);
$info['name'] = $nftMeta['name'];
$info['description'] = $nftMeta['desc'];
$info['image'] = "https://res2.counterfire.games/nft/meta/".$nftDb['item_id'].".png";
if ($this->isCloseBox()) {
$this->fillBoxMeta($info);
@ -233,6 +233,7 @@ class OutAppNftController extends BaseController {
private function internalNftDetail($netId, &$nftDb, &$info)
{
$onSale = $this->nftIsOnSale($nftDb['net_id'], $nftDb['contract_address'], $nftDb['token_id']);
$info = array(
'net_id' => $netId,
'contract_address' => '',
@ -243,6 +244,7 @@ class OutAppNftController extends BaseController {
'item_id' => 0,
'type' => 0,
'image' => '',
'on_sale' => $onSale,
'detail' => array()
);
if (!empty($nftDb)) {
@ -293,13 +295,13 @@ class OutAppNftController extends BaseController {
break;
case Nft::GOLD_BULLION_TYPE:
{
$itemMeta = \mt\Item::get($nftDb['item_id']);
if ($itemMeta) {
$nftMeta = \mt\NftDesc::getByItemId($nftDb['item_id']);
if ($nftMeta) {
$info['meta_url'] = NFT_META_URL . '/gold_bullion/meta/' . $nftDb['net_id'] . '/' . $nftDb['token_id'];
$info['name'] = $itemMeta['name'];
$info['item_id'] = $itemMeta['id'];
$info['name'] = $nftMeta['name'];
$info['item_id'] = $nftMeta['item_id'];
$info['type'] = $nftDb['token_type'];
$info['image'] = 'https://res2.counterfire.games/nft/meta/' . $itemMeta['id'] . '.png';
$info['image'] = 'https://res2.counterfire.games/nft/meta/' . $nftMeta['item_id'] . '.png';
$info['detail']['gold_coins'] = $this->getGoldBullionGoldNum($nftDb['item_id']);
}
if ($this->isCloseBox()) {
@ -332,7 +334,7 @@ class OutAppNftController extends BaseController {
private function isCloseBox()
{
$openTime = 1719828000;
$openTime = 1719828000 + 3600 * 24;
if (myself()->_getNowTime() < $openTime) {
if (SERVER_ENV == _ONLINE) {
return true;
@ -343,8 +345,8 @@ class OutAppNftController extends BaseController {
private function fillBoxMeta(&$info)
{
$info['name'] = 'box';
$info['description'] = 'box';
$info['name'] = 'Genesis Hero';
$info['description'] = 'Genesis Hero';
$info['image'] = "https://res2.counterfire.games/nft/box/Gen2_raw.gif";
$info['attributes'] = array();
}
@ -357,12 +359,28 @@ class OutAppNftController extends BaseController {
'token_id' => $info['token_id'],
'owner_address' => $info['owner_address'],
'meta_url' => $info['meta_url'],
'name' => 'box',
'name' => 'Genesis Hero',
'item_id' => 0,
'type' => $info['type'],
'image' => "https://res2.counterfire.games/nft/box/Gen2_raw.gif",
'on_sale' => $info['on_sale'],
'detail' => array()
);
}
private function nftIsOnSale($netId, $contractAddress, $tokenId)
{
$row = SqlHelper::ormSelectOne(
myself()->_getMarketMysql(),
't_order',
array(
'net_id' => $netId,
'contract_address' => $contractAddress,
'token_id' => $tokenId,
'status' => 'ACTIVE',
)
);
return $row ? 1 : 0;
}
}

View File

@ -10,6 +10,7 @@ class DynData extends BaseModel {
public static function preload()
{
if (is_null(self::$dynData)) {
self::$lastAccountId = myself()->_getAccountId();
self::$dynData = array();
$rows = SqlHelper::ormSelect(
myself()->_getSelfMysql(),

View File

@ -116,9 +116,12 @@ class RoomBattleDataService extends BaseService {
$member['new_elo'] = $newElo;
}
$this->_getBattleRewards($userDb,$heroDb,$battleScore,$myTeamScoreAvg,$myTeamScore,$member['reward']);
myself()->_addItems($member['reward'], $awardService,$propertyChgService);
if ($this->mapMode == mt\MapMode::GOLD_MODE && $member['move_distance'] <= 2000 ){
error_log("金币模式:消极战斗");
}else{
$this->_getBattleRewards($userDb,$heroDb,$battleScore,$myTeamScoreAvg,$myTeamScore,$member['reward']);
myself()->_addItems($member['reward'], $awardService,$propertyChgService);
}
$battleSingleDb = BattleSettlement::findSingle($this->battleSettlementDb['battle_uuid']);
if ($battleSingleDb){

View File

@ -561,6 +561,8 @@ class TameBattleDataService extends BaseService {
'dead'=> getXVal($this->battleInfo,'dead', 0),
'skin_id'=> getXVal($this->battleInfo,'skin_id', 0),
'is_mvp'=> getXVal($this->battleInfo,'is_mvp', 0),
'damage_out'=> getXVal($this->battleInfo,'damage_out', 0),
'move_distance'=> getXVal($this->battleInfo,'move_distance', 0),
'old_rank'=> $oldRank,
'new_rank'=> $newRank,
'old_score'=> $oldScore,
@ -691,6 +693,8 @@ class TameBattleDataService extends BaseService {
'dead'=> getXVal($info,'dead', 0),
'skin_id'=> getXVal($info,'skin_id', 0),
'is_mvp'=> getXVal($info,'is_mvp', 0),
'damage_out'=> getXVal($info,'damage_out', 0),
'move_distance'=> getXVal($info,'move_distance', 0),
'old_rank'=> $oldRank,
'new_rank'=> $newRank,
'old_score'=> $oldScore,