From b0d754ba2e3b5f9acd5e952081a949b47e519fd7 Mon Sep 17 00:00:00 2001 From: hujiabin <519660157@qq.com> Date: Wed, 17 Jan 2024 16:41:41 +0800 Subject: [PATCH] 1 --- webapp/services/HashRateService.php | 39 +++++++++++++++-------- webapp/services/TameBattleDataService.php | 34 +++++++++++++------- 2 files changed, 47 insertions(+), 26 deletions(-) diff --git a/webapp/services/HashRateService.php b/webapp/services/HashRateService.php index 10fa11c1..f43e97aa 100644 --- a/webapp/services/HashRateService.php +++ b/webapp/services/HashRateService.php @@ -2,11 +2,13 @@ namespace services; +require_once('models/Hero.php'); require_once('models/HashRate.php'); require_once('models/HashRateBattleData.php'); use models\HashRateBattleData; use models\HashRate; +use models\Hero; use mt\AchievementsPower; class HashRateService extends BaseService { @@ -23,16 +25,6 @@ class HashRateService extends BaseService $this->hisBattleData = HashRateBattleData::getMyBattleData(); $this->hashRateData = getXVal($this->hisBattleData, 'data', array()); -// $currentPeriod= \mt\AchievementsCycle::getCurrentPeriod(); -// if (myself()->_getDaySeconds(getXVal($this->hashRateData, 'modifytime', 0)) < -// myself()->_getDaySeconds($currentPeriod['obtain_end_time'])) { -// $this->hashRateData = array( -// 'pvpData' => array(), -// 'mobaData' => array(), -// 'createtime' => myself()->_getNowTime(), -// 'modifytime' => myself()->_getNowTime(), -// ); -// } if (!$this->hashRateData){ $this->hashRateData = array( 'pvpData' => array(), @@ -41,6 +33,15 @@ class HashRateService extends BaseService 'modifytime' => myself()->_getNowTime(), ); } + $currentPeriod= \mt\AchievementsCycle::getCurrentPeriod(); + if (myself()->_getDaySeconds(getXVal($this->hashRateData, 'modifytime', 0)) < + myself()->_getDaySeconds($currentPeriod['obtain_start_time'])) { + $this->hashRateData = array( + 'pvpData' => array(), + 'mobaData' => array(), + 'modifytime' => myself()->_getNowTime(), + ); + } $this->pvpBattleData = $this->hashRateData['pvpData']; $this->mobaBattleData = $this->hashRateData['mobaData']; } @@ -73,12 +74,14 @@ class HashRateService extends BaseService break; //X分钟内结束比赛 case AchievementsPower::NOMINAL_TIME_BATTLE_END : { - //.... + $taskDto['current'] = $this->getBattleData($taskMate, + 'total_fiveMin_times'); } break; //在局内升级最快次数 case AchievementsPower::IN_BATTLE_UP_LV : { - //..... + $taskDto['current'] = $this->getBattleData($taskMate, + 'total_first_Lv_up'); } break; //游戏场次 @@ -101,12 +104,20 @@ class HashRateService extends BaseService break; //累计行走距离(米) case AchievementsPower::WALKING_DISTANCE : { - //.../ + $taskDto['current'] = $this->getBattleData($taskMate, + 'total_walking_distance'); } break; //指定英雄升阶数 case AchievementsPower::HERO_UP_QUALITY : { - //..../ + $condition = $taskMate['condition']; + $quality = 0; + Hero::getHeroList(function ($row) use ($condition,&$quality) { + if ($row['hero_id'] == $condition && $row['quality'] > $quality){ + $quality = $row['quality']; + } + }); + $taskDto['current'] = $quality; } break; //拥有英雄nft数 diff --git a/webapp/services/TameBattleDataService.php b/webapp/services/TameBattleDataService.php index ef2f3341..6038aa4c 100644 --- a/webapp/services/TameBattleDataService.php +++ b/webapp/services/TameBattleDataService.php @@ -1260,30 +1260,40 @@ class TameBattleDataService extends BaseService { private function applyEx(&$battleData) { //战斗次数 - $this->incValue($battleData, 'total_battle_times', 1); - //排名 - $ranked = 0; + if (! getXVal($this->battleInfo,'is_run_away', 0)){ + $this->incValue($battleData, 'total_battle_times', 1); + } + switch (getXVal($this->allInfo,'room_mode', 0)){ case self::MATCH_MODE_PVP :{ - $ranked = getXVal($this->battleInfo,'pvp_team_rank', 0); + //排名 + $ranked = getXVal($this->battleInfo,'pvp_personal_rank', 0); if ($ranked == 40){ $this->incValue($battleData, 'total_last_runner_times', 1); } //救援次数 $this->incValue($battleData, 'total_rescue_times', getXVal($this->battleInfo,'rescue_teammate_times', 0)); - + //行走距离 + $distance = getXVal($this->battleInfo,'move_distance', 0); + $this->incValue($battleData, 'total_walking_distance', $distance); } break; case self::ROOM_MODE_MOBA :{ - /* - 排名 - 几分钟结束战斗 - 第一个升满级 - */ + //几分钟结束战斗 + $duration = getXVal($this->battleInfo,'game_duration', 0); + if ($duration && floor($duration / 60) < 5){ + $this->incValue($battleData, 'total_fiveMin_times', 1); + } + //第一个升满级 + $fullLv = getXVal($this->battleInfo,'full_level_idx', 0); + if ($fullLv == 1){ + $this->incValue($battleData, 'total_first_Lv_up', 1); + } } break; } - if ($ranked == 1){ + //是否胜利 + if (getXVal($this->allInfo,'victory', 0)){ $this->incValue($battleData, 'total_win_times', 1); } //击杀 @@ -1293,4 +1303,4 @@ class TameBattleDataService extends BaseService { $this->procWeaponsSlot($battleData); } -} +}