From 6011bb933f60fb15574cc196dfeb4036112ce423 Mon Sep 17 00:00:00 2001 From: aozhiwei Date: Thu, 22 Aug 2024 11:29:30 +0800 Subject: [PATCH 01/28] 1 --- webapp/controller/TempToolsController.class.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) 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; From adbb0ea437ad408f54e81fca34b15e07ccb31e9e Mon Sep 17 00:00:00 2001 From: aozhiwei Date: Thu, 22 Aug 2024 11:38:22 +0800 Subject: [PATCH 02/28] 1 --- webapp/controller/BigwheelController.class.php | 10 +++++----- webapp/events/Bigwheel.php | 4 ++++ 2 files changed, 9 insertions(+), 5 deletions(-) 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/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 + )); } } From 1b828d3502c2329fa6a4569591970b3edec89654 Mon Sep 17 00:00:00 2001 From: hujiabin <519660157@qq.com> Date: Thu, 22 Aug 2024 14:49:28 +0800 Subject: [PATCH 03/28] 1 --- webapp/models/Chip.php | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/webapp/models/Chip.php b/webapp/models/Chip.php index 927b0a4d..31a6e29f 100644 --- a/webapp/models/Chip.php +++ b/webapp/models/Chip.php @@ -257,9 +257,24 @@ 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; + } + } + } + } } } $fieldsKv = array( From a3ab48cc3cb1c2dc5ea4fd065c21b5480deec412 Mon Sep 17 00:00:00 2001 From: hujiabin <519660157@qq.com> Date: Thu, 22 Aug 2024 15:10:28 +0800 Subject: [PATCH 04/28] 1 --- webapp/models/Chip.php | 1 + 1 file changed, 1 insertion(+) diff --git a/webapp/models/Chip.php b/webapp/models/Chip.php index 31a6e29f..eed5c273 100644 --- a/webapp/models/Chip.php +++ b/webapp/models/Chip.php @@ -277,6 +277,7 @@ class Chip extends BaseModel } } } + $randAttr = array_values($randAttr); $fieldsKv = array( 'item_id' => $itemMeta['id'], 'item_num' => 1, From 64258dabf09d03fa7860ff15117109798d118e43 Mon Sep 17 00:00:00 2001 From: aozhiwei Date: Fri, 23 Aug 2024 15:56:29 +0800 Subject: [PATCH 05/28] 1 --- webapp/controller/BaseAuthedController.class.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/webapp/controller/BaseAuthedController.class.php b/webapp/controller/BaseAuthedController.class.php index abb97150..ac58dbd7 100644 --- a/webapp/controller/BaseAuthedController.class.php +++ b/webapp/controller/BaseAuthedController.class.php @@ -96,6 +96,11 @@ 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) { From cb357b54d739747a6aab5a5febb1457725d5df77 Mon Sep 17 00:00:00 2001 From: aozhiwei Date: Fri, 23 Aug 2024 22:56:20 +0800 Subject: [PATCH 06/28] =?UTF-8?q?=E4=BF=AE=E5=A4=8DingameMall.cancel?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- webapp/controller/InGameMallController.class.php | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/webapp/controller/InGameMallController.class.php b/webapp/controller/InGameMallController.class.php index ab138804..141d0dcb 100644 --- a/webapp/controller/InGameMallController.class.php +++ b/webapp/controller/InGameMallController.class.php @@ -473,6 +473,7 @@ EOD; return; } InGameMall::cancel($orderId); + $awardService = new services\AwardService(); $propertyChgService = new PropertyChgService(); switch ($goodsDb['order_type']){ case InGameMall::HERO_SKIN_TYPE :{ @@ -503,6 +504,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 +520,7 @@ EOD; } myself()->_rspData(array( + 'award' => $awardService->toDto(), 'property_chg' => $propertyChgService->toDto(), )); } From 020c332a34b4a6d713c6de175ba0a3b4452eb0eb Mon Sep 17 00:00:00 2001 From: aozhiwei Date: Fri, 23 Aug 2024 22:57:22 +0800 Subject: [PATCH 07/28] 1 --- webapp/controller/BaseAuthedController.class.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/webapp/controller/BaseAuthedController.class.php b/webapp/controller/BaseAuthedController.class.php index ac58dbd7..a21cba5f 100644 --- a/webapp/controller/BaseAuthedController.class.php +++ b/webapp/controller/BaseAuthedController.class.php @@ -96,11 +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) { From 5b1e7ced8925204e8889bd0697463528a5239cfb Mon Sep 17 00:00:00 2001 From: hujiabin <519660157@qq.com> Date: Mon, 26 Aug 2024 14:22:19 +0800 Subject: [PATCH 08/28] 1 --- webapp/controller/InGameMallController.class.php | 4 ++++ webapp/models/ChipPage.php | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/webapp/controller/InGameMallController.class.php b/webapp/controller/InGameMallController.class.php index 141d0dcb..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; diff --git a/webapp/models/ChipPage.php b/webapp/models/ChipPage.php index c32c65a2..3885ed33 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( From 7a3e7c1f802f1da592b7814b9de04269d414cb4d Mon Sep 17 00:00:00 2001 From: hujiabin <519660157@qq.com> Date: Mon, 26 Aug 2024 14:28:32 +0800 Subject: [PATCH 09/28] 1 --- webapp/controller/InGameMallController.class.php | 8 ++++---- webapp/models/Chip.php | 13 ++++++++++--- webapp/models/ChipPage.php | 2 +- 3 files changed, 15 insertions(+), 8 deletions(-) diff --git a/webapp/controller/InGameMallController.class.php b/webapp/controller/InGameMallController.class.php index bc87b35b..753f636e 100644 --- a/webapp/controller/InGameMallController.class.php +++ b/webapp/controller/InGameMallController.class.php @@ -216,10 +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; - } +// if ($chipDb['inlay_state'] == 1){ +// $this->_rspErr(1, 'Unable to sell goods in use'); +// return; +// } $orderField = $chipDb['quality']; } break; diff --git a/webapp/models/Chip.php b/webapp/models/Chip.php index eed5c273..5f0c0cc9 100644 --- a/webapp/models/Chip.php +++ b/webapp/models/Chip.php @@ -345,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 3885ed33..0ddfb32b 100644 --- a/webapp/models/ChipPage.php +++ b/webapp/models/ChipPage.php @@ -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( From 14cf57d1f1685173650e9bd88ca3a7bf27bb9ecb Mon Sep 17 00:00:00 2001 From: hujiabin <519660157@qq.com> Date: Mon, 26 Aug 2024 14:48:35 +0800 Subject: [PATCH 10/28] 1 --- webapp/controller/BagController.class.php | 29 +++++++++++++++++-- .../controller/InGameMallController.class.php | 8 ++--- 2 files changed, 31 insertions(+), 6 deletions(-) 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/InGameMallController.class.php b/webapp/controller/InGameMallController.class.php index 753f636e..bc87b35b 100644 --- a/webapp/controller/InGameMallController.class.php +++ b/webapp/controller/InGameMallController.class.php @@ -216,10 +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; -// } + if ($chipDb['inlay_state'] == 1){ + $this->_rspErr(1, 'Unable to sell goods in use'); + return; + } $orderField = $chipDb['quality']; } break; From 9d02b1f6db8c33ae26576fc4d16ed14290c80bc2 Mon Sep 17 00:00:00 2001 From: hujiabin <519660157@qq.com> Date: Mon, 26 Aug 2024 15:36:22 +0800 Subject: [PATCH 11/28] 1 --- webapp/controller/OutAppNftController.class.php | 1 + 1 file changed, 1 insertion(+) 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)); From 5f9f2748ce5d2996ff46fd9d3cd6cb1071ac4ad3 Mon Sep 17 00:00:00 2001 From: aozhiwei Date: Tue, 27 Aug 2024 14:17:26 +0800 Subject: [PATCH 12/28] 1 --- webapp/controller/BlockChainController.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/webapp/controller/BlockChainController.class.php b/webapp/controller/BlockChainController.class.php index 0279d6bd..214e1329 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'); From aa489c11e79ebb8863177dbc95f3745dc0bd03e1 Mon Sep 17 00:00:00 2001 From: aozhiwei Date: Tue, 27 Aug 2024 14:37:57 +0800 Subject: [PATCH 13/28] 1 --- webapp/controller/BlockChainController.class.php | 5 +++++ webapp/controller/OutAppMintController.class.php | 4 ++++ 2 files changed, 9 insertions(+) diff --git a/webapp/controller/BlockChainController.class.php b/webapp/controller/BlockChainController.class.php index 214e1329..df953202 100644 --- a/webapp/controller/BlockChainController.class.php +++ b/webapp/controller/BlockChainController.class.php @@ -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']) { 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; From 7c600f839f429695ba73b93e9a9f343dd8bf910f Mon Sep 17 00:00:00 2001 From: hujiabin <519660157@qq.com> Date: Tue, 27 Aug 2024 16:02:34 +0800 Subject: [PATCH 14/28] 1 --- webapp/models/Hero.php | 2 ++ 1 file changed, 2 insertions(+) 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 = ''; From c8ebc2274ab2c43f6751e83e3f3611dbad5a6b58 Mon Sep 17 00:00:00 2001 From: aozhiwei Date: Tue, 27 Aug 2024 16:31:05 +0800 Subject: [PATCH 15/28] 1 --- webapp/controller/BlockChainController.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/webapp/controller/BlockChainController.class.php b/webapp/controller/BlockChainController.class.php index df953202..83532a56 100644 --- a/webapp/controller/BlockChainController.class.php +++ b/webapp/controller/BlockChainController.class.php @@ -96,7 +96,7 @@ class BlockChainController extends BaseAuthedController { } } $this->internalActivate721Nft($tokenId, - Nft::HERO_TYPE, + Nft::GCARD_HERO_TYPE, $heroDb['hero_uniid'], $heroDb['hero_id'], $isMint, From 7fa1a66b575ad70e8ee097e938d7dcdafa92e460 Mon Sep 17 00:00:00 2001 From: aozhiwei Date: Wed, 28 Aug 2024 15:10:14 +0800 Subject: [PATCH 16/28] 1 --- sql/{ => archived}/gamedb2006_migrate_240710_01.sql | 0 sql/{ => archived}/gamedb2006_migrate_240722_01.sql | 0 2 files changed, 0 insertions(+), 0 deletions(-) rename sql/{ => archived}/gamedb2006_migrate_240710_01.sql (100%) rename sql/{ => archived}/gamedb2006_migrate_240722_01.sql (100%) 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 From 618ab1ce610fa7ae1f718afb97e859f6c50b94ba Mon Sep 17 00:00:00 2001 From: hujiabin <519660157@qq.com> Date: Wed, 28 Aug 2024 18:51:41 +0800 Subject: [PATCH 17/28] 1 --- webapp/models/ActivationCode.php | 10 ++++++++++ webapp/services/HashRateService.php | 9 +++++++++ 2 files changed, 19 insertions(+) create mode 100644 webapp/models/ActivationCode.php diff --git a/webapp/models/ActivationCode.php b/webapp/models/ActivationCode.php new file mode 100644 index 00000000..83bad239 --- /dev/null +++ b/webapp/models/ActivationCode.php @@ -0,0 +1,10 @@ +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); } From d67479e07b6c3cf90d25612ac17507fa5ea738d6 Mon Sep 17 00:00:00 2001 From: hujiabin <519660157@qq.com> Date: Thu, 29 Aug 2024 10:42:36 +0800 Subject: [PATCH 18/28] 1 --- doc/ActivationCode.py | 36 +++++++++++++ .../ActivationCodeController.class.php | 29 +++++++++++ webapp/models/ActivationCode.php | 50 ++++++++++++++++++- 3 files changed, 113 insertions(+), 2 deletions(-) create mode 100644 doc/ActivationCode.py create mode 100644 webapp/controller/ActivationCodeController.class.php 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/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/models/ActivationCode.php b/webapp/models/ActivationCode.php index 83bad239..18c39885 100644 --- a/webapp/models/ActivationCode.php +++ b/webapp/models/ActivationCode.php @@ -3,8 +3,54 @@ namespace models; - -class ActivationCode +use mt; +use phpcommon\SqlHelper; +class ActivationCode extends BaseModel { + public static function verifyCode($code){ + $row = SqlHelper::ormSelectOne( + myself()->_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 From 896db8037aa3fd366873da919623db2bd7879d07 Mon Sep 17 00:00:00 2001 From: hujiabin <519660157@qq.com> Date: Thu, 29 Aug 2024 17:02:50 +0800 Subject: [PATCH 19/28] 1 --- doc/OutAppTools.py | 19 +++++++++++++++++++ .../OutAppToolsController.class.php | 16 ++++++++++++++++ webapp/services/ServerSwitchService.php | 2 +- 3 files changed, 36 insertions(+), 1 deletion(-) create mode 100644 doc/OutAppTools.py create mode 100644 webapp/controller/OutAppToolsController.class.php 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/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/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(), From 5f9421fdc3b5b8e98366314c581ed32cd3c61018 Mon Sep 17 00:00:00 2001 From: aozhiwei Date: Thu, 29 Aug 2024 18:52:40 +0800 Subject: [PATCH 20/28] 1 --- webapp/controller/BattleController.class.php | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/webapp/controller/BattleController.class.php b/webapp/controller/BattleController.class.php index 287f7969..d2e0c66c 100644 --- a/webapp/controller/BattleController.class.php +++ b/webapp/controller/BattleController.class.php @@ -692,6 +692,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 +814,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 +826,13 @@ class BattleController extends BaseAuthedController { myself()->_rspErr(2, 'map mode error'); return; } + if (SERVER_ENV != _ONLINE) { + if ($mapModeMeta['mapMode'] == mt\MapMode::PRACTICE_MODE) { + if ($mapId == 2008) { + $data['is_newbie_battle'] = 1; + } + } + } if (!mt\MapMode::checkLimitTime($mapModeMeta)) { error_log(json_encode(array( 'msg' => 'MapMode::CheckLimitTime error', From aa91642c23e5e8f53ee898dae62c373511263f59 Mon Sep 17 00:00:00 2001 From: aozhiwei Date: Fri, 30 Aug 2024 13:38:30 +0800 Subject: [PATCH 21/28] 1 --- doc/Battle.py | 2 ++ 1 file changed, 2 insertions(+) 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, ''], From 01c57ca647552d9f4c5806fc81597f83ddc90bb8 Mon Sep 17 00:00:00 2001 From: hujiabin <519660157@qq.com> Date: Fri, 30 Aug 2024 13:45:01 +0800 Subject: [PATCH 22/28] 1 --- webapp/services/TameBattleDataService.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/webapp/services/TameBattleDataService.php b/webapp/services/TameBattleDataService.php index d59a6c7b..e62a9b47 100644 --- a/webapp/services/TameBattleDataService.php +++ b/webapp/services/TameBattleDataService.php @@ -85,6 +85,9 @@ class TameBattleDataService extends BaseService { public function updateBattleData() { error_log('updateBattleData'); + if (getXVal($this->allInfo,'is_newbie_battle', 0)){ + return false; + } $matchMode = getXVal($this->allInfo,'room_mode', 0); $userInfo = myself()->_getOrmUserInfo(); if (!$userInfo){ From e3b737e73adc687aa527d31b1bd925a7cd37216c Mon Sep 17 00:00:00 2001 From: hujiabin <519660157@qq.com> Date: Fri, 30 Aug 2024 14:13:04 +0800 Subject: [PATCH 23/28] 1 --- webapp/services/TameBattleDataService.php | 3 --- 1 file changed, 3 deletions(-) diff --git a/webapp/services/TameBattleDataService.php b/webapp/services/TameBattleDataService.php index e62a9b47..d59a6c7b 100644 --- a/webapp/services/TameBattleDataService.php +++ b/webapp/services/TameBattleDataService.php @@ -85,9 +85,6 @@ class TameBattleDataService extends BaseService { public function updateBattleData() { error_log('updateBattleData'); - if (getXVal($this->allInfo,'is_newbie_battle', 0)){ - return false; - } $matchMode = getXVal($this->allInfo,'room_mode', 0); $userInfo = myself()->_getOrmUserInfo(); if (!$userInfo){ From f268de1f1f5c862cbc831eba5c25d1950039d1e0 Mon Sep 17 00:00:00 2001 From: aozhiwei Date: Fri, 30 Aug 2024 14:28:52 +0800 Subject: [PATCH 24/28] 1 --- sql/gamedb.sql | 1 + webapp/controller/BattleController.class.php | 24 +++++++++++++++++--- 2 files changed, 22 insertions(+), 3 deletions(-) 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/BattleController.class.php b/webapp/controller/BattleController.class.php index d2e0c66c..d392304b 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; @@ -826,13 +827,30 @@ class BattleController extends BaseAuthedController { myself()->_rspErr(2, 'map mode error'); return; } - if (SERVER_ENV != _ONLINE) { - if ($mapModeMeta['mapMode'] == mt\MapMode::PRACTICE_MODE) { - if ($mapId == 2008) { + $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, + )); + } if (!mt\MapMode::checkLimitTime($mapModeMeta)) { error_log(json_encode(array( 'msg' => 'MapMode::CheckLimitTime error', From f6a100b833d6e9f2c1bdb288dad66e67950173c4 Mon Sep 17 00:00:00 2001 From: aozhiwei Date: Fri, 30 Aug 2024 14:32:53 +0800 Subject: [PATCH 25/28] 1 --- webapp/controller/BattleController.class.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/webapp/controller/BattleController.class.php b/webapp/controller/BattleController.class.php index d392304b..3e5badd2 100644 --- a/webapp/controller/BattleController.class.php +++ b/webapp/controller/BattleController.class.php @@ -864,6 +864,7 @@ class BattleController extends BaseAuthedController { return; } + $realPlayerNum = 0; $currSeason = mt\RankSeason::getCurrentSeason(); foreach ($customData['team_list'] as $team) { if ($ignoreAndroid) { @@ -899,6 +900,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']; @@ -950,6 +952,9 @@ class BattleController extends BaseAuthedController { array_push($data['team_list'], $teamInfo); } $this->decTicket($r, $customData, $mapModeMeta); + if ($data['is_newbie_battle'] && $realPlayerNum > 0) { + $data['is_newbie_battle'] = 0; + } myself()->_rspData($data); } From 692eda0befa81ea1e93f89015326930584cc1c44 Mon Sep 17 00:00:00 2001 From: aozhiwei Date: Fri, 30 Aug 2024 14:38:52 +0800 Subject: [PATCH 26/28] 1 --- webapp/controller/BattleController.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/webapp/controller/BattleController.class.php b/webapp/controller/BattleController.class.php index 3e5badd2..98e337d8 100644 --- a/webapp/controller/BattleController.class.php +++ b/webapp/controller/BattleController.class.php @@ -952,7 +952,7 @@ class BattleController extends BaseAuthedController { array_push($data['team_list'], $teamInfo); } $this->decTicket($r, $customData, $mapModeMeta); - if ($data['is_newbie_battle'] && $realPlayerNum > 0) { + if ($data['is_newbie_battle'] && $realPlayerNum > 1) { $data['is_newbie_battle'] = 0; } myself()->_rspData($data); From 698cc2d85ea0ab5452cbe85252e6b969e4502d23 Mon Sep 17 00:00:00 2001 From: aozhiwei Date: Fri, 30 Aug 2024 14:52:03 +0800 Subject: [PATCH 27/28] 1 --- webapp/controller/BattleController.class.php | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/webapp/controller/BattleController.class.php b/webapp/controller/BattleController.class.php index 98e337d8..f444bf35 100644 --- a/webapp/controller/BattleController.class.php +++ b/webapp/controller/BattleController.class.php @@ -850,6 +850,15 @@ class BattleController extends BaseAuthedController { myself()->_updateUserInfo(array( 'already_newbie_battle' => 1, )); + myself()->_addTgLog('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( From 53a677b2e167e6f02af77be13592e439b2e0fab4 Mon Sep 17 00:00:00 2001 From: aozhiwei Date: Fri, 30 Aug 2024 14:52:26 +0800 Subject: [PATCH 28/28] 1 --- webapp/controller/BattleController.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/webapp/controller/BattleController.class.php b/webapp/controller/BattleController.class.php index f444bf35..013ba723 100644 --- a/webapp/controller/BattleController.class.php +++ b/webapp/controller/BattleController.class.php @@ -850,7 +850,7 @@ class BattleController extends BaseAuthedController { myself()->_updateUserInfo(array( 'already_newbie_battle' => 1, )); - myself()->_addTgLog('newBieBattle', array( + myself()->_addTgLog('battle.newbieBattle', array( 'zone_id' => $zoneId, 'node_id' => $nodeId, 'mode_id' => $modeId,