diff --git a/doc/AAMarket.py b/doc/AAMarket.py index 1c140b57..a1d52261 100644 --- a/doc/AAMarket.py +++ b/doc/AAMarket.py @@ -102,6 +102,7 @@ class AAMarket(object): ['type', '', '0:全部 1:买进 2:卖出'], ['page_size', 0, '每页大小'], ['cursor', '', '游标 第一页传空'], + ['search_name', '', 'nft名字 空(所有)'], ], 'response': [ _common.RspHead(), diff --git a/doc/_common.py b/doc/_common.py index 69377d02..b9fe7529 100644 --- a/doc/_common.py +++ b/doc/_common.py @@ -1759,6 +1759,7 @@ class NftInfo(object): ['item_id', 0, '道具id'], ['type', '', 'nft类型 1:英雄 11:金砖'], ['image', '', 'nft图片地址'], + ['on_sale', 0, '是否出售中'], ['detail', Union([ [NftHeroDetailNew(), '英雄'], [NftGoldBullionDetail(), '英雄'], diff --git a/sql/gamedb2006_migrate_240521_01.sql b/sql/archived/gamedb2006_migrate_240521_01.sql similarity index 100% rename from sql/gamedb2006_migrate_240521_01.sql rename to sql/archived/gamedb2006_migrate_240521_01.sql diff --git a/sql/bcnftdb.sql b/sql/bcnftdb.sql index 53574e5f..eca0939a 100644 --- a/sql/bcnftdb.sql +++ b/sql/bcnftdb.sql @@ -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 */; diff --git a/sql/gamedb.sql b/sql/gamedb.sql index af580ab7..c1f8d8bc 100644 --- a/sql/gamedb.sql +++ b/sql/gamedb.sql @@ -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 */; diff --git a/sql/migrate/bcnftdb.sql b/sql/migrate/bcnftdb.sql deleted file mode 120000 index 82e907ca..00000000 --- a/sql/migrate/bcnftdb.sql +++ /dev/null @@ -1 +0,0 @@ -../bcnftdb.sql \ No newline at end of file diff --git a/sql/migrate/gamedb.sql b/sql/migrate/gamedb.sql deleted file mode 120000 index e3faeb33..00000000 --- a/sql/migrate/gamedb.sql +++ /dev/null @@ -1 +0,0 @@ -../gamedb.sql \ No newline at end of file diff --git a/sql/migrate/gamedb2006_migrate_240129_01.sql b/sql/migrate/gamedb2006_migrate_240129_01.sql deleted file mode 120000 index e27ab0d2..00000000 --- a/sql/migrate/gamedb2006_migrate_240129_01.sql +++ /dev/null @@ -1 +0,0 @@ -../gamedb2006_migrate_240129_01.sql \ No newline at end of file diff --git a/webapp/controller/BaseAuthedController.class.php b/webapp/controller/BaseAuthedController.class.php index 526a27d0..7b3b8d44 100644 --- a/webapp/controller/BaseAuthedController.class.php +++ b/webapp/controller/BaseAuthedController.class.php @@ -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)) { diff --git a/webapp/controller/OutAppNftController.class.php b/webapp/controller/OutAppNftController.class.php index b876dadd..2fba8c41 100644 --- a/webapp/controller/OutAppNftController.class.php +++ b/webapp/controller/OutAppNftController.class.php @@ -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; + } + } diff --git a/webapp/models/DynData.php b/webapp/models/DynData.php index d54e626e..09699b7d 100644 --- a/webapp/models/DynData.php +++ b/webapp/models/DynData.php @@ -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(), diff --git a/webapp/services/RoomBattleDataService.php b/webapp/services/RoomBattleDataService.php index b1010598..96016ba3 100644 --- a/webapp/services/RoomBattleDataService.php +++ b/webapp/services/RoomBattleDataService.php @@ -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){ diff --git a/webapp/services/TameBattleDataService.php b/webapp/services/TameBattleDataService.php index 80fcc3f4..25382523 100644 --- a/webapp/services/TameBattleDataService.php +++ b/webapp/services/TameBattleDataService.php @@ -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,