diff --git a/doc/ActivationCode.py b/doc/ActivationCode.py new file mode 100644 index 00000000..74fd3d0b --- /dev/null +++ b/doc/ActivationCode.py @@ -0,0 +1,36 @@ +# -*- coding: utf-8 -*- + +import _common + +class ActivationCode(object): + + def __init__(self): + self.apis = [ + { + 'name': 'bindActivationCode', + 'desc': '绑定激活码', + 'group': 'ActivationCode', + 'url': 'webapp/index.php?c=ActivationCode&a=bindActivationCode', + 'params': [ + _common.ReqHead(), + ['code', 0, '激活码'] + ], + 'response': [ + _common.RspHead(), + ] + },{ + 'name': 'getActivationCodeBindState', + 'desc': '激活码绑定状态', + 'group': 'ActivationCode', + 'url': 'webapp/index.php?c=ActivationCode&a=getActivationCodeBindState', + 'params': [ + _common.ReqHead(), + ], + 'response': [ + _common.RspHead(), + ['state', 0, '1:已激活 0:未激活'] + ] + } + ] + + diff --git a/doc/Battle.py b/doc/Battle.py index 5526437a..9e91cef8 100644 --- a/doc/Battle.py +++ b/doc/Battle.py @@ -119,6 +119,7 @@ class Battle(object): 'params': [ _common.ReqHead(), ['version', 0, '版本'], + ['is_newbie_battle', 0, '是否新手战'], ['battle_uuid', '', 'battle_uuid'], ['room_uuid', '', '房间唯一id'], ['room_mode', 0, '0:pvp 1:pve 2:moba'], @@ -155,6 +156,7 @@ class Battle(object): 'params': [ _common.ReqHead(), ['version', 0, '版本'], + ['is_newbie_battle', 0, '是否新手战'], ['room_uuid', '', '房间唯一id'], ['room_mode', 0, '0:pvp 1:pve 2:moba'], ['map_mode', 0, ''], diff --git a/doc/OutAppTools.py b/doc/OutAppTools.py new file mode 100644 index 00000000..7b5ca6cc --- /dev/null +++ b/doc/OutAppTools.py @@ -0,0 +1,19 @@ +import _common + +class OutAppTools(object): + + def __init__(self): + self.apis = [ + { + 'name': 'refreshServerSwitch', + 'desc': '刷新服务器开关配置', + 'group': 'OutAppTools', + 'url': 'webapp/index.php?c=OutAppTools&a=refreshServerSwitch', + 'params': [ + ], + 'response': [ + _common.RspHead(), + ] + }, + + ] \ No newline at end of file diff --git a/sql/gamedb2006_migrate_240710_01.sql b/sql/archived/gamedb2006_migrate_240710_01.sql similarity index 100% rename from sql/gamedb2006_migrate_240710_01.sql rename to sql/archived/gamedb2006_migrate_240710_01.sql diff --git a/sql/gamedb2006_migrate_240722_01.sql b/sql/archived/gamedb2006_migrate_240722_01.sql similarity index 100% rename from sql/gamedb2006_migrate_240722_01.sql rename to sql/archived/gamedb2006_migrate_240722_01.sql diff --git a/sql/gamedb.sql b/sql/gamedb.sql index 348423cd..8c3b6636 100644 --- a/sql/gamedb.sql +++ b/sql/gamedb.sql @@ -69,6 +69,7 @@ CREATE TABLE `t_user` ( `parachute` int(11) NOT NULL DEFAULT '0' COMMENT '降落伞ID', `ring_id` int(11) NOT NULL DEFAULT '0' COMMENT '戒指id', `star_num` int(11) NOT NULL DEFAULT '0' COMMENT '星星数(成长任务)', + `already_newbie_battle` int(11) NOT NULL DEFAULT '0' COMMENT '是否完成新手战', PRIMARY KEY (`idx`), UNIQUE KEY `account_id` (`account_id`), UNIQUE KEY `address` (`address`), diff --git a/webapp/controller/ActivationCodeController.class.php b/webapp/controller/ActivationCodeController.class.php new file mode 100644 index 00000000..9639cf13 --- /dev/null +++ b/webapp/controller/ActivationCodeController.class.php @@ -0,0 +1,29 @@ +_rspErr(1, "activation code error"); + return; + } + if (ActivationCode::verifyAccountBind()){ + $this->_rspErr(1, "The activation code has been bind"); + return; + } + ActivationCode::addBindCode($code); + $this->_rspOk(); + } + + public function getActivationCodeBindState(){ + $state = ActivationCode::verifyAccountBind() ? 1 :0; + $this->_rspData(array( + 'state' => $state + )); + } + +} diff --git a/webapp/controller/BagController.class.php b/webapp/controller/BagController.class.php index 52fbd3bc..e2df8e54 100644 --- a/webapp/controller/BagController.class.php +++ b/webapp/controller/BagController.class.php @@ -8,9 +8,11 @@ require_once('mt/LootConfig.php'); require_once('models/Bag.php'); require_once('models/Hero.php'); +require_once('models/HeroSkin.php'); require_once('models/User.php'); -require_once('models/DiamondConsumeProduct.php'); require_once('models/RealtimeData.php'); +require_once('models/ChipPage.php'); +require_once('models/Chip.php'); require_once('services/AwardService.php'); @@ -22,9 +24,11 @@ require_once('services/LootService.php'); use phpcommon\SqlHelper; use models\Bag; use models\Hero; +use models\HeroSkin; use models\User; use models\RealtimeData; -use models\DiamondConsumeProduct; +use models\ChipPage; +use models\Chip; use services\LogService; class BagController extends BaseAuthedController { @@ -641,6 +645,27 @@ class BagController extends BaseAuthedController { )); $this->propertyChgService->addUserChg(); } + if ($heroDb['skin_id']){ + Hero::update($heroUniId,array( + 'skin_id' => 0, + 'modifytime'=>myself()->_getNowTime() + )); + HeroSkin::update($heroDb['skin_id'],array( + 'used'=>HeroSkin::NO_USE, + 'skin_state'=>HeroSkin::NO_LOCK, + 'hero_uniid'=>0, + 'modifytime'=>myself()->_getNowTime(), + )); + } + $chipPageDb = ChipPage::find($heroUniId); + $chipPageData = emptyReplace(json_decode($chipPageDb['data'], true), array()); + foreach ($chipPageData as &$value){ + Chip::updateInlayState($value['chip_id'],0); + $value['chip_id'] = 0; + } + ChipPage::update($heroUniId,array( + 'data' => json_encode($chipPageData) + )); $this->propertyChgService->addBagChg(); $this->propertyChgService->addHeroChg(); $event = array( diff --git a/webapp/controller/BaseAuthedController.class.php b/webapp/controller/BaseAuthedController.class.php index abb97150..a21cba5f 100644 --- a/webapp/controller/BaseAuthedController.class.php +++ b/webapp/controller/BaseAuthedController.class.php @@ -96,6 +96,12 @@ class BaseAuthedController extends BaseController { // } $this->accountId = getReqVal('account_id', ''); $this->sessionId = getReqVal('session_id', ''); + /* + if ($this->_getAccountId() == '1_2006_google-oauth2|102579762412391374191') { + phpcommon\sendError(1001, 'session expiration'); + die(); + return; + }*/ if (SERVER_ENV == _ONLINE) { $sessionTime = $this->_getSessionTime(); if ($sessionTime < 1724049880) { diff --git a/webapp/controller/BattleController.class.php b/webapp/controller/BattleController.class.php index 287f7969..013ba723 100644 --- a/webapp/controller/BattleController.class.php +++ b/webapp/controller/BattleController.class.php @@ -19,6 +19,7 @@ require_once('mt/RankSeason.php'); require_once('mt/Robot.php'); require_once('mt/Skill.php'); require_once('mt/MapMode.php'); +require_once('mt/Map.php'); require_once('mt/Parameter.php'); use phpcommon\SqlHelper; @@ -692,6 +693,7 @@ class BattleController extends BaseAuthedController { 'room_uuid' => $roomUuid, 'start_time' => $startTime, 'match_mode' => $currSeason ? 1 : 0, + 'is_newbie_battle' => 0, 'team_list' => array() ); foreach ($customData['team_list'] as $team) { @@ -813,6 +815,7 @@ class BattleController extends BaseAuthedController { 'room_uuid' => $roomUuid, 'start_time' => $startTime, 'match_mode' => $currSeason ? 1 : 0, + 'is_newbie_battle' => 0, 'team_list' => array() ); $mapModeMeta = mt\MapMode::find($modeId); @@ -824,6 +827,39 @@ class BattleController extends BaseAuthedController { myself()->_rspErr(2, 'map mode error'); return; } + $mapMeta = mt\Map::get($mapId); + if (empty($mapMeta)) { + myself()->_rspErr(2, 'map meta error'); + return; + } + $myUserDb = myself()->_getUserInfo(array( + 'already_newbie_battle' + )); + if ($mapModeMeta['mapMode'] == mt\MapMode::PRACTICE_MODE) { + if (!$mapMeta['is_moba']) { + if (!$myUserDb['already_newbie_battle']) { + $data['is_newbie_battle'] = 1; + } else { + if (SERVER_ENV != _ONLINE) { + $data['is_newbie_battle'] = 1; + } + } + } + } + if (!$myUserDb['already_newbie_battle']) { + myself()->_updateUserInfo(array( + 'already_newbie_battle' => 1, + )); + myself()->_addTgLog('battle.newbieBattle', array( + 'zone_id' => $zoneId, + 'node_id' => $nodeId, + 'mode_id' => $modeId, + 'map_id' => $mapId, + 'room_uuid' => $roomUuid, + 'start_time' => $startTime, + 'match_mode' => $currSeason ? 1 : 0, + )); + } if (!mt\MapMode::checkLimitTime($mapModeMeta)) { error_log(json_encode(array( 'msg' => 'MapMode::CheckLimitTime error', @@ -837,6 +873,7 @@ class BattleController extends BaseAuthedController { return; } + $realPlayerNum = 0; $currSeason = mt\RankSeason::getCurrentSeason(); foreach ($customData['team_list'] as $team) { if ($ignoreAndroid) { @@ -872,6 +909,7 @@ class BattleController extends BaseAuthedController { $info = $this->genInitBattleData(); $userDb = User::find($accountId); if ($userDb) { + ++$realPlayerNum; $userPresetInfo = User::toPreset($userDb); $info['elo'] = $userDb['elo']; $info['rank'] = $userDb['rank']; @@ -923,6 +961,9 @@ class BattleController extends BaseAuthedController { array_push($data['team_list'], $teamInfo); } $this->decTicket($r, $customData, $mapModeMeta); + if ($data['is_newbie_battle'] && $realPlayerNum > 1) { + $data['is_newbie_battle'] = 0; + } myself()->_rspData($data); } diff --git a/webapp/controller/BigwheelController.class.php b/webapp/controller/BigwheelController.class.php index 6a4a4e9d..b5b11565 100644 --- a/webapp/controller/BigwheelController.class.php +++ b/webapp/controller/BigwheelController.class.php @@ -337,13 +337,13 @@ class BigwheelController extends BaseAuthedController { myself()->_rspData(array( 'award' => $this->awardService->toDto(), - 'property_chg' => $this->propertyChgService->toDto(), + 'property_chg' => $this->propertyChgService->toDto(), 'info' => $info )); - myself()->_fireEvent('Bigwheel', 'onBuyOk', array( - 'grid_id' => $gridId, - 'buy_price' => $gridRef['buy_price'], - )); + myself()->_fireEvent('Bigwheel', 'onBuyOk', + $gridId, + $gridRef['buy_price'] + ); } private function getMidDataKey() diff --git a/webapp/controller/BlockChainController.class.php b/webapp/controller/BlockChainController.class.php index 0279d6bd..83532a56 100644 --- a/webapp/controller/BlockChainController.class.php +++ b/webapp/controller/BlockChainController.class.php @@ -56,8 +56,8 @@ class BlockChainController extends BaseAuthedController { switch ($type) { case 1: { - myself()->_rspErr(1, 'server internal error'); - return; + //myself()->_rspErr(1, 'server internal error'); + //return; $heroDb = Hero::find($uniid); if (!$heroDb) { myself()->_rspErr(1, 'hero not found'); @@ -67,6 +67,11 @@ class BlockChainController extends BaseAuthedController { myself()->_rspErr(1, 'hero no seal'); return; } + if ($heroDb['quality'] <= 1) { + myself()->_rspErr(1, 'hero is N quality'); + return; + } + $isMint = true; $tokenId = $heroDb['token_id']; if ($heroDb['token_id'] && $heroDb['activate']) { @@ -91,7 +96,7 @@ class BlockChainController extends BaseAuthedController { } } $this->internalActivate721Nft($tokenId, - Nft::HERO_TYPE, + Nft::GCARD_HERO_TYPE, $heroDb['hero_uniid'], $heroDb['hero_id'], $isMint, diff --git a/webapp/controller/InGameMallController.class.php b/webapp/controller/InGameMallController.class.php index ab138804..bc87b35b 100644 --- a/webapp/controller/InGameMallController.class.php +++ b/webapp/controller/InGameMallController.class.php @@ -216,6 +216,10 @@ class InGameMallController extends BaseAuthedController { $this->_rspErr(1, 'param goods_unnid error'); return; } + if ($chipDb['inlay_state'] == 1){ + $this->_rspErr(1, 'Unable to sell goods in use'); + return; + } $orderField = $chipDb['quality']; } break; @@ -473,6 +477,7 @@ EOD; return; } InGameMall::cancel($orderId); + $awardService = new services\AwardService(); $propertyChgService = new PropertyChgService(); switch ($goodsDb['order_type']){ case InGameMall::HERO_SKIN_TYPE :{ @@ -503,6 +508,15 @@ EOD; $propertyChgService->addChip(); } break; + case InGameMall::GOLD_TYPE:{ + myself()->_addItems(array( + array( + 'item_id' => $goodsDb['item_id'], + 'item_num' => $goodsDb['item_num'], + ) + ), $awardService, $propertyChgService); + } + break; default : { Bag::addItem($goodsDb['item_id'],$goodsDb['item_num']); $propertyChgService->addBagChg(); @@ -510,6 +524,7 @@ EOD; } myself()->_rspData(array( + 'award' => $awardService->toDto(), 'property_chg' => $propertyChgService->toDto(), )); } diff --git a/webapp/controller/OutAppMintController.class.php b/webapp/controller/OutAppMintController.class.php index bf0e0216..503a5535 100644 --- a/webapp/controller/OutAppMintController.class.php +++ b/webapp/controller/OutAppMintController.class.php @@ -39,6 +39,10 @@ class OutAppMintController extends BaseController { myself()->_rspErr(1, 'hero not found'); return; } + if (!$heroDb['seal_type']) { + myself()->_rspErr(1, 'hero is no seal'); + return; + } if ($heroDb['quality'] <= 1) { myself()->_rspErr(1, 'hero is N quality'); return; diff --git a/webapp/controller/OutAppNftController.class.php b/webapp/controller/OutAppNftController.class.php index af8fa55c..10d6c06f 100644 --- a/webapp/controller/OutAppNftController.class.php +++ b/webapp/controller/OutAppNftController.class.php @@ -476,6 +476,7 @@ class OutAppNftController extends BaseController { $info['item_id'] = $heroMeta['id']; $info['type'] = Nft::HERO_TYPE; $info['image'] = 'https://res2.counterfire.games/nft/video/normal/' . $heroMeta['id'] . '_c' . $this->getRealHeroQuality($heroDb) . '.mp4'; + $info['on_lock'] = $heroDb['seal_type']; $info['detail']['quality'] = $this->getRealHeroQuality($heroDb); $info['detail']['max_mining_days'] = $heroAtteMeta['validTime']; $info['detail']['wealth'] = floor($wealth * (1+$wealth_rate)); diff --git a/webapp/controller/OutAppToolsController.class.php b/webapp/controller/OutAppToolsController.class.php new file mode 100644 index 00000000..4def3b49 --- /dev/null +++ b/webapp/controller/OutAppToolsController.class.php @@ -0,0 +1,16 @@ +_getRedis(ServerSwitchService::SERVER_SWITCH_KEY); + $data = ServerSwitchService::selectSwitchTable(); + $redis->set(ServerSwitchService::SERVER_SWITCH_KEY,json_encode($data)); + $redis->pexpire(ServerSwitchService::SERVER_SWITCH_KEY , 10*1000); + $this->_rspOk(); + } + +} diff --git a/webapp/controller/TempToolsController.class.php b/webapp/controller/TempToolsController.class.php index 30c2853c..3c97b292 100644 --- a/webapp/controller/TempToolsController.class.php +++ b/webapp/controller/TempToolsController.class.php @@ -839,9 +839,9 @@ EOD; public function dumpSqlMigrate() { $conn = $this->_getMysql(''); - $heroSql = $this->dumpMigrateTable($conn, 't_hero', 'gamedb2006_prod_1_old.t_hero_bk', 'WHERE activate=1'); - $mailSql = $this->dumpMigrateTable($conn, 't_mail', 'gamedb2006_prod_1_old.t_mail_bk', ''); - $goldBullionSql = $this->dumpMigrateTable($conn, 't_gold_bullion', 'gamedb2006_prod_1_old.t_gold_bullion_bk', ''); + $heroSql = $this->dumpMigrateTable($conn, 't_hero', 'gamedb2006_prod_1_20240822.t_hero', 'WHERE activate=1'); + $mailSql = $this->dumpMigrateTable($conn, 't_mail', 'gamedb2006_prod_1_20240822.t_mail', ''); + $goldBullionSql = $this->dumpMigrateTable($conn, 't_gold_bullion', 'gamedb2006_prod_1_20240822.t_gold_bullion', ''); echo $heroSql; echo "\n"; echo $mailSql; diff --git a/webapp/events/Bigwheel.php b/webapp/events/Bigwheel.php index 3774777b..9296b16d 100644 --- a/webapp/events/Bigwheel.php +++ b/webapp/events/Bigwheel.php @@ -12,6 +12,10 @@ class Bigwheel public static function onBuyOk($gridId, $buyPrice) { + myself()->_addTgLog('Bigwheel.buyOk', array( + 'gridId' => $gridId, + 'buyPrice' => $buyPrice + )); } } diff --git a/webapp/models/ActivationCode.php b/webapp/models/ActivationCode.php new file mode 100644 index 00000000..18c39885 --- /dev/null +++ b/webapp/models/ActivationCode.php @@ -0,0 +1,56 @@ +_getAccountMysql(), + 't_activation_code', + array( + 'activation_code' => $code, + ) + ); + if ($row){ + return true; + } + return false; + } + + public static function addBindCode($code){ + SqlHelper::upsert( + myself()->_getAccountMysql(), + 't_activation_code_bind', + array( + 'account_id' => myself()->_getAccountId(), + ), + array( + + ), + array( + 'account_id' => myself()->_getAccountId(), + 'activation_code' =>$code, + 'createtime' =>myself()->_getNowTime(), + 'modifytime' =>myself()->_getNowTime(), + ) + ); + } + + public static function verifyAccountBind(){ + $row = SqlHelper::ormSelectOne( + myself()->_getAccountMysql(), + 't_activation_code_bind', + array( + 'account_id' => myself()->_getAccountId(), + ) + ); + if ($row){ + return true; + } + return false; + } +} \ No newline at end of file diff --git a/webapp/models/Chip.php b/webapp/models/Chip.php index 927b0a4d..5f0c0cc9 100644 --- a/webapp/models/Chip.php +++ b/webapp/models/Chip.php @@ -257,11 +257,27 @@ class Chip extends BaseModel $attribute = \mt\EconomyAttribute::getAttribute($chipAttrMeta['economyAttribute'],$quality); { $randAttr = array(); - $randMeta = mt\BattleRandAttribute::getByWeight($chipAttrMeta['battleAttribute'],$quality); - if ($randMeta){ - $randAttr = mt\BattleRandAttribute::getRandAttr($randMeta); +// $randMeta = mt\BattleRandAttribute::getByWeight($chipAttrMeta['battleAttribute'],$quality); +// if ($randMeta){ +// $randAttr = mt\BattleRandAttribute::getRandAttr($randMeta); +// } + for ($i=1;$i<=$quality;$i++){ + $randMeta = mt\BattleRandAttribute::getByWeight($chipAttrMeta['battleAttribute'],$i); + if ($randMeta) { + $result = mt\BattleRandAttribute::getRandAttr($randMeta); + if ($result){ + foreach ($result as $value){ + if (isset($randAttr[$value['attr_id']])){ + $randAttr[$value['attr_id']]['val'] += $value['val']; + }else{ + $randAttr[$value['attr_id']] = $value; + } + } + } + } } } + $randAttr = array_values($randAttr); $fieldsKv = array( 'item_id' => $itemMeta['id'], 'item_num' => 1, @@ -329,9 +345,16 @@ class Chip extends BaseModel } public static function updateInlayState($chip_unnid,$status){ - self::update2($chip_unnid,array( - 'inlay_state' => $status - )); + SqlHelper::update + (myself()->_getSelfMysql(), + 't_chip', + array( + 'idx' => $chip_unnid, + ), + array( + 'inlay_state' => $status + ) + ); } diff --git a/webapp/models/ChipPage.php b/webapp/models/ChipPage.php index c32c65a2..0ddfb32b 100644 --- a/webapp/models/ChipPage.php +++ b/webapp/models/ChipPage.php @@ -70,8 +70,8 @@ class ChipPage extends BaseModel foreach ($data as &$value){ $chipDb = Chip::find($value['chip_id']); if ( !$chipDb ) { - $value['chip_id'] = 0; Chip::updateInlayState($value['chip_id'],0); + $value['chip_id'] = 0; } } self::update($row['hero_uniid'],array( @@ -118,8 +118,8 @@ class ChipPage extends BaseModel foreach ($data as &$value){ $chipDb = Chip::find($value['chip_id']); if ( !$chipDb ) { - $value['chip_id'] = 0; Chip::updateInlayState($value['chip_id'],0); + $value['chip_id'] = 0; } } self::update($row['hero_uniid'],array( diff --git a/webapp/models/Hero.php b/webapp/models/Hero.php index 298fa736..c8af5564 100644 --- a/webapp/models/Hero.php +++ b/webapp/models/Hero.php @@ -222,6 +222,7 @@ class Hero extends BaseModel { 'is_old' => $row['is_old'], "current_times" => myself()->_getDailyV(TN_DAILY_GOLD_MODE_BATTLE_TIMES,$row['idx']), "total_times" => $heroAtteMeta['roundPerDay'], + 'activate' => $row['activate'], ); $dto['is_avatar'] = 0; if (SERVER_ENV == _ONLINE) { @@ -322,6 +323,7 @@ class Hero extends BaseModel { 'is_old' => $row['is_old'], "current_times" => myself()->_getDailyV(TN_DAILY_GOLD_MODE_BATTLE_TIMES,$row['idx']), "total_times" => $heroAtteMeta['roundPerDay'], + 'activate' => $row['activate'], ); // $nft_address = ''; diff --git a/webapp/services/HashRateService.php b/webapp/services/HashRateService.php index 182604f1..19ad31aa 100644 --- a/webapp/services/HashRateService.php +++ b/webapp/services/HashRateService.php @@ -597,7 +597,16 @@ class HashRateService extends BaseService return $useCount; } + private static $ignoreCa = array( + 'BlockChain@mintGoldBullion'=>1, + 'InGameMall@sellS'=>2, + ); + public static function onSpendGold($goldNum){ + $ca = getReqVal('c', '') . '@' . getReqVal('a',''); + if (array_key_exists($ca, self::$ignoreCa)) { + return; + } self::_updateTaskSchedule(AchievementsPower::SPEND_GOLD,$goldNum); } diff --git a/webapp/services/ServerSwitchService.php b/webapp/services/ServerSwitchService.php index 504307ed..c47a9672 100644 --- a/webapp/services/ServerSwitchService.php +++ b/webapp/services/ServerSwitchService.php @@ -73,7 +73,7 @@ class ServerSwitchService { return $data; } - private static function selectSwitchTable(){ + public static function selectSwitchTable(){ $rows = SqlHelper::ormSelect(myself()->_getConfDbMysql(), 't_game_switch', array()); $data = array( 'normal' => array(),