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 diff --git a/webapp/controller/EventRankingController.class.php b/webapp/controller/EventRankingController.class.php index f9135e3f..bde87534 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(){ @@ -122,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", @@ -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(); + } } 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 e8010a79..f3aa0b9a 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 { @@ -103,12 +105,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 +129,49 @@ 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 && $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'=> '' + ) + ); + } + 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', @@ -139,6 +184,7 @@ class RankActivityService extends BaseService { 'value' => function () use($val) { return "value + ${val}"; }, + 'guild_id' =>$user['guild_id'], 'modifytime' => myself()->_getNowTime(), ), array(