From c63ba8e2d0d0248e631920a39b884c29edf2b4d7 Mon Sep 17 00:00:00 2001 From: hujiabin Date: Fri, 9 Dec 2022 14:36:02 +0800 Subject: [PATCH 1/9] 1 --- .../EventRankingController.class.php | 78 +++++++++++++++++++ 1 file changed, 78 insertions(+) diff --git a/webapp/controller/EventRankingController.class.php b/webapp/controller/EventRankingController.class.php index f9135e3f..6d501a70 100644 --- a/webapp/controller/EventRankingController.class.php +++ b/webapp/controller/EventRankingController.class.php @@ -10,6 +10,7 @@ require_once('services/RankActivityService.php'); use models\User; use models\Guild; use models\EventRanking; +use phpcommon\SqlHelper; class EventRankingController extends BaseAuthedController { public function eventRankingList(){ @@ -458,5 +459,82 @@ class EventRankingController extends BaseAuthedController // } } + public function updateWinsData(){ + $rows = myself()->_getSelfMysql()->execQuery( + 'SELECT * FROM t_rank_activity ' . + 'WHERE wave=:wave AND type=:type ', + array( + ':wave' => 1, + ':type' => 2 + ) + ); + foreach ($rows as &$row){ + $battle_record = myself()->_getSelfMysql()->execQuery( + 'SELECT * FROM t_battle_record ' . + 'WHERE account_id=:account_id AND createtime>:createtime1 AND createtime<:createtime2 ', + array( + ':account_id' => $row['account_id'], + ':createtime1' => 1669896000, + ':createtime2' => 1670500800, + ) + ); + foreach ($battle_record as $value){ + $request = emptyReplace(json_decode($value['request'], true), array()); + if ($request['ranked'] == 1 && $request['match_mode'] == 0){ + $row['new_value']+=1; + } + } + } + foreach ($rows as $row){ + SqlHelper::update + (myself()->_getSelfMysql(), + 't_rank_activity', + array( + 'account_id' => $row['account_id'], + 'wave' => 1, + 'type' => 2, + ), + array( + 'value'=>$row['new_value']?$row['new_value']:0 + ) + ); + } + $this->_rspOk(); + } + public function compensationWins(){ + $rows = myself()->_getSelfMysql()->execQuery( + 'SELECT * FROM t_rank_activity ' . + 'WHERE wave=:wave AND type=:type ' . + 'ORDER BY value DESC ', + array( + ':wave' => 1, + ':type' => 2 + ) + ); + + $compensationList= array(); + $ranked = 0; + foreach ($rows as $row) { + $ranked += 1; + if ($ranked>10 && $row['value'] >0){ + array_push($compensationList,array( + 'ranked'=>$ranked, + 'account_id'=>$row['account_id'], + 'rewardNum'=>5, + 'value'=>$row['value'] + )); + } + + } + if ($compensationList){ + //记录此活动的CEG奖励 + foreach ($compensationList as $value){ + $cegNum = $value['rewardNum']; + EventRanking::setV($value['account_id'],1,9999,$cegNum); + } + } + error_log('********** WIN RANKING COMPENSATION SUCCESS ***********'); + $this->_rspOk(); + } } From 307392caa5d6a05e2ca2f5b39f79a8ff583ee567 Mon Sep 17 00:00:00 2001 From: hujiabin Date: Tue, 13 Dec 2022 11:27:51 +0800 Subject: [PATCH 2/9] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=B7=A5=E4=BC=9A?= =?UTF-8?q?=E6=B4=BB=E5=8A=A8Bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- webapp/services/RankActivityService.php | 32 +++++++++++++++++++++++-- 1 file changed, 30 insertions(+), 2 deletions(-) diff --git a/webapp/services/RankActivityService.php b/webapp/services/RankActivityService.php index e8010a79..1fc35562 100644 --- a/webapp/services/RankActivityService.php +++ b/webapp/services/RankActivityService.php @@ -103,12 +103,12 @@ class RankActivityService extends BaseService { break; case self::GUILD_TYPE : { - if ($userDb['guild_id']){ +// if ($userDb['guild_id']){ $this->internalUpdateRankActivityNew( $currentRankingMeta, $gold, $userDb); - } +// } } break; } @@ -127,6 +127,34 @@ class RankActivityService extends BaseService { if (!$meta){ return; } + if($meta['themeType'] == self::GUILD_TYPE){ + if (!$user['guild_id']){ + $row = SqlHelper::ormSelectOne + (myself()->_getSelfMysql(), + 't_rank_activity', + array( + 'account_id' => myself()->_getAccountId(), + 'wave' => $meta['wave'], + 'type' => $meta['themeType'], + ) + ); + if ($row){ + SqlHelper::update + (myself()->_getSelfMysql(), + 't_rank_activity', + array( + 'account_id' => myself()->_getAccountId(), + 'wave' => $meta['wave'], + 'type' => $meta['themeType'], + ), + array( + 'guild_id'=> '' + ) + ); + } + return; + } + } SqlHelper::upsert (myself()->_getSelfMysql(), 't_rank_activity', From 40f31ff4834b99eb9a63f5b41488468267db7ed0 Mon Sep 17 00:00:00 2001 From: hujiabin Date: Tue, 13 Dec 2022 11:51:08 +0800 Subject: [PATCH 3/9] 1 --- webapp/controller/EventRankingController.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/webapp/controller/EventRankingController.class.php b/webapp/controller/EventRankingController.class.php index 6d501a70..bde87534 100644 --- a/webapp/controller/EventRankingController.class.php +++ b/webapp/controller/EventRankingController.class.php @@ -123,7 +123,7 @@ class EventRankingController extends BaseAuthedController case \services\RankActivityService::GUILD_TYPE : { $rows = myself()->_getSelfMysql()->execQuery( 'SELECT guild_id,SUM(value) AS value FROM t_rank_activity ' . - 'WHERE wave=:wave AND type=:type ' . + 'WHERE wave=:wave AND type=:type AND guild_id<>""' . 'GROUP BY guild_id '. 'ORDER BY value DESC ' . "LIMIT 10", From d60f834b54d954bd6c131eec1771b5de6814fecc Mon Sep 17 00:00:00 2001 From: hujiabin Date: Tue, 13 Dec 2022 14:25:29 +0800 Subject: [PATCH 4/9] 1 --- webapp/services/RankActivityService.php | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/webapp/services/RankActivityService.php b/webapp/services/RankActivityService.php index 1fc35562..ac74449a 100644 --- a/webapp/services/RankActivityService.php +++ b/webapp/services/RankActivityService.php @@ -19,6 +19,7 @@ require_once('models/Battle.php'); require_once('models/Bag.php'); require_once('models/Hero.php'); require_once('models/Gun.php'); +require_once('models/Guild.php'); use mt; use phpcommon; @@ -28,6 +29,7 @@ use models\Battle; use models\Bag; use models\Hero; use models\Gun; +use models\Guild; class RankActivityService extends BaseService { @@ -151,6 +153,23 @@ class RankActivityService extends BaseService { 'guild_id'=> '' ) ); + if ($row['guild_id']){ + $guild = Guild::find($row['guild_id']); + if ($guild['guild_status'] == 2){ + SqlHelper::update + (myself()->_getSelfMysql(), + 't_rank_activity', + array( + 'guild_id' => $row['guild_id'], + 'wave' => $meta['wave'], + 'type' => $meta['themeType'], + ), + array( + 'guild_id'=> '' + ) + ); + } + } } return; } @@ -167,6 +186,7 @@ class RankActivityService extends BaseService { 'value' => function () use($val) { return "value + ${val}"; }, + 'guild_id' =>$user['guild_id'], 'modifytime' => myself()->_getNowTime(), ), array( From 4f4b865d52386ce676fcd8fd454447458b8e9e24 Mon Sep 17 00:00:00 2001 From: hujiabin Date: Tue, 13 Dec 2022 14:36:34 +0800 Subject: [PATCH 5/9] 1 --- webapp/services/RankActivityService.php | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/webapp/services/RankActivityService.php b/webapp/services/RankActivityService.php index ac74449a..309a027b 100644 --- a/webapp/services/RankActivityService.php +++ b/webapp/services/RankActivityService.php @@ -141,18 +141,6 @@ class RankActivityService extends BaseService { ) ); if ($row){ - SqlHelper::update - (myself()->_getSelfMysql(), - 't_rank_activity', - array( - 'account_id' => myself()->_getAccountId(), - 'wave' => $meta['wave'], - 'type' => $meta['themeType'], - ), - array( - 'guild_id'=> '' - ) - ); if ($row['guild_id']){ $guild = Guild::find($row['guild_id']); if ($guild['guild_status'] == 2){ @@ -170,6 +158,19 @@ class RankActivityService extends BaseService { ); } } + error_log(json_encode($row)); + SqlHelper::update + (myself()->_getSelfMysql(), + 't_rank_activity', + array( + 'account_id' => myself()->_getAccountId(), + 'wave' => $meta['wave'], + 'type' => $meta['themeType'], + ), + array( + 'guild_id'=> '' + ) + ); } return; } From 42157ba31ee5031bce1936892414c46a3d7cc8dd Mon Sep 17 00:00:00 2001 From: hujiabin Date: Tue, 13 Dec 2022 14:45:06 +0800 Subject: [PATCH 6/9] 1 --- webapp/services/RankActivityService.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/webapp/services/RankActivityService.php b/webapp/services/RankActivityService.php index 309a027b..8ebd1935 100644 --- a/webapp/services/RankActivityService.php +++ b/webapp/services/RankActivityService.php @@ -140,9 +140,9 @@ class RankActivityService extends BaseService { 'type' => $meta['themeType'], ) ); - if ($row){ - if ($row['guild_id']){ + if ($row && $row['guild_id']){ $guild = Guild::find($row['guild_id']); + error_log('TEST LOG 1'.json_encode($guild)); if ($guild['guild_status'] == 2){ SqlHelper::update (myself()->_getSelfMysql(), @@ -157,8 +157,8 @@ class RankActivityService extends BaseService { ) ); } - } - error_log(json_encode($row)); + + error_log('TEST LOG 2'.json_encode($row)); SqlHelper::update (myself()->_getSelfMysql(), 't_rank_activity', From 05b538282b7863dcfbb698d18b3796c16a22caee Mon Sep 17 00:00:00 2001 From: hujiabin Date: Tue, 13 Dec 2022 15:04:20 +0800 Subject: [PATCH 7/9] 1 --- webapp/services/RankActivityService.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/webapp/services/RankActivityService.php b/webapp/services/RankActivityService.php index 8ebd1935..f3b11f7f 100644 --- a/webapp/services/RankActivityService.php +++ b/webapp/services/RankActivityService.php @@ -142,7 +142,7 @@ class RankActivityService extends BaseService { ); if ($row && $row['guild_id']){ $guild = Guild::find($row['guild_id']); - error_log('TEST LOG 1'.json_encode($guild)); + error_log('TEST LOG 1'.json_encode($guild['guild_status']).'--------------guild_id:'.$row['guild_id']); if ($guild['guild_status'] == 2){ SqlHelper::update (myself()->_getSelfMysql(), @@ -157,7 +157,7 @@ class RankActivityService extends BaseService { ) ); } - + error_log('TEST LOG 2'.json_encode($row)); SqlHelper::update (myself()->_getSelfMysql(), From 9a7c8893eb7a4aa709945ce971bbd151ec459f27 Mon Sep 17 00:00:00 2001 From: hujiabin Date: Tue, 13 Dec 2022 15:30:01 +0800 Subject: [PATCH 8/9] 1 --- webapp/controller/ShopController.class.php | 2 ++ webapp/services/RankActivityService.php | 3 --- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/webapp/controller/ShopController.class.php b/webapp/controller/ShopController.class.php index af5436dd..dded111f 100644 --- a/webapp/controller/ShopController.class.php +++ b/webapp/controller/ShopController.class.php @@ -661,7 +661,9 @@ class ShopController extends BaseAuthedController { case mt\Item::HERO_TYPE: { Hero::addHero($itemMeta); + User::upsertHeadList($itemMeta); $propertyChgService->addHeroChg(); + $propertyChgService->addUserChg(); } break; case mt\Item::HERO_SKIN_TYPE: diff --git a/webapp/services/RankActivityService.php b/webapp/services/RankActivityService.php index f3b11f7f..f3aa0b9a 100644 --- a/webapp/services/RankActivityService.php +++ b/webapp/services/RankActivityService.php @@ -142,7 +142,6 @@ class RankActivityService extends BaseService { ); if ($row && $row['guild_id']){ $guild = Guild::find($row['guild_id']); - error_log('TEST LOG 1'.json_encode($guild['guild_status']).'--------------guild_id:'.$row['guild_id']); if ($guild['guild_status'] == 2){ SqlHelper::update (myself()->_getSelfMysql(), @@ -157,8 +156,6 @@ class RankActivityService extends BaseService { ) ); } - - error_log('TEST LOG 2'.json_encode($row)); SqlHelper::update (myself()->_getSelfMysql(), 't_rank_activity', From 5f62b3d2c037d26ca42f118fca9ca99bb196c834 Mon Sep 17 00:00:00 2001 From: aozhiwei Date: Tue, 13 Dec 2022 15:34:30 +0800 Subject: [PATCH 9/9] 1 --- third_party/phpcommon | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/third_party/phpcommon b/third_party/phpcommon index daad845e..e658ed5f 160000 --- a/third_party/phpcommon +++ b/third_party/phpcommon @@ -1 +1 @@ -Subproject commit daad845e894ca033c4fdd31c9c6f39e1e4040f02 +Subproject commit e658ed5f7e4112801e59206f6da6f01db7131cd1